method
stringlengths 13
441k
| clean_method
stringlengths 7
313k
| doc
stringlengths 17
17.3k
| comment
stringlengths 3
1.42k
| method_name
stringlengths 1
273
| extra
dict | imports
sequence | imports_info
stringlengths 19
34.8k
| cluster_imports_info
stringlengths 15
3.66k
| libraries
sequence | libraries_info
stringlengths 6
661
| id
int64 0
2.92M
|
---|---|---|---|---|---|---|---|---|---|---|---|
public void warn(String msg, Object arg0, Object arg1) {
logIfEnabled(Level.WARNING, null, msg, arg0, arg1, UNKNOWN_ARG, null);
} | void function(String msg, Object arg0, Object arg1) { logIfEnabled(Level.WARNING, null, msg, arg0, arg1, UNKNOWN_ARG, null); } | /**
* Log a warning message.
*/ | Log a warning message | warn | {
"repo_name": "droidefense/engine",
"path": "mods/simplemagic/src/main/java/com/j256/simplemagic/logger/Logger.java",
"license": "gpl-3.0",
"size": 19636
} | [
"com.j256.simplemagic.logger.Log"
] | import com.j256.simplemagic.logger.Log; | import com.j256.simplemagic.logger.*; | [
"com.j256.simplemagic"
] | com.j256.simplemagic; | 2,368,934 |
private void rerouteAssociation(Object newNode, Object oldNode,
Object edge, boolean isSource) {
// check param types: only some connections are legal uml connections:
if (!(Model.getFacade().isAClassifier(newNode))
|| !(Model.getFacade().isAClassifier(oldNode)))
return;
// can't have a connection between 2 interfaces:
// get the 'other' end type
Object otherNode = null;
if (isSource) {
otherNode =
Model.getCoreHelper().getDestination( edge);
}
else {
otherNode =
Model.getCoreHelper().getSource( edge);
}
if (Model.getFacade().isAInterface(newNode)
&& Model.getFacade().isAInterface(otherNode))
return;
// cast the params
Object edgeAssoc = edge;
Object theEnd = null;
Object theOtherEnd = null;
Collection connections = Model.getFacade().getConnections(edgeAssoc);
Iterator iter = connections.iterator();
if (isSource) {
// rerouting the source:
theEnd = iter.next();
theOtherEnd = iter.next();
} else {
// rerouting the destination:
theOtherEnd = iter.next();
theEnd = iter.next();
}
// set the ends navigability see also Class ActionNavigability
if (Model.getFacade().isAInterface(newNode)) {
Model.getCoreHelper().setNavigable(theEnd, true);
Model.getCoreHelper().setNavigable(theOtherEnd, false);
}
if (Model.getFacade().isAInterface(otherNode)) {
Model.getCoreHelper().setNavigable(theOtherEnd, true);
Model.getCoreHelper().setNavigable(theEnd, false);
}
//set the new end type!
Model.getCoreHelper().setType(theEnd, newNode);
} | void function(Object newNode, Object oldNode, Object edge, boolean isSource) { if (!(Model.getFacade().isAClassifier(newNode)) !(Model.getFacade().isAClassifier(oldNode))) return; Object otherNode = null; if (isSource) { otherNode = Model.getCoreHelper().getDestination( edge); } else { otherNode = Model.getCoreHelper().getSource( edge); } if (Model.getFacade().isAInterface(newNode) && Model.getFacade().isAInterface(otherNode)) return; Object edgeAssoc = edge; Object theEnd = null; Object theOtherEnd = null; Collection connections = Model.getFacade().getConnections(edgeAssoc); Iterator iter = connections.iterator(); if (isSource) { theEnd = iter.next(); theOtherEnd = iter.next(); } else { theOtherEnd = iter.next(); theEnd = iter.next(); } if (Model.getFacade().isAInterface(newNode)) { Model.getCoreHelper().setNavigable(theEnd, true); Model.getCoreHelper().setNavigable(theOtherEnd, false); } if (Model.getFacade().isAInterface(otherNode)) { Model.getCoreHelper().setNavigable(theOtherEnd, true); Model.getCoreHelper().setNavigable(theEnd, false); } Model.getCoreHelper().setType(theEnd, newNode); } | /**
* helper method for changeConnectedNode
*/ | helper method for changeConnectedNode | rerouteAssociation | {
"repo_name": "carvalhomb/tsmells",
"path": "sample/argouml/argouml/org/argouml/uml/diagram/static_structure/ClassDiagramGraphModel.java",
"license": "gpl-2.0",
"size": 23040
} | [
"java.util.Collection",
"java.util.Iterator",
"org.argouml.model.Model"
] | import java.util.Collection; import java.util.Iterator; import org.argouml.model.Model; | import java.util.*; import org.argouml.model.*; | [
"java.util",
"org.argouml.model"
] | java.util; org.argouml.model; | 2,315,536 |
public void updateLiabilityIncreaseTransactionLineTaxLots(boolean isSource, EndowmentTaxLotLinesDocumentBase aiDocument, EndowmentTransactionLine transLine); | void function(boolean isSource, EndowmentTaxLotLinesDocumentBase aiDocument, EndowmentTransactionLine transLine); | /**
* This method...
* @param isSource
* @param aiDocument
* @param transLine
*/ | This method.. | updateLiabilityIncreaseTransactionLineTaxLots | {
"repo_name": "Ariah-Group/Finance",
"path": "af_webapp/src/main/java/org/kuali/kfs/module/endow/document/service/LiabilityDocumentService.java",
"license": "apache-2.0",
"size": 1470
} | [
"org.kuali.kfs.module.endow.businessobject.EndowmentTransactionLine",
"org.kuali.kfs.module.endow.document.EndowmentTaxLotLinesDocumentBase"
] | import org.kuali.kfs.module.endow.businessobject.EndowmentTransactionLine; import org.kuali.kfs.module.endow.document.EndowmentTaxLotLinesDocumentBase; | import org.kuali.kfs.module.endow.businessobject.*; import org.kuali.kfs.module.endow.document.*; | [
"org.kuali.kfs"
] | org.kuali.kfs; | 1,165,423 |
@CanIgnoreReturnValue
public static long exhaust(Readable readable) throws IOException {
long total = 0;
long read;
CharBuffer buf = createBuffer();
while ((read = readable.read(buf)) != -1) {
total += read;
buf.clear();
}
return total;
} | static long function(Readable readable) throws IOException { long total = 0; long read; CharBuffer buf = createBuffer(); while ((read = readable.read(buf)) != -1) { total += read; buf.clear(); } return total; } | /**
* Reads and discards data from the given {@code Readable} until the end of the stream is
* reached. Returns the total number of chars read. Does not close the stream.
*
* @since 20.0
*/ | Reads and discards data from the given Readable until the end of the stream is reached. Returns the total number of chars read. Does not close the stream | exhaust | {
"repo_name": "simonzhangsm/voltdb",
"path": "third_party/java/src/com/google_voltpatches/common/io/CharStreams.java",
"license": "agpl-3.0",
"size": 8230
} | [
"java.io.IOException",
"java.nio.CharBuffer"
] | import java.io.IOException; import java.nio.CharBuffer; | import java.io.*; import java.nio.*; | [
"java.io",
"java.nio"
] | java.io; java.nio; | 2,745,385 |
interface WithLoadBalancerFrontendIpConfigurations {
Update withLoadBalancerFrontendIpConfigurations(List<FrontendIPConfigurationInner> loadBalancerFrontendIpConfigurations);
} | interface WithLoadBalancerFrontendIpConfigurations { Update withLoadBalancerFrontendIpConfigurations(List<FrontendIPConfigurationInner> loadBalancerFrontendIpConfigurations); } | /**
* Specifies loadBalancerFrontendIpConfigurations.
* @param loadBalancerFrontendIpConfigurations An array of references to the load balancer IP configurations
* @return the next update stage
*/ | Specifies loadBalancerFrontendIpConfigurations | withLoadBalancerFrontendIpConfigurations | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/network/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/network/v2020_04_01/PrivateLinkService.java",
"license": "mit",
"size": 10158
} | [
"com.microsoft.azure.management.network.v2020_04_01.implementation.FrontendIPConfigurationInner",
"java.util.List"
] | import com.microsoft.azure.management.network.v2020_04_01.implementation.FrontendIPConfigurationInner; import java.util.List; | import com.microsoft.azure.management.network.v2020_04_01.implementation.*; import java.util.*; | [
"com.microsoft.azure",
"java.util"
] | com.microsoft.azure; java.util; | 2,591,166 |
public void setSmlPosLocationPoint(String srsName, String pos) {
Element parent = addNewNode(LOCATION, SML_NS, POINT, GML_NS, SRS_NAME, srsName);
addNewNode(parent, POS, GML_NS, pos);
} | void function(String srsName, String pos) { Element parent = addNewNode(LOCATION, SML_NS, POINT, GML_NS, SRS_NAME, srsName); addNewNode(parent, POS, GML_NS, pos); } | /**
* Sets a gml:Point for the location
* @param srsName srs/crs projection being used for coords
* @param pos lat lon of the location
*/ | Sets a gml:Point for the location | setSmlPosLocationPoint | {
"repo_name": "asascience-open/ncSOS",
"path": "src/main/java/com/asascience/ncsos/outputformatter/ds/IoosPlatform10Formatter.java",
"license": "mit",
"size": 18940
} | [
"org.jdom.Element"
] | import org.jdom.Element; | import org.jdom.*; | [
"org.jdom"
] | org.jdom; | 927,783 |
public void registerNewDeivceEvents() {
for (DeviceContainer device : devices) {
try {
logger.debug("Registring new device event for: " + device.getDeviceId().getDevid() + " of the client: " + clientId);
master.sendDeviceEvent(new DeviceEvent(device), clientId);
} catch (TimeoutException e) {
logger.debug("Failed to register new device event for: " + device.getDeviceId() + " of the client: " + clientId
+ " to master");
}
}
}
| void function() { for (DeviceContainer device : devices) { try { logger.debug(STR + device.getDeviceId().getDevid() + STR + clientId); master.sendDeviceEvent(new DeviceEvent(device), clientId); } catch (TimeoutException e) { logger.debug(STR + device.getDeviceId() + STR + clientId + STR); } } } | /**
* Method for registering new device events to the actuator master
* @param null
* @return void
*/ | Method for registering new device events to the actuator master | registerNewDeivceEvents | {
"repo_name": "B2M-Software/project-drahtlos-smg20",
"path": "actuatorclient.arduino.impl/src/main/java/org/fortiss/smg/actuatorclient/arduino/impl/commands/CommandFactory.java",
"license": "apache-2.0",
"size": 6966
} | [
"java.util.concurrent.TimeoutException",
"org.fortiss.smg.actuatormaster.api.events.DeviceEvent",
"org.fortiss.smg.containermanager.api.devices.DeviceContainer"
] | import java.util.concurrent.TimeoutException; import org.fortiss.smg.actuatormaster.api.events.DeviceEvent; import org.fortiss.smg.containermanager.api.devices.DeviceContainer; | import java.util.concurrent.*; import org.fortiss.smg.actuatormaster.api.events.*; import org.fortiss.smg.containermanager.api.devices.*; | [
"java.util",
"org.fortiss.smg"
] | java.util; org.fortiss.smg; | 730,109 |
private SourceViewer createViewer(Composite parent) {
SourceViewerConfiguration sourceViewerConfiguration = new StructuredTextViewerConfiguration() {
StructuredTextViewerConfiguration baseConfiguration = new StructuredTextViewerConfigurationJSP(); | SourceViewer function(Composite parent) { SourceViewerConfiguration sourceViewerConfiguration = new StructuredTextViewerConfiguration() { StructuredTextViewerConfiguration baseConfiguration = new StructuredTextViewerConfigurationJSP(); | /**
* Creates, configures and returns a source viewer to present the template
* pattern on the preference page. Clients may override to provide a
* custom source viewer featuring e.g. syntax coloring.
*
* @param parent
* the parent control
* @return a configured source viewer
*/ | Creates, configures and returns a source viewer to present the template pattern on the preference page. Clients may override to provide a custom source viewer featuring e.g. syntax coloring | createViewer | {
"repo_name": "ttimbul/eclipse.wst",
"path": "bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/wizard/NewJSPTemplatesWizardPage.java",
"license": "epl-1.0",
"size": 17937
} | [
"org.eclipse.jface.text.source.SourceViewer",
"org.eclipse.jface.text.source.SourceViewerConfiguration",
"org.eclipse.jst.jsp.ui.StructuredTextViewerConfigurationJSP",
"org.eclipse.swt.widgets.Composite",
"org.eclipse.wst.sse.ui.StructuredTextViewerConfiguration"
] | import org.eclipse.jface.text.source.SourceViewer; import org.eclipse.jface.text.source.SourceViewerConfiguration; import org.eclipse.jst.jsp.ui.StructuredTextViewerConfigurationJSP; import org.eclipse.swt.widgets.Composite; import org.eclipse.wst.sse.ui.StructuredTextViewerConfiguration; | import org.eclipse.jface.text.source.*; import org.eclipse.jst.jsp.ui.*; import org.eclipse.swt.widgets.*; import org.eclipse.wst.sse.ui.*; | [
"org.eclipse.jface",
"org.eclipse.jst",
"org.eclipse.swt",
"org.eclipse.wst"
] | org.eclipse.jface; org.eclipse.jst; org.eclipse.swt; org.eclipse.wst; | 1,738,421 |
@FIXVersion(introduced = "4.0", retired = "4.3")
@TagNumRef(tagNum = TagNum.SecurityIDSource)
public String getSecurityIDSource() {
return getSafeInstrument().getSecurityIDSource();
} | @FIXVersion(introduced = "4.0", retired = "4.3") @TagNumRef(tagNum = TagNum.SecurityIDSource) String function() { return getSafeInstrument().getSecurityIDSource(); } | /**
* Message field getter.
* @return field value
*/ | Message field getter | getSecurityIDSource | {
"repo_name": "marvisan/HadesFIX",
"path": "Model/src/main/java/net/hades/fix/message/OrderStatusRequestMsg.java",
"license": "gpl-3.0",
"size": 41851
} | [
"net.hades.fix.message.anno.FIXVersion",
"net.hades.fix.message.anno.TagNumRef",
"net.hades.fix.message.type.TagNum"
] | import net.hades.fix.message.anno.FIXVersion; import net.hades.fix.message.anno.TagNumRef; import net.hades.fix.message.type.TagNum; | import net.hades.fix.message.anno.*; import net.hades.fix.message.type.*; | [
"net.hades.fix"
] | net.hades.fix; | 1,292,848 |
@Test
public void testDepsAsSrcs() throws Exception {
final SourceFile depsFile1 =
SourceFile.fromCode(
"/base/deps1.js",
LINE_JOINER.join(
"// Test deps file 1.",
"",
"goog.addDependency('../prescanned1/file1.js', ['dep.string'], []);",
"goog.addDependency('../prescanned1/file2.js', [], []);",
"// Test that this appears only once in the output. It's also defined in deps2.js",
"goog.addDependency('../this/is/defined/thrice.js', [], []);",
"goog.addDependency('../this/is/defined/thrice.js', [], []);",
""));
final SourceFile depsFile2 =
SourceFile.fromCode(
"/base/deps2.js",
LINE_JOINER.join(
"// Test deps file 2.",
"",
"goog.addDependency("
+ "'../prescanned2/file1.js', ['dep.bool', 'dep.number'], ['dep.string']);",
"goog.addDependency('../prescanned2/file2.js', [], []);",
"goog.addDependency('../prescanned2/generated.js', ['dep.generated'], []);",
"goog.addDependency('../this/is/defined/thrice.js', [], []);",
""));
DepsGenerator depsGenerator =
new DepsGenerator(
ImmutableList.of(depsFile1),
ImmutableList.of(depsFile2),
DepsGenerator.InclusionStrategy.ALWAYS,
PathUtil.makeAbsolute("/base/javascript/closure"),
errorManager,
ModuleLoader.builder()
.setErrorHandler(null)
.setModuleRoots(ImmutableList.of("/base/" + "/"))
.setInputs(ImmutableList.of())
.setFactory(BrowserModuleResolver.FACTORY)
.setPathResolver(ModuleLoader.PathResolver.ABSOLUTE)
.build());
String output = depsGenerator.computeDependencyCalls();
assertWithMessage("There should be output").that(output).isNotEmpty();
assertNoWarnings();
} | void function() throws Exception { final SourceFile depsFile1 = SourceFile.fromCode( STR, LINE_JOINER.join( " "STRgoog.addDependency('../prescanned1/file1.js', ['dep.string'], []);STRgoog.addDependency('../prescanned1/file2.js', [], []);STR "goog.addDependency('../this/is/defined/thrice.js', [], []);STRgoog.addDependency('../this/is/defined/thrice.js', [], []);STR")); final SourceFile depsFile2 = SourceFile.fromCode( "/base/deps2.jsSTR "STRgoog.addDependency(STR'../prescanned2/file1.js', ['dep.bool', 'dep.number'], ['dep.string']);STRgoog.addDependency('../prescanned2/file2.js', [], []);STRgoog.addDependency('../prescanned2/generated.js', ['dep.generated'], []);STRgoog.addDependency('../this/is/defined/thrice.js', [], []);STRSTR/base/javascript/closureSTR/base/STR/STRThere should be output").that(output).isNotEmpty(); assertNoWarnings(); } | /**
* Ensures that everything still works when both a deps.js and a deps-runfiles.js file are
* included. Also uses real files.
*/ | Ensures that everything still works when both a deps.js and a deps-runfiles.js file are included. Also uses real files | testDepsAsSrcs | {
"repo_name": "GoogleChromeLabs/chromeos_smart_card_connector",
"path": "third_party/closure-compiler/src/test/com/google/javascript/jscomp/deps/DepsGeneratorTest.java",
"license": "apache-2.0",
"size": 25924
} | [
"com.google.javascript.jscomp.SourceFile"
] | import com.google.javascript.jscomp.SourceFile; | import com.google.javascript.jscomp.*; | [
"com.google.javascript"
] | com.google.javascript; | 1,268,468 |
@Override
public Set<IVariable<?>> getRequiredBound(final ServiceNode serviceNode) {
return new HashSet<IVariable<?>>();
} | Set<IVariable<?>> function(final ServiceNode serviceNode) { return new HashSet<IVariable<?>>(); } | /**
* Default implementation for method
* {@link ServiceFactory#getRequiredBound(ServiceNode)}, allowing for
* simple services where all variables used inside the service are
* considered "outgoing". As a consequence, when building upon this
* default implementation, the Service will be executed *before* the
* variables used inside the Service body are bound.
*/ | Default implementation for method <code>ServiceFactory#getRequiredBound(ServiceNode)</code>, allowing for simple services where all variables used inside the service are considered "outgoing". As a consequence, when building upon this default implementation, the Service will be executed *before* the variables used inside the Service body are bound | getRequiredBound | {
"repo_name": "blazegraph/database",
"path": "bigdata-core/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/eval/CustomServiceFactoryBase.java",
"license": "gpl-2.0",
"size": 2597
} | [
"com.bigdata.bop.IVariable",
"com.bigdata.rdf.sparql.ast.service.ServiceNode",
"java.util.HashSet",
"java.util.Set"
] | import com.bigdata.bop.IVariable; import com.bigdata.rdf.sparql.ast.service.ServiceNode; import java.util.HashSet; import java.util.Set; | import com.bigdata.bop.*; import com.bigdata.rdf.sparql.ast.service.*; import java.util.*; | [
"com.bigdata.bop",
"com.bigdata.rdf",
"java.util"
] | com.bigdata.bop; com.bigdata.rdf; java.util; | 1,739,592 |
public void setAppearance(PDAppearanceDictionary appearance) {
COSDictionary ap = null;
if (appearance != null) {
ap = appearance.getCOSObject();
}
dictionary.setItem(COSName.AP, ap);
} | void function(PDAppearanceDictionary appearance) { COSDictionary ap = null; if (appearance != null) { ap = appearance.getCOSObject(); } dictionary.setItem(COSName.AP, ap); } | /**
* This will set the appearance associated with this annotation.
*
* @param appearance The appearance dictionary for this annotation.
*/ | This will set the appearance associated with this annotation | setAppearance | {
"repo_name": "gavanx/pdflearn",
"path": "pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/PDAnnotation.java",
"license": "apache-2.0",
"size": 19366
} | [
"org.apache.pdfbox.cos.COSDictionary",
"org.apache.pdfbox.cos.COSName"
] | import org.apache.pdfbox.cos.COSDictionary; import org.apache.pdfbox.cos.COSName; | import org.apache.pdfbox.cos.*; | [
"org.apache.pdfbox"
] | org.apache.pdfbox; | 2,548,687 |
public void addTag (String tag)
{
this.tags.add (tag);
SortedSet<NetworkElement> setElements = netPlan.cache_taggedElements.get (tag);
if (setElements == null) { setElements = new TreeSet<> (); netPlan.cache_taggedElements.put (tag , setElements); }
setElements.add (this);
}
| void function (String tag) { this.tags.add (tag); SortedSet<NetworkElement> setElements = netPlan.cache_taggedElements.get (tag); if (setElements == null) { setElements = new TreeSet<> (); netPlan.cache_taggedElements.put (tag , setElements); } setElements.add (this); } | /** Adds a tag to this network element. If the element already has this tag, nothing happens
* @param tag the tag
*/ | Adds a tag to this network element. If the element already has this tag, nothing happens | addTag | {
"repo_name": "girtel/Net2Plan",
"path": "Net2Plan-Core/src/main/java/com/net2plan/interfaces/networkDesign/NetworkElement.java",
"license": "bsd-2-clause",
"size": 21575
} | [
"java.util.SortedSet",
"java.util.TreeSet"
] | import java.util.SortedSet; import java.util.TreeSet; | import java.util.*; | [
"java.util"
] | java.util; | 1,265,171 |
public static List<XAttr> readINodeXAttrs(INode inode) {
XAttrFeature f = inode.getXAttrFeature();
return f == null ? ImmutableList.<XAttr> of() : f.getXAttrs();
} | static List<XAttr> function(INode inode) { XAttrFeature f = inode.getXAttrFeature(); return f == null ? ImmutableList.<XAttr> of() : f.getXAttrs(); } | /**
* Reads the existing extended attributes of an inode.
* <p/>
* Must be called while holding the FSDirectory read lock.
*
* @param inode INode to read.
* @return List<XAttr> <code>XAttr</code> list.
*/ | Reads the existing extended attributes of an inode. Must be called while holding the FSDirectory read lock | readINodeXAttrs | {
"repo_name": "bruthe/hadoop-2.6.0r",
"path": "src/hdfs/org/apache/hadoop/hdfs/server/namenode/XAttrStorage.java",
"license": "apache-2.0",
"size": 3817
} | [
"com.google.common.collect.ImmutableList",
"java.util.List",
"org.apache.hadoop.fs.XAttr"
] | import com.google.common.collect.ImmutableList; import java.util.List; import org.apache.hadoop.fs.XAttr; | import com.google.common.collect.*; import java.util.*; import org.apache.hadoop.fs.*; | [
"com.google.common",
"java.util",
"org.apache.hadoop"
] | com.google.common; java.util; org.apache.hadoop; | 837,829 |
private static boolean nestedSetAsSkyKeyOptionsChanged(OptionsProvider options) {
BuildRequestOptions buildRequestOptions = options.getOptions(BuildRequestOptions.class);
if (buildRequestOptions == null) {
return false;
}
return ArtifactNestedSetFunction.sizeThresholdUpdated(
buildRequestOptions.nestedSetAsSkyKeyThreshold);
}
private static final ImmutableSet<SkyFunctionName> PACKAGE_LOCATOR_DEPENDENT_VALUES =
ImmutableSet.of(
FileStateValue.FILE_STATE,
FileValue.FILE,
SkyFunctions.DIRECTORY_LISTING_STATE,
SkyFunctions.TARGET_PATTERN,
SkyFunctions.PREPARE_DEPS_OF_PATTERN,
SkyFunctions.TARGET_PATTERN,
SkyFunctions.TARGET_PATTERN_PHASE); | static boolean function(OptionsProvider options) { BuildRequestOptions buildRequestOptions = options.getOptions(BuildRequestOptions.class); if (buildRequestOptions == null) { return false; } return ArtifactNestedSetFunction.sizeThresholdUpdated( buildRequestOptions.nestedSetAsSkyKeyThreshold); } private static final ImmutableSet<SkyFunctionName> PACKAGE_LOCATOR_DEPENDENT_VALUES = ImmutableSet.of( FileStateValue.FILE_STATE, FileValue.FILE, SkyFunctions.DIRECTORY_LISTING_STATE, SkyFunctions.TARGET_PATTERN, SkyFunctions.PREPARE_DEPS_OF_PATTERN, SkyFunctions.TARGET_PATTERN, SkyFunctions.TARGET_PATTERN_PHASE); | /**
* Updates ArtifactNestedSetFunction options if the flags' values changed.
*
* @return whether an update was made.
*/ | Updates ArtifactNestedSetFunction options if the flags' values changed | nestedSetAsSkyKeyOptionsChanged | {
"repo_name": "davidzchen/bazel",
"path": "src/main/java/com/google/devtools/build/lib/skyframe/SequencedSkyframeExecutor.java",
"license": "apache-2.0",
"size": 54596
} | [
"com.google.common.collect.ImmutableSet",
"com.google.devtools.build.lib.actions.FileStateValue",
"com.google.devtools.build.lib.actions.FileValue",
"com.google.devtools.build.lib.buildtool.BuildRequestOptions",
"com.google.devtools.build.skyframe.SkyFunctionName",
"com.google.devtools.common.options.OptionsProvider"
] | import com.google.common.collect.ImmutableSet; import com.google.devtools.build.lib.actions.FileStateValue; import com.google.devtools.build.lib.actions.FileValue; import com.google.devtools.build.lib.buildtool.BuildRequestOptions; import com.google.devtools.build.skyframe.SkyFunctionName; import com.google.devtools.common.options.OptionsProvider; | import com.google.common.collect.*; import com.google.devtools.build.lib.actions.*; import com.google.devtools.build.lib.buildtool.*; import com.google.devtools.build.skyframe.*; import com.google.devtools.common.options.*; | [
"com.google.common",
"com.google.devtools"
] | com.google.common; com.google.devtools; | 1,405,083 |
public void setFlags(String flagsAsString) {
String[] flagsArray = flagsAsString.split(",");
this.flags = new Flag[flagsArray.length];
for (int i = 0; i < flagsArray.length; i++) {
this.flags[i] = Flag.valueOf(flagsArray[i]);
}
} | void function(String flagsAsString) { String[] flagsArray = flagsAsString.split(","); this.flags = new Flag[flagsArray.length]; for (int i = 0; i < flagsArray.length; i++) { this.flags[i] = Flag.valueOf(flagsArray[i]); } } | /**
* A comma separated list of Flag to be applied by default on each cache
* invocation, not applicable to remote caches.
*/ | A comma separated list of Flag to be applied by default on each cache invocation, not applicable to remote caches | setFlags | {
"repo_name": "curso007/camel",
"path": "components/camel-infinispan/src/main/java/org/apache/camel/component/infinispan/InfinispanConfiguration.java",
"license": "apache-2.0",
"size": 9219
} | [
"org.infinispan.context.Flag"
] | import org.infinispan.context.Flag; | import org.infinispan.context.*; | [
"org.infinispan.context"
] | org.infinispan.context; | 1,107,225 |
@XmlElement(name = "environment")
public String[] getEnvironment(); | @XmlElement(name = STR) String[] function(); | /**
* Get the environment attributes
*
* @return
*/ | Get the environment attributes | getEnvironment | {
"repo_name": "cbaerikebc/kapua",
"path": "service/device/command/api/src/main/java/org/eclipse/kapua/service/device/management/command/DeviceCommandInput.java",
"license": "epl-1.0",
"size": 3959
} | [
"javax.xml.bind.annotation.XmlElement"
] | import javax.xml.bind.annotation.XmlElement; | import javax.xml.bind.annotation.*; | [
"javax.xml"
] | javax.xml; | 1,472,412 |
public T language(ExpressionFactory expression) {
setExpressionType(expression);
return result;
} | T function(ExpressionFactory expression) { setExpressionType(expression); return result; } | /**
* Specify an {@link ExpressionFactory} instance
*/ | Specify an <code>ExpressionFactory</code> instance | language | {
"repo_name": "adessaigne/camel",
"path": "core/camel-core-engine/src/main/java/org/apache/camel/builder/ExpressionClauseSupport.java",
"license": "apache-2.0",
"size": 41637
} | [
"org.apache.camel.ExpressionFactory"
] | import org.apache.camel.ExpressionFactory; | import org.apache.camel.*; | [
"org.apache.camel"
] | org.apache.camel; | 2,808,872 |
@Generated
@Selector("setEnabled:")
public native void setEnabled(byte value); | @Selector(STR) native void function(byte value); | /**
* Is this texture enabled
*/ | Is this texture enabled | setEnabled | {
"repo_name": "multi-os-engine/moe-core",
"path": "moe.apple/moe.platform.ios/src/main/java/apple/glkit/GLKEffectPropertyTexture.java",
"license": "apache-2.0",
"size": 6001
} | [
"org.moe.natj.objc.ann.Selector"
] | import org.moe.natj.objc.ann.Selector; | import org.moe.natj.objc.ann.*; | [
"org.moe.natj"
] | org.moe.natj; | 1,245,368 |
private RemoteInfo newRemoteInfo(String host, int port) {
return new RemoteInfo(randomAlphaOfLength(5), host, port, null, query, null, null, emptyMap(),
RemoteInfo.DEFAULT_SOCKET_TIMEOUT, RemoteInfo.DEFAULT_CONNECT_TIMEOUT);
} | RemoteInfo function(String host, int port) { return new RemoteInfo(randomAlphaOfLength(5), host, port, null, query, null, null, emptyMap(), RemoteInfo.DEFAULT_SOCKET_TIMEOUT, RemoteInfo.DEFAULT_CONNECT_TIMEOUT); } | /**
* Build a {@link RemoteInfo}, defaulting values that we don't care about in this test to values that don't hurt anything.
*/ | Build a <code>RemoteInfo</code>, defaulting values that we don't care about in this test to values that don't hurt anything | newRemoteInfo | {
"repo_name": "uschindler/elasticsearch",
"path": "modules/reindex/src/test/java/org/elasticsearch/index/reindex/ReindexFromRemoteWhitelistTests.java",
"license": "apache-2.0",
"size": 5683
} | [
"java.util.Collections"
] | import java.util.Collections; | import java.util.*; | [
"java.util"
] | java.util; | 950,484 |
public static final String[] splitWords(String s, boolean splitOnWs, char[] delimiters) {
if (s == null) return null;
int cstart = -1, // -1 = scanning space, other = startpos of content
len = s.length();
assert delimiters == null || _splitWords_assert(delimiters);
LinkedList l = new LinkedList();
for (int pos = 0; pos < len; pos++) {
char ch = s.charAt(pos);
if (cstart < 0) {
if (splitOnWs && (ch == 0x0a || Character.isSpaceChar(ch))) continue;
if (delimiters != null && Arrays.binarySearch(delimiters, ch) > -1) continue;
cstart = pos;
} else {
boolean endOfWord = false;
if (splitOnWs && ((ch == 0x0a || Character.isSpaceChar(ch)))) {
endOfWord = true;
}
if (delimiters != null && Arrays.binarySearch(delimiters, ch) > -1) {
endOfWord = true;
}
if (!endOfWord) {
continue;
}
l.add(s.substring(cstart, pos));
cstart = -1;
}
}
if (cstart >= 0) l.add(s.substring(cstart)); // Emit final token
return (String[]) l.toArray(new String[l.size()]);
} | static final String[] function(String s, boolean splitOnWs, char[] delimiters) { if (s == null) return null; int cstart = -1, len = s.length(); assert delimiters == null _splitWords_assert(delimiters); LinkedList l = new LinkedList(); for (int pos = 0; pos < len; pos++) { char ch = s.charAt(pos); if (cstart < 0) { if (splitOnWs && (ch == 0x0a Character.isSpaceChar(ch))) continue; if (delimiters != null && Arrays.binarySearch(delimiters, ch) > -1) continue; cstart = pos; } else { boolean endOfWord = false; if (splitOnWs && ((ch == 0x0a Character.isSpaceChar(ch)))) { endOfWord = true; } if (delimiters != null && Arrays.binarySearch(delimiters, ch) > -1) { endOfWord = true; } if (!endOfWord) { continue; } l.add(s.substring(cstart, pos)); cstart = -1; } } if (cstart >= 0) l.add(s.substring(cstart)); return (String[]) l.toArray(new String[l.size()]); } | /**
* Split into words.
* @param s
* String to split
* @param splitOnWs
* whitespace causes split
* @param delimiters
* array of other chars causing a split, must be sorted in ascending order, e.g.
* <code>{',','.'}</code>
* @return array of words
*/ | Split into words | splitWords | {
"repo_name": "ept/fuego-diff",
"path": "src/fc/util/StringUtil.java",
"license": "mit",
"size": 9074
} | [
"java.util.Arrays",
"java.util.LinkedList"
] | import java.util.Arrays; import java.util.LinkedList; | import java.util.*; | [
"java.util"
] | java.util; | 2,385,251 |
static long addressOffset(ByteBuffer buffer) {
return UNSAFE.getLong(buffer, BUFFER_ADDRESS_OFFSET);
} | static long addressOffset(ByteBuffer buffer) { return UNSAFE.getLong(buffer, BUFFER_ADDRESS_OFFSET); } | /**
* Gets the offset of the {@code address} field of the given direct {@link ByteBuffer}.
*/ | Gets the offset of the address field of the given direct <code>ByteBuffer</code> | addressOffset | {
"repo_name": "pocketberserker/scala-zero-formatter",
"path": "unsafe/src/main/java/zeroformatter/unsafe/UnsafeUtil.java",
"license": "mit",
"size": 11421
} | [
"java.nio.ByteBuffer"
] | import java.nio.ByteBuffer; | import java.nio.*; | [
"java.nio"
] | java.nio; | 1,011,012 |
public static latitudeSignType fromPerUnaligned(byte[] encodedBytes) {
latitudeSignType result = new latitudeSignType();
result.decodePerUnaligned(new BitStreamReader(encodedBytes));
return result;
} | static latitudeSignType function(byte[] encodedBytes) { latitudeSignType result = new latitudeSignType(); result.decodePerUnaligned(new BitStreamReader(encodedBytes)); return result; } | /**
* Creates a new latitudeSignType from encoded stream.
*/ | Creates a new latitudeSignType from encoded stream | fromPerUnaligned | {
"repo_name": "google/supl-client",
"path": "src/main/java/com/google/location/suplclient/asn1/supl2/lpp/EllipsoidPointWithUncertaintyEllipse.java",
"license": "apache-2.0",
"size": 34851
} | [
"com.google.location.suplclient.asn1.base.BitStreamReader"
] | import com.google.location.suplclient.asn1.base.BitStreamReader; | import com.google.location.suplclient.asn1.base.*; | [
"com.google.location"
] | com.google.location; | 1,524,948 |
public @NonNull PrintAttributes getAttributes() {
return mAttributes;
} | @NonNull PrintAttributes function() { return mAttributes; } | /**
* Gets the print job attributes.
*
* @return The attributes.
*/ | Gets the print job attributes | getAttributes | {
"repo_name": "xorware/android_frameworks_base",
"path": "core/java/android/print/PrintJobInfo.java",
"license": "apache-2.0",
"size": 23439
} | [
"android.annotation.NonNull"
] | import android.annotation.NonNull; | import android.annotation.*; | [
"android.annotation"
] | android.annotation; | 2,873,307 |
public boolean hasPerson(Person person) {
boolean result = false;
if (person1 == person.getIdentifier())
result = true;
else if (person2 == person.getIdentifier())
result = true;
return result;
}
| boolean function(Person person) { boolean result = false; if (person1 == person.getIdentifier()) result = true; else if (person2 == person.getIdentifier()) result = true; return result; } | /**
* Checks if a given person is in this relationship.
*
* @param person the person to check
* @return true if person is in this relationship
*/ | Checks if a given person is in this relationship | hasPerson | {
"repo_name": "mars-sim/mars-sim",
"path": "mars-sim-core/src/main/java/org/mars_sim/msp/core/person/ai/social/Relationship.java",
"license": "gpl-3.0",
"size": 10511
} | [
"org.mars_sim.msp.core.person.Person"
] | import org.mars_sim.msp.core.person.Person; | import org.mars_sim.msp.core.person.*; | [
"org.mars_sim.msp"
] | org.mars_sim.msp; | 102,185 |
public static ScheduledExecutorService getTimerSerivce() {
return s_timerService;
} | static ScheduledExecutorService function() { return s_timerService; } | /**
* Gets the timer service.
* @return the timer service
*/ | Gets the timer service | getTimerSerivce | {
"repo_name": "kgibm/open-liberty",
"path": "dev/com.ibm.ws.sipcontainer/src/com/ibm/ws/sip/container/timer/TimerServiceImpl.java",
"license": "epl-1.0",
"size": 5508
} | [
"java.util.concurrent.ScheduledExecutorService"
] | import java.util.concurrent.ScheduledExecutorService; | import java.util.concurrent.*; | [
"java.util"
] | java.util; | 2,227,145 |
public void setRounds(List<Round> pRounds) {
this.rounds = pRounds;
}
| void function(List<Round> pRounds) { this.rounds = pRounds; } | /**
* Rounds setter
*
* @param pRounds List<Round>
*/ | Rounds setter | setRounds | {
"repo_name": "SGirousse/GOTE",
"path": "src/com/gote/ui/newtournament/JRoundsTable.java",
"license": "apache-2.0",
"size": 2825
} | [
"com.gote.pojo.Round",
"java.util.List"
] | import com.gote.pojo.Round; import java.util.List; | import com.gote.pojo.*; import java.util.*; | [
"com.gote.pojo",
"java.util"
] | com.gote.pojo; java.util; | 1,778,966 |
List<JMeterTreeNode> nodeList = new LinkedList<>();
traverseAndFind(type, (JMeterTreeNode) this.getRoot(), nodeList);
return nodeList;
}
| List<JMeterTreeNode> nodeList = new LinkedList<>(); traverseAndFind(type, (JMeterTreeNode) this.getRoot(), nodeList); return nodeList; } | /**
* Returns a list of tree nodes that hold objects of the given class type.
* If none are found, an empty list is returned.
* @param type The type of nodes, which are to be collected
* @return a list of tree nodes of the given <code>type</code>, or an empty list
*/ | Returns a list of tree nodes that hold objects of the given class type. If none are found, an empty list is returned | getNodesOfType | {
"repo_name": "yuyupapa/OpenSource",
"path": "apache-jmeter-3.0/src/core/org/apache/jmeter/gui/tree/JMeterTreeModel.java",
"license": "apache-2.0",
"size": 11483
} | [
"java.util.LinkedList",
"java.util.List"
] | import java.util.LinkedList; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,170,021 |
protected void performHistoryRecordAction(HistoryRecord rHistoryRecord)
{
} | void function(HistoryRecord rHistoryRecord) { } | /***************************************
* This method can be overridden by subclasses to react to an action event
* for a certain history record. The default implementation does nothing.
*
* @param rHistoryRecord The history record for which the even occurred
*/ | This method can be overridden by subclasses to react to an action event for a certain history record. The default implementation does nothing | performHistoryRecordAction | {
"repo_name": "esoco/esoco-business",
"path": "src/main/java/de/esoco/process/step/entity/DisplayEntityHistory.java",
"license": "apache-2.0",
"size": 29989
} | [
"de.esoco.history.HistoryRecord"
] | import de.esoco.history.HistoryRecord; | import de.esoco.history.*; | [
"de.esoco.history"
] | de.esoco.history; | 2,803,601 |
@PostMapping("/{serviceId}/build")
@PreAuthorize("hasAnyRole('CONTENT_AUTHORITY', 'ADMIN') or hasPermission(#service, 'write')")
public ResponseEntity build(@ModelAttribute("serviceId") FtepService service) {
FtepServiceDockerBuildInfo dockerBuildInfo = service.getDockerBuildInfo();
if (dockerBuildInfo != null && dockerBuildInfo.getDockerBuildStatus().equals(Status.IN_PROCESS)) {
return new ResponseEntity<>("A build is already in process", HttpStatus.CONFLICT);
} else if (dockerBuildInfo != null && dockerBuildInfo.getDockerBuildStatus().equals(Status.REQUESTED)) {
return new ResponseEntity<>("A build has already been requested", HttpStatus.CONFLICT);
} else {
String currentServiceFingerprint = serviceDataService.computeServiceFingerprint(service);
LOG.info("Building service via REST API: {}", service.getName());
if (dockerBuildInfo == null) {
dockerBuildInfo = new FtepServiceDockerBuildInfo();
service.setDockerBuildInfo(dockerBuildInfo);
}
dockerBuildInfo.setDockerBuildStatus(Status.REQUESTED);
serviceDataService.save(service);
BuildServiceParams.Builder buildServiceParamsBuilder = BuildServiceParams.newBuilder()
.setUserId(ftepSecurityService.getCurrentUser().getName())
.setServiceId(String.valueOf(service.getId()))
.setServiceName(service.getName())
.setBuildFingerprint(currentServiceFingerprint);
BuildServiceParams buildServiceParams = buildServiceParamsBuilder.build();
buildService(service, buildServiceParams);
return new ResponseEntity<>(HttpStatus.ACCEPTED);
}
} | @PostMapping(STR) @PreAuthorize(STR) ResponseEntity function(@ModelAttribute(STR) FtepService service) { FtepServiceDockerBuildInfo dockerBuildInfo = service.getDockerBuildInfo(); if (dockerBuildInfo != null && dockerBuildInfo.getDockerBuildStatus().equals(Status.IN_PROCESS)) { return new ResponseEntity<>(STR, HttpStatus.CONFLICT); } else if (dockerBuildInfo != null && dockerBuildInfo.getDockerBuildStatus().equals(Status.REQUESTED)) { return new ResponseEntity<>(STR, HttpStatus.CONFLICT); } else { String currentServiceFingerprint = serviceDataService.computeServiceFingerprint(service); LOG.info(STR, service.getName()); if (dockerBuildInfo == null) { dockerBuildInfo = new FtepServiceDockerBuildInfo(); service.setDockerBuildInfo(dockerBuildInfo); } dockerBuildInfo.setDockerBuildStatus(Status.REQUESTED); serviceDataService.save(service); BuildServiceParams.Builder buildServiceParamsBuilder = BuildServiceParams.newBuilder() .setUserId(ftepSecurityService.getCurrentUser().getName()) .setServiceId(String.valueOf(service.getId())) .setServiceName(service.getName()) .setBuildFingerprint(currentServiceFingerprint); BuildServiceParams buildServiceParams = buildServiceParamsBuilder.build(); buildService(service, buildServiceParams); return new ResponseEntity<>(HttpStatus.ACCEPTED); } } | /**
* <p>Builds the service docker image.</p>
* <p>Build is launched asynchronously.</p>
*/ | Builds the service docker image. Build is launched asynchronously | build | {
"repo_name": "cgi-eoss/ftep",
"path": "f-tep-api/src/main/java/com/cgi/eoss/ftep/api/controllers/ServicesApiExtension.java",
"license": "agpl-3.0",
"size": 13176
} | [
"com.cgi.eoss.ftep.model.FtepService",
"com.cgi.eoss.ftep.model.FtepServiceDockerBuildInfo",
"com.cgi.eoss.ftep.rpc.BuildServiceParams",
"org.springframework.http.HttpStatus",
"org.springframework.http.ResponseEntity",
"org.springframework.security.access.prepost.PreAuthorize",
"org.springframework.web.bind.annotation.ModelAttribute",
"org.springframework.web.bind.annotation.PostMapping"
] | import com.cgi.eoss.ftep.model.FtepService; import com.cgi.eoss.ftep.model.FtepServiceDockerBuildInfo; import com.cgi.eoss.ftep.rpc.BuildServiceParams; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PostMapping; | import com.cgi.eoss.ftep.model.*; import com.cgi.eoss.ftep.rpc.*; import org.springframework.http.*; import org.springframework.security.access.prepost.*; import org.springframework.web.bind.annotation.*; | [
"com.cgi.eoss",
"org.springframework.http",
"org.springframework.security",
"org.springframework.web"
] | com.cgi.eoss; org.springframework.http; org.springframework.security; org.springframework.web; | 1,842,051 |
public static Map<String, Object> deactivateAssocs(DispatchContext dctx, Map<String, ? extends Object> context) {
Delegator delegator = dctx.getDelegator();
String contentIdTo = (String) context.get("contentIdTo");
String mapKey = (String) context.get("mapKey");
String contentAssocTypeId = (String) context.get("contentAssocTypeId");
String activeContentId = (String) context.get("activeContentId");
String contentId = (String) context.get("contentId");
Timestamp fromDate = (Timestamp) context.get("fromDate");
Locale locale = (Locale) context.get("locale");
Timestamp nowTimestamp = UtilDateTime.nowTimestamp();
String sequenceNum = null;
Map<String, Object> results = FastMap.newInstance();
try {
GenericValue activeAssoc = null;
if (fromDate != null) {
activeAssoc = EntityQuery.use(delegator).from("ContentAssoc").where("contentId", activeContentId, "contentIdTo", contentIdTo, "fromDate", fromDate, "contentAssocTypeId", contentAssocTypeId).queryOne();
if (activeAssoc == null) {
return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentAssocNotFound", UtilMisc.toMap("activeContentId", activeContentId, "contentIdTo", contentIdTo, "contentAssocTypeId", contentAssocTypeId, "fromDate", fromDate), locale));
}
sequenceNum = (String) activeAssoc.get("sequenceNum");
}
List<EntityCondition> exprList = FastList.newInstance();
exprList.add(EntityCondition.makeCondition("mapKey", EntityOperator.EQUALS, mapKey));
if (sequenceNum != null) {
exprList.add(EntityCondition.makeCondition("sequenceNum", EntityOperator.EQUALS, sequenceNum));
}
exprList.add(EntityCondition.makeCondition("mapKey", EntityOperator.EQUALS, mapKey));
exprList.add(EntityCondition.makeCondition("thruDate", EntityOperator.EQUALS, null));
exprList.add(EntityCondition.makeCondition("contentIdTo", EntityOperator.EQUALS, contentIdTo));
exprList.add(EntityCondition.makeCondition("contentAssocTypeId", EntityOperator.EQUALS, contentAssocTypeId));
if (UtilValidate.isNotEmpty(activeContentId)) {
exprList.add(EntityCondition.makeCondition("contentId", EntityOperator.NOT_EQUAL, activeContentId));
}
if (UtilValidate.isNotEmpty(contentId)) {
exprList.add(EntityCondition.makeCondition("contentId", EntityOperator.EQUALS, contentId));
}
EntityConditionList<EntityCondition> assocExprList = EntityCondition.makeCondition(exprList, EntityOperator.AND);
List<GenericValue> relatedAssocs = EntityQuery.use(delegator).from("ContentAssoc")
.where(assocExprList)
.orderBy("fromDate").filterByDate().queryList();
//if (Debug.infoOn()) Debug.logInfo("in deactivateAssocs, relatedAssocs:" + relatedAssocs, module);
for (GenericValue val : relatedAssocs) {
val.set("thruDate", nowTimestamp);
val.store();
//if (Debug.infoOn()) Debug.logInfo("in deactivateAssocs, val:" + val, module);
}
results.put("deactivatedList", relatedAssocs);
} catch (GenericEntityException e) {
return ServiceUtil.returnError(e.getMessage());
}
return results;
} | static Map<String, Object> function(DispatchContext dctx, Map<String, ? extends Object> context) { Delegator delegator = dctx.getDelegator(); String contentIdTo = (String) context.get(STR); String mapKey = (String) context.get(STR); String contentAssocTypeId = (String) context.get(STR); String activeContentId = (String) context.get(STR); String contentId = (String) context.get(STR); Timestamp fromDate = (Timestamp) context.get(STR); Locale locale = (Locale) context.get(STR); Timestamp nowTimestamp = UtilDateTime.nowTimestamp(); String sequenceNum = null; Map<String, Object> results = FastMap.newInstance(); try { GenericValue activeAssoc = null; if (fromDate != null) { activeAssoc = EntityQuery.use(delegator).from(STR).where(STR, activeContentId, STR, contentIdTo, STR, fromDate, STR, contentAssocTypeId).queryOne(); if (activeAssoc == null) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, STR, UtilMisc.toMap(STR, activeContentId, STR, contentIdTo, STR, contentAssocTypeId, STR, fromDate), locale)); } sequenceNum = (String) activeAssoc.get(STR); } List<EntityCondition> exprList = FastList.newInstance(); exprList.add(EntityCondition.makeCondition(STR, EntityOperator.EQUALS, mapKey)); if (sequenceNum != null) { exprList.add(EntityCondition.makeCondition(STR, EntityOperator.EQUALS, sequenceNum)); } exprList.add(EntityCondition.makeCondition(STR, EntityOperator.EQUALS, mapKey)); exprList.add(EntityCondition.makeCondition(STR, EntityOperator.EQUALS, null)); exprList.add(EntityCondition.makeCondition(STR, EntityOperator.EQUALS, contentIdTo)); exprList.add(EntityCondition.makeCondition(STR, EntityOperator.EQUALS, contentAssocTypeId)); if (UtilValidate.isNotEmpty(activeContentId)) { exprList.add(EntityCondition.makeCondition(STR, EntityOperator.NOT_EQUAL, activeContentId)); } if (UtilValidate.isNotEmpty(contentId)) { exprList.add(EntityCondition.makeCondition(STR, EntityOperator.EQUALS, contentId)); } EntityConditionList<EntityCondition> assocExprList = EntityCondition.makeCondition(exprList, EntityOperator.AND); List<GenericValue> relatedAssocs = EntityQuery.use(delegator).from(STR) .where(assocExprList) .orderBy(STR).filterByDate().queryList(); for (GenericValue val : relatedAssocs) { val.set(STR, nowTimestamp); val.store(); } results.put(STR, relatedAssocs); } catch (GenericEntityException e) { return ServiceUtil.returnError(e.getMessage()); } return results; } | /**
* Deactivates any active ContentAssoc (except the current one) that is associated with the passed in template/layout contentId and mapKey.
*/ | Deactivates any active ContentAssoc (except the current one) that is associated with the passed in template/layout contentId and mapKey | deactivateAssocs | {
"repo_name": "ofbizfriends/vogue",
"path": "applications/content/src/org/ofbiz/content/content/ContentServices.java",
"license": "apache-2.0",
"size": 56365
} | [
"java.sql.Timestamp",
"java.util.List",
"java.util.Locale",
"java.util.Map",
"javolution.util.FastList",
"javolution.util.FastMap",
"org.ofbiz.base.util.UtilDateTime",
"org.ofbiz.base.util.UtilMisc",
"org.ofbiz.base.util.UtilProperties",
"org.ofbiz.base.util.UtilValidate",
"org.ofbiz.entity.Delegator",
"org.ofbiz.entity.GenericEntityException",
"org.ofbiz.entity.GenericValue",
"org.ofbiz.entity.condition.EntityCondition",
"org.ofbiz.entity.condition.EntityConditionList",
"org.ofbiz.entity.condition.EntityOperator",
"org.ofbiz.entity.util.EntityQuery",
"org.ofbiz.service.DispatchContext",
"org.ofbiz.service.ServiceUtil"
] | import java.sql.Timestamp; import java.util.List; import java.util.Locale; import java.util.Map; import javolution.util.FastList; import javolution.util.FastMap; import org.ofbiz.base.util.UtilDateTime; import org.ofbiz.base.util.UtilMisc; import org.ofbiz.base.util.UtilProperties; import org.ofbiz.base.util.UtilValidate; import org.ofbiz.entity.Delegator; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; import org.ofbiz.entity.condition.EntityCondition; import org.ofbiz.entity.condition.EntityConditionList; import org.ofbiz.entity.condition.EntityOperator; import org.ofbiz.entity.util.EntityQuery; import org.ofbiz.service.DispatchContext; import org.ofbiz.service.ServiceUtil; | import java.sql.*; import java.util.*; import javolution.util.*; import org.ofbiz.base.util.*; import org.ofbiz.entity.*; import org.ofbiz.entity.condition.*; import org.ofbiz.entity.util.*; import org.ofbiz.service.*; | [
"java.sql",
"java.util",
"javolution.util",
"org.ofbiz.base",
"org.ofbiz.entity",
"org.ofbiz.service"
] | java.sql; java.util; javolution.util; org.ofbiz.base; org.ofbiz.entity; org.ofbiz.service; | 2,872,448 |
private boolean remove(String filePath) throws NoModificationAllowedException, InvalidModificationException {
File fp = createFileObject(filePath);
// You can't delete the root directory.
if (atRootDirectory(filePath)) {
throw new NoModificationAllowedException("You can't delete the root directory");
}
// You can't delete a directory that is not empty
if (fp.isDirectory() && fp.list().length > 0) {
throw new InvalidModificationException("You can't delete a directory that is not empty.");
}
return fp.delete();
} | boolean function(String filePath) throws NoModificationAllowedException, InvalidModificationException { File fp = createFileObject(filePath); if (atRootDirectory(filePath)) { throw new NoModificationAllowedException(STR); } if (fp.isDirectory() && fp.list().length > 0) { throw new InvalidModificationException(STR); } return fp.delete(); } | /**
* Deletes a file or directory. It is an error to attempt to delete a directory that is not empty.
* It is an error to attempt to delete the root directory of a filesystem.
*
* @param filePath file or directory to be removed
* @return a boolean representing success of failure
* @throws NoModificationAllowedException
* @throws InvalidModificationException
*/ | Deletes a file or directory. It is an error to attempt to delete a directory that is not empty. It is an error to attempt to delete the root directory of a filesystem | remove | {
"repo_name": "virola/app-radar",
"path": "platforms/android/src/org/apache/cordova/file/FileUtils.java",
"license": "apache-2.0",
"size": 41523
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 1,946,105 |
public Text getColumnQualifier() {
return getColumnQualifier(new Text());
} | Text function() { return getColumnQualifier(new Text()); } | /**
* Gets the column qualifier as a <code>Text</code> object.
*
* @return Text containing the column qualifier
*/ | Gets the column qualifier as a <code>Text</code> object | getColumnQualifier | {
"repo_name": "ivakegg/accumulo",
"path": "core/src/main/java/org/apache/accumulo/core/data/Key.java",
"license": "apache-2.0",
"size": 43038
} | [
"org.apache.hadoop.io.Text"
] | import org.apache.hadoop.io.Text; | import org.apache.hadoop.io.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 271,138 |
private void highlightItem(int position, View view) {
if(position == mSelectedItem || (position == 0 && mSelectedItem == -1)) {
// you can define your own color of selected item here
view.setBackgroundColor(mContext.getResources().getColor(R.color.lv_selected_item));
}
else {
// you can define your own default selector here
view.setBackgroundColor(mContext.getResources().getColor(R.color.bg_application_color));
}
}
| void function(int position, View view) { if(position == mSelectedItem (position == 0 && mSelectedItem == -1)) { view.setBackgroundColor(mContext.getResources().getColor(R.color.lv_selected_item)); } else { view.setBackgroundColor(mContext.getResources().getColor(R.color.bg_application_color)); } } | /**
* Set the background of the item of the view. The background color
* depend on selected or not the item view.
*
* @param position The position where the view is.
* @param view The view.
*/ | Set the background of the item of the view. The background color depend on selected or not the item view | highlightItem | {
"repo_name": "rgmf/LTN",
"path": "src/es/rgmf/ltn/adapters/EvaluationListAdapter.java",
"license": "gpl-3.0",
"size": 5643
} | [
"android.view.View"
] | import android.view.View; | import android.view.*; | [
"android.view"
] | android.view; | 1,557,049 |
void onMessage(BGPSession session, Notification notification); | void onMessage(BGPSession session, Notification notification); | /**
* Fired when a normal protocol message is received.
*
* @param notification Protocol message
*/ | Fired when a normal protocol message is received | onMessage | {
"repo_name": "inocybe/odl-bgpcep",
"path": "bgp/rib-spi/src/main/java/org/opendaylight/protocol/bgp/rib/spi/BGPSessionListener.java",
"license": "epl-1.0",
"size": 2238
} | [
"org.opendaylight.yangtools.yang.binding.Notification"
] | import org.opendaylight.yangtools.yang.binding.Notification; | import org.opendaylight.yangtools.yang.binding.*; | [
"org.opendaylight.yangtools"
] | org.opendaylight.yangtools; | 1,329,832 |
public List<DBJoinExpr> getJoins()
{
return (this.joins!=null ? Collections.unmodifiableList(this.joins) : null);
} | List<DBJoinExpr> function() { return (this.joins!=null ? Collections.unmodifiableList(this.joins) : null); } | /**
* Returns a copy of the defined joins.
*
* @return the list of joins
*/ | Returns a copy of the defined joins | getJoins | {
"repo_name": "apache/empire-db",
"path": "empire-db/src/main/java/org/apache/empire/db/DBCommand.java",
"license": "apache-2.0",
"size": 61286
} | [
"java.util.Collections",
"java.util.List",
"org.apache.empire.db.expr.join.DBJoinExpr"
] | import java.util.Collections; import java.util.List; import org.apache.empire.db.expr.join.DBJoinExpr; | import java.util.*; import org.apache.empire.db.expr.join.*; | [
"java.util",
"org.apache.empire"
] | java.util; org.apache.empire; | 420,100 |
public static Object process(Context context, File file)
throws FileNotFoundException, RomaException {
return process(context, new FileInputStream(file));
} | static Object function(Context context, File file) throws FileNotFoundException, RomaException { return process(context, new FileInputStream(file)); } | /**
* Processes the content of the file within the provided context
*
* @param file
* @return
* @throws FileNotFoundException
* @throws RomaException
*/ | Processes the content of the file within the provided context | process | {
"repo_name": "JEBailey/roma",
"path": "src/lang/roma/Interpreter.java",
"license": "apache-2.0",
"size": 3469
} | [
"java.io.File",
"java.io.FileInputStream",
"java.io.FileNotFoundException"
] | import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; | import java.io.*; | [
"java.io"
] | java.io; | 949,349 |
public synchronized void deleteGlobalCodeNodeComment(
final INaviCodeNode node, final IComment comment) throws CouldntDeleteException {
Preconditions.checkNotNull(node, "IE02567: codeNode argument can not be null");
deleteComment(new CodeNodeCommentingStrategy(node, CommentScope.GLOBAL), comment);
} | synchronized void function( final INaviCodeNode node, final IComment comment) throws CouldntDeleteException { Preconditions.checkNotNull(node, STR); deleteComment(new CodeNodeCommentingStrategy(node, CommentScope.GLOBAL), comment); } | /**
* Deletes a global comment from a code nodes global comment list.
*
* @param node The code node where the comment is deleted.
* @param comment The comment which will get deleted.
*
* @throws CouldntDeleteException if the changes could not be saved to the database.
*/ | Deletes a global comment from a code nodes global comment list | deleteGlobalCodeNodeComment | {
"repo_name": "aeppert/binnavi",
"path": "src/main/java/com/google/security/zynamics/binnavi/disassembly/CommentManager.java",
"license": "apache-2.0",
"size": 127063
} | [
"com.google.common.base.Preconditions",
"com.google.security.zynamics.binnavi.Database",
"com.google.security.zynamics.binnavi.Gui"
] | import com.google.common.base.Preconditions; import com.google.security.zynamics.binnavi.Database; import com.google.security.zynamics.binnavi.Gui; | import com.google.common.base.*; import com.google.security.zynamics.binnavi.*; | [
"com.google.common",
"com.google.security"
] | com.google.common; com.google.security; | 2,333,488 |
@Test
public void testReadFlowFileContentAndStoreInFlowFileAttribute() throws Exception {
final TestRunner runner = TestRunners.newTestRunner(new ExecuteScript());
runner.setValidateExpressionUsage(false);
runner.setProperty(scriptingComponent.getScriptingComponentHelper().SCRIPT_ENGINE, "lua");
runner.setProperty(ScriptingComponentUtils.SCRIPT_FILE, "target/test/resources/lua/test_onTrigger.lua");
runner.setProperty(ScriptingComponentUtils.MODULES, "target/test/resources/lua");
runner.assertValid();
runner.enqueue("test content".getBytes(StandardCharsets.UTF_8));
runner.run();
runner.assertAllFlowFilesTransferred(ExecuteScript.REL_SUCCESS, 1);
final List<MockFlowFile> result = runner.getFlowFilesForRelationship(ExecuteScript.REL_SUCCESS);
result.get(0).assertAttributeEquals("from-content", "test content");
} | void function() throws Exception { final TestRunner runner = TestRunners.newTestRunner(new ExecuteScript()); runner.setValidateExpressionUsage(false); runner.setProperty(scriptingComponent.getScriptingComponentHelper().SCRIPT_ENGINE, "lua"); runner.setProperty(ScriptingComponentUtils.SCRIPT_FILE, STR); runner.setProperty(ScriptingComponentUtils.MODULES, STR); runner.assertValid(); runner.enqueue(STR.getBytes(StandardCharsets.UTF_8)); runner.run(); runner.assertAllFlowFilesTransferred(ExecuteScript.REL_SUCCESS, 1); final List<MockFlowFile> result = runner.getFlowFilesForRelationship(ExecuteScript.REL_SUCCESS); result.get(0).assertAttributeEquals(STR, STR); } | /**
* Tests a script that has provides the body of an onTrigger() function.
*
* @throws Exception Any error encountered while testing
*/ | Tests a script that has provides the body of an onTrigger() function | testReadFlowFileContentAndStoreInFlowFileAttribute | {
"repo_name": "jtstorck/nifi",
"path": "nifi-nar-bundles/nifi-scripting-bundle/nifi-scripting-processors/src/test/java/org/apache/nifi/processors/script/TestExecuteLua.java",
"license": "apache-2.0",
"size": 2380
} | [
"java.nio.charset.StandardCharsets",
"java.util.List",
"org.apache.nifi.script.ScriptingComponentUtils",
"org.apache.nifi.util.MockFlowFile",
"org.apache.nifi.util.TestRunner",
"org.apache.nifi.util.TestRunners"
] | import java.nio.charset.StandardCharsets; import java.util.List; import org.apache.nifi.script.ScriptingComponentUtils; import org.apache.nifi.util.MockFlowFile; import org.apache.nifi.util.TestRunner; import org.apache.nifi.util.TestRunners; | import java.nio.charset.*; import java.util.*; import org.apache.nifi.script.*; import org.apache.nifi.util.*; | [
"java.nio",
"java.util",
"org.apache.nifi"
] | java.nio; java.util; org.apache.nifi; | 1,560,992 |
public PluginEmbedOptionsUI getEmbedOptionsUI(OpenStegoUI stegoUI) throws OpenStegoException
{
return null;
}
| PluginEmbedOptionsUI function(OpenStegoUI stegoUI) throws OpenStegoException { return null; } | /**
* Method to get the UI object specific to this plugin, which will be embedded inside the main OpenStego GUI
*
* @param stegoUI Reference to the parent OpenStegoUI object
* @return UI object specific to this plugin
* @throws OpenStegoException
*/ | Method to get the UI object specific to this plugin, which will be embedded inside the main OpenStego GUI | getEmbedOptionsUI | {
"repo_name": "seglo/openstego",
"path": "src/net/sourceforge/openstego/plugin/template/image/WMImagePluginTemplate.java",
"license": "gpl-2.0",
"size": 5309
} | [
"net.sourceforge.openstego.OpenStegoException",
"net.sourceforge.openstego.ui.OpenStegoUI",
"net.sourceforge.openstego.ui.PluginEmbedOptionsUI"
] | import net.sourceforge.openstego.OpenStegoException; import net.sourceforge.openstego.ui.OpenStegoUI; import net.sourceforge.openstego.ui.PluginEmbedOptionsUI; | import net.sourceforge.openstego.*; import net.sourceforge.openstego.ui.*; | [
"net.sourceforge.openstego"
] | net.sourceforge.openstego; | 2,837,210 |
private void fillWithServiceData(@NonNull final ListPreference listPreference)
{
final List<HashMap<String, Object>> services = Services.getServices(this, true);
if (services != null)
{
final int n = services.size();
final String[] entries = new String[n];
final String[] values = new String[n];
for (int i = 0; i < n; i++)
{
final HashMap<String, Object> service = services.get(i);
entries[i] = (String) service.get(Services.LABEL);
values[i] = (String) service.get(Services.PACKAGE) + '/' + service.get(Services.NAME);
}
listPreference.setEntries(entries);
listPreference.setEntryValues(values);
}
} | void function(@NonNull final ListPreference listPreference) { final List<HashMap<String, Object>> services = Services.getServices(this, true); if (services != null) { final int n = services.size(); final String[] entries = new String[n]; final String[] values = new String[n]; for (int i = 0; i < n; i++) { final HashMap<String, Object> service = services.get(i); entries[i] = (String) service.get(Services.LABEL); values[i] = (String) service.get(Services.PACKAGE) + '/' + service.get(Services.NAME); } listPreference.setEntries(entries); listPreference.setEntryValues(values); } } | /**
* Connect list preference to service data
*
* @param listPreference list preference
*/ | Connect list preference to service data | fillWithServiceData | {
"repo_name": "1313ou/Treebolic",
"path": "treebolic/src/main/java/org/treebolic/SettingsActivity.java",
"license": "gpl-3.0",
"size": 10006
} | [
"androidx.annotation.NonNull",
"androidx.preference.ListPreference",
"java.util.HashMap",
"java.util.List"
] | import androidx.annotation.NonNull; import androidx.preference.ListPreference; import java.util.HashMap; import java.util.List; | import androidx.annotation.*; import androidx.preference.*; import java.util.*; | [
"androidx.annotation",
"androidx.preference",
"java.util"
] | androidx.annotation; androidx.preference; java.util; | 2,650,777 |
public NumberDataValue times(NumberDataValue left,
NumberDataValue right,
NumberDataValue result)
throws StandardException
{
if (result == null)
{
result = new SQLTinyint();
}
if (left.isNull() || right.isNull())
{
result.setToNull();
return result;
}
int product = left.getByte() * right.getByte();
result.setValue(product);
return result;
} | NumberDataValue function(NumberDataValue left, NumberDataValue right, NumberDataValue result) throws StandardException { if (result == null) { result = new SQLTinyint(); } if (left.isNull() right.isNull()) { result.setToNull(); return result; } int product = left.getByte() * right.getByte(); result.setValue(product); return result; } | /**
* This method implements the * operator for "tinyint * tinyint".
*
* @param left The first value to be multiplied
* @param right The second value to be multiplied
* @param result The result of a previous call to this method, null
* if not called yet
*
* @return A SQLTinyint containing the result of the multiplication
*
* @exception StandardException Thrown on error
*/ | This method implements the * operator for "tinyint * tinyint" | times | {
"repo_name": "kavin256/Derby",
"path": "java/engine/org/apache/derby/iapi/types/SQLTinyint.java",
"license": "apache-2.0",
"size": 16799
} | [
"org.apache.derby.iapi.error.StandardException",
"org.apache.derby.iapi.types.NumberDataValue"
] | import org.apache.derby.iapi.error.StandardException; import org.apache.derby.iapi.types.NumberDataValue; | import org.apache.derby.iapi.error.*; import org.apache.derby.iapi.types.*; | [
"org.apache.derby"
] | org.apache.derby; | 2,247,952 |
public static void triggerJobImmediately (Structure structure, User user) {
String randomID = UUID.randomUUID().toString();
JobDataMap dataMap = new JobDataMap();
dataMap.put("structure", structure);
dataMap.put("user", user);
JobDetail jd = new JobDetail("IdentifierDateJob-" + randomID, "identifier_date_job", IdentifierDateJob.class);
jd.setJobDataMap(dataMap);
jd.setDurability(false);
jd.setVolatility(false);
jd.setRequestsRecovery(true);
long startTime = System.currentTimeMillis();
SimpleTrigger trigger = new SimpleTrigger("IdentifierDateTrigger-" + randomID, "identifier_data_triggers", new Date(startTime));
try {
Scheduler sched = QuartzUtils.getSequentialScheduler();
sched.scheduleJob(jd, trigger);
} catch (SchedulerException e) {
Logger.error(IdentifierDateJob.class, "Error scheduling the Identifier Date Job", e);
throw new DotRuntimeException("Error scheduling the Identifier Date Job", e);
}
AdminLogger.log(IdentifierDateJob.class, "triggerJobImmediately", "Updating Identifiers Dates of: "+ structure.getName());
} | static void function (Structure structure, User user) { String randomID = UUID.randomUUID().toString(); JobDataMap dataMap = new JobDataMap(); dataMap.put(STR, structure); dataMap.put("user", user); JobDetail jd = new JobDetail(STR + randomID, STR, IdentifierDateJob.class); jd.setJobDataMap(dataMap); jd.setDurability(false); jd.setVolatility(false); jd.setRequestsRecovery(true); long startTime = System.currentTimeMillis(); SimpleTrigger trigger = new SimpleTrigger(STR + randomID, STR, new Date(startTime)); try { Scheduler sched = QuartzUtils.getSequentialScheduler(); sched.scheduleJob(jd, trigger); } catch (SchedulerException e) { Logger.error(IdentifierDateJob.class, STR, e); throw new DotRuntimeException(STR, e); } AdminLogger.log(IdentifierDateJob.class, STR, STR+ structure.getName()); } | /**
* Setup the job and trigger it immediately
*
* @param structure
* @param newPublishVar
* @param newExpireVar
*/ | Setup the job and trigger it immediately | triggerJobImmediately | {
"repo_name": "wisdom-garden/dotcms",
"path": "src/com/dotmarketing/quartz/job/IdentifierDateJob.java",
"license": "gpl-3.0",
"size": 7287
} | [
"com.dotmarketing.exception.DotRuntimeException",
"com.dotmarketing.portlets.structure.model.Structure",
"com.dotmarketing.quartz.QuartzUtils",
"com.dotmarketing.util.AdminLogger",
"com.dotmarketing.util.Logger",
"com.liferay.portal.model.User",
"java.util.Date",
"java.util.UUID",
"org.quartz.JobDataMap",
"org.quartz.JobDetail",
"org.quartz.Scheduler",
"org.quartz.SchedulerException",
"org.quartz.SimpleTrigger"
] | import com.dotmarketing.exception.DotRuntimeException; import com.dotmarketing.portlets.structure.model.Structure; import com.dotmarketing.quartz.QuartzUtils; import com.dotmarketing.util.AdminLogger; import com.dotmarketing.util.Logger; import com.liferay.portal.model.User; import java.util.Date; import java.util.UUID; import org.quartz.JobDataMap; import org.quartz.JobDetail; import org.quartz.Scheduler; import org.quartz.SchedulerException; import org.quartz.SimpleTrigger; | import com.dotmarketing.exception.*; import com.dotmarketing.portlets.structure.model.*; import com.dotmarketing.quartz.*; import com.dotmarketing.util.*; import com.liferay.portal.model.*; import java.util.*; import org.quartz.*; | [
"com.dotmarketing.exception",
"com.dotmarketing.portlets",
"com.dotmarketing.quartz",
"com.dotmarketing.util",
"com.liferay.portal",
"java.util",
"org.quartz"
] | com.dotmarketing.exception; com.dotmarketing.portlets; com.dotmarketing.quartz; com.dotmarketing.util; com.liferay.portal; java.util; org.quartz; | 2,802,732 |
PropertiesPair pair = new PropertiesPair();
// load default resource
String defaultResourceName;
if (lang == null) {
defaultResourceName = RESOURCE_PATH + "FtpStatus.properties";
} else {
defaultResourceName = RESOURCE_PATH + "FtpStatus_" + lang
+ ".properties";
}
InputStream in = null;
try {
in = getClass().getClassLoader().getResourceAsStream(
defaultResourceName);
if (in != null) {
try {
pair.defaultProperties.load(in);
} catch (IOException e) {
throw new FtpServerConfigurationException(
"Failed to load messages from \"" + defaultResourceName + "\", file not found in classpath");
}
} else {
throw new FtpServerConfigurationException(
"Failed to load messages from \"" + defaultResourceName + "\", file not found in classpath");
}
} finally {
IoUtils.close(in);
}
// load custom resource
File resourceFile = null;
if (lang == null) {
resourceFile = new File(customMessageDirectory, "FtpStatus.gen");
} else {
resourceFile = new File(customMessageDirectory, "FtpStatus_" + lang
+ ".gen");
}
in = null;
try {
if (resourceFile.exists()) {
in = new FileInputStream(resourceFile);
pair.customProperties.load(in);
}
} catch (Exception ex) {
LOG.warn("MessageResourceImpl.createPropertiesPair()", ex);
throw new FtpServerConfigurationException(
"MessageResourceImpl.createPropertiesPair()", ex);
} finally {
IoUtils.close(in);
}
return pair;
} | PropertiesPair pair = new PropertiesPair(); String defaultResourceName; if (lang == null) { defaultResourceName = RESOURCE_PATH + STR; } else { defaultResourceName = RESOURCE_PATH + STR + lang + STR; } InputStream in = null; try { in = getClass().getClassLoader().getResourceAsStream( defaultResourceName); if (in != null) { try { pair.defaultProperties.load(in); } catch (IOException e) { throw new FtpServerConfigurationException( STRSTR\STR); } } else { throw new FtpServerConfigurationException( STRSTR\STR); } } finally { IoUtils.close(in); } File resourceFile = null; if (lang == null) { resourceFile = new File(customMessageDirectory, STR); } else { resourceFile = new File(customMessageDirectory, STR + lang + ".gen"); } in = null; try { if (resourceFile.exists()) { in = new FileInputStream(resourceFile); pair.customProperties.load(in); } } catch (Exception ex) { LOG.warn(STR, ex); throw new FtpServerConfigurationException( STR, ex); } finally { IoUtils.close(in); } return pair; } | /**
* Create Properties pair object. It stores the default and the custom
* messages.
*/ | Create Properties pair object. It stores the default and the custom messages | createPropertiesPair | {
"repo_name": "CasparLi/ftpserver",
"path": "core/src/main/java/org/apache/ftpserver/message/impl/DefaultMessageResource.java",
"license": "apache-2.0",
"size": 8256
} | [
"java.io.File",
"java.io.FileInputStream",
"java.io.IOException",
"java.io.InputStream",
"org.apache.ftpserver.FtpServerConfigurationException",
"org.apache.ftpserver.util.IoUtils"
] | import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import org.apache.ftpserver.FtpServerConfigurationException; import org.apache.ftpserver.util.IoUtils; | import java.io.*; import org.apache.ftpserver.*; import org.apache.ftpserver.util.*; | [
"java.io",
"org.apache.ftpserver"
] | java.io; org.apache.ftpserver; | 1,840,897 |
public void setLabelColour(Color colour) {
if (useLabel) {
this.label.setForeground(colour);
}
} | void function(Color colour) { if (useLabel) { this.label.setForeground(colour); } } | /**
* If using the label then set its text (foreground) colour
*
* @param colour
*/ | If using the label then set its text (foreground) colour | setLabelColour | {
"repo_name": "apache/incubator-taverna-workbench",
"path": "taverna-uibuilder/src/main/java/org/apache/taverna/lang/uibuilder/BeanComponent.java",
"license": "apache-2.0",
"size": 14112
} | [
"java.awt.Color"
] | import java.awt.Color; | import java.awt.*; | [
"java.awt"
] | java.awt; | 2,556,354 |
public void removeNodes(int number, String nodeSourceName, boolean preemptive) {
int numberOfRemovedNodes = 0;
// temporary list to avoid concurrent modification
List<RMNode> nodelList = new LinkedList<>();
nodelList.addAll(eligibleNodes);
logger.debug("Free nodes size " + nodelList.size());
for (RMNode node : nodelList) {
if (numberOfRemovedNodes == number) {
break;
}
if (node.getNodeSource().getName().equals(nodeSourceName)) {
removeNode(node.getNodeURL(), preemptive);
numberOfRemovedNodes++;
}
}
nodelList.clear();
nodelList.addAll(allNodes.values());
logger.debug("All nodes size " + nodelList.size());
if (numberOfRemovedNodes < number) {
for (RMNode node : nodelList) {
if (numberOfRemovedNodes == number) {
break;
}
if (node.isBusy() && node.getNodeSource().getName().equals(nodeSourceName)) {
removeNode(node.getNodeURL(), preemptive);
numberOfRemovedNodes++;
}
}
}
if (numberOfRemovedNodes < number) {
logger.warn("Cannot remove " + number + " nodes from node source " + nodeSourceName);
}
} | void function(int number, String nodeSourceName, boolean preemptive) { int numberOfRemovedNodes = 0; List<RMNode> nodelList = new LinkedList<>(); nodelList.addAll(eligibleNodes); logger.debug(STR + nodelList.size()); for (RMNode node : nodelList) { if (numberOfRemovedNodes == number) { break; } if (node.getNodeSource().getName().equals(nodeSourceName)) { removeNode(node.getNodeURL(), preemptive); numberOfRemovedNodes++; } } nodelList.clear(); nodelList.addAll(allNodes.values()); logger.debug(STR + nodelList.size()); if (numberOfRemovedNodes < number) { for (RMNode node : nodelList) { if (numberOfRemovedNodes == number) { break; } if (node.isBusy() && node.getNodeSource().getName().equals(nodeSourceName)) { removeNode(node.getNodeURL(), preemptive); numberOfRemovedNodes++; } } } if (numberOfRemovedNodes < number) { logger.warn(STR + number + STR + nodeSourceName); } } | /**
* Removes "number" of nodes from the node source.
*
* @param number amount of nodes to be released
* @param nodeSourceName a node source name
* @param preemptive if true remove nodes immediately without waiting while they will be freed
*/ | Removes "number" of nodes from the node source | removeNodes | {
"repo_name": "paraita/scheduling",
"path": "rm/rm-server/src/main/java/org/ow2/proactive/resourcemanager/core/RMCore.java",
"license": "agpl-3.0",
"size": 126360
} | [
"java.util.LinkedList",
"java.util.List",
"org.ow2.proactive.resourcemanager.rmnode.RMNode"
] | import java.util.LinkedList; import java.util.List; import org.ow2.proactive.resourcemanager.rmnode.RMNode; | import java.util.*; import org.ow2.proactive.resourcemanager.rmnode.*; | [
"java.util",
"org.ow2.proactive"
] | java.util; org.ow2.proactive; | 2,724,321 |
@RequestProcessing(value = "/admin/article/{articleId}", method = HTTPRequestMethod.POST)
@Before(adviceClass = AdminCheck.class)
public void updateArticle(final HTTPRequestContext context, final HttpServletRequest request, final HttpServletResponse response,
final String articleId) throws Exception {
final AbstractFreeMarkerRenderer renderer = new FreeMarkerRenderer();
context.setRenderer(renderer);
renderer.setTemplateName("admin/article.ftl");
final Map<String, Object> dataModel = renderer.getDataModel();
JSONObject article = articleQueryService.getArticle(articleId);
final Enumeration<String> parameterNames = request.getParameterNames();
while (parameterNames.hasMoreElements()) {
final String name = parameterNames.nextElement();
final String value = request.getParameter(name);
article.put(name, value);
}
articleMgmtService.updateArticle(articleId, article);
article = articleQueryService.getArticle(articleId);
dataModel.put(Article.ARTICLE, article);
filler.fillHeaderAndFooter(request, response, dataModel);
} | @RequestProcessing(value = STR, method = HTTPRequestMethod.POST) @Before(adviceClass = AdminCheck.class) void function(final HTTPRequestContext context, final HttpServletRequest request, final HttpServletResponse response, final String articleId) throws Exception { final AbstractFreeMarkerRenderer renderer = new FreeMarkerRenderer(); context.setRenderer(renderer); renderer.setTemplateName(STR); final Map<String, Object> dataModel = renderer.getDataModel(); JSONObject article = articleQueryService.getArticle(articleId); final Enumeration<String> parameterNames = request.getParameterNames(); while (parameterNames.hasMoreElements()) { final String name = parameterNames.nextElement(); final String value = request.getParameter(name); article.put(name, value); } articleMgmtService.updateArticle(articleId, article); article = articleQueryService.getArticle(articleId); dataModel.put(Article.ARTICLE, article); filler.fillHeaderAndFooter(request, response, dataModel); } | /**
* Updates an article.
*
* @param context the specified context
* @param request the specified request
* @param response the specified response
* @param articleId the specified article id
* @throws Exception exception
*/ | Updates an article | updateArticle | {
"repo_name": "leontius/symphony",
"path": "src/main/java/org/b3log/symphony/processor/AdminProcessor.java",
"license": "apache-2.0",
"size": 33474
} | [
"java.util.Enumeration",
"java.util.Map",
"javax.servlet.http.HttpServletRequest",
"javax.servlet.http.HttpServletResponse",
"org.b3log.latke.servlet.HTTPRequestContext",
"org.b3log.latke.servlet.HTTPRequestMethod",
"org.b3log.latke.servlet.annotation.Before",
"org.b3log.latke.servlet.annotation.RequestProcessing",
"org.b3log.latke.servlet.renderer.freemarker.AbstractFreeMarkerRenderer",
"org.b3log.latke.servlet.renderer.freemarker.FreeMarkerRenderer",
"org.b3log.symphony.model.Article",
"org.b3log.symphony.processor.advice.AdminCheck",
"org.json.JSONObject"
] | import java.util.Enumeration; import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.b3log.latke.servlet.HTTPRequestContext; import org.b3log.latke.servlet.HTTPRequestMethod; import org.b3log.latke.servlet.annotation.Before; import org.b3log.latke.servlet.annotation.RequestProcessing; import org.b3log.latke.servlet.renderer.freemarker.AbstractFreeMarkerRenderer; import org.b3log.latke.servlet.renderer.freemarker.FreeMarkerRenderer; import org.b3log.symphony.model.Article; import org.b3log.symphony.processor.advice.AdminCheck; import org.json.JSONObject; | import java.util.*; import javax.servlet.http.*; import org.b3log.latke.servlet.*; import org.b3log.latke.servlet.annotation.*; import org.b3log.latke.servlet.renderer.freemarker.*; import org.b3log.symphony.model.*; import org.b3log.symphony.processor.advice.*; import org.json.*; | [
"java.util",
"javax.servlet",
"org.b3log.latke",
"org.b3log.symphony",
"org.json"
] | java.util; javax.servlet; org.b3log.latke; org.b3log.symphony; org.json; | 1,472,910 |
public void testRefreshOnListRowsClosesOpenSwipeBody() throws MalformedURLException, URISyntaxException, InterruptedException{
verifyListRowAfterRefreshOrShowMoreAction("refresh");
}
| void function() throws MalformedURLException, URISyntaxException, InterruptedException{ verifyListRowAfterRefreshOrShowMoreAction(STR); } | /**
* Test to verify doing refresh on ListRows should close the open swipeBody if any
* @throws MalformedURLException
* @throws URISyntaxException
* @throws InterruptedException
*/ | Test to verify doing refresh on ListRows should close the open swipeBody if any | testRefreshOnListRowsClosesOpenSwipeBody | {
"repo_name": "lhong375/aura",
"path": "aura/src/test/java/org/auraframework/components/ui/infiniteListRow/infiniteListRowUITest.java",
"license": "apache-2.0",
"size": 13391
} | [
"java.net.MalformedURLException",
"java.net.URISyntaxException"
] | import java.net.MalformedURLException; import java.net.URISyntaxException; | import java.net.*; | [
"java.net"
] | java.net; | 610,981 |
public static Class<? extends OutputFormat> getNamedOutputFormatClass(
JobConf conf, String namedOutput) {
checkNamedOutput(conf, namedOutput, false);
return conf.getClass(MO_PREFIX + namedOutput + FORMAT, null,
OutputFormat.class);
} | static Class<? extends OutputFormat> function( JobConf conf, String namedOutput) { checkNamedOutput(conf, namedOutput, false); return conf.getClass(MO_PREFIX + namedOutput + FORMAT, null, OutputFormat.class); } | /**
* Returns the named output OutputFormat.
*
* @param conf job conf
* @param namedOutput named output
* @return namedOutput OutputFormat
*/ | Returns the named output OutputFormat | getNamedOutputFormatClass | {
"repo_name": "RallySoftware/avro",
"path": "lang/java/mapred/src/main/java/org/apache/avro/mapred/AvroMultipleOutputs.java",
"license": "apache-2.0",
"size": 22156
} | [
"org.apache.hadoop.mapred.JobConf",
"org.apache.hadoop.mapred.OutputFormat"
] | import org.apache.hadoop.mapred.JobConf; import org.apache.hadoop.mapred.OutputFormat; | import org.apache.hadoop.mapred.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 2,816,762 |
public List<Trackpoint> getTrackpoints() {
List<Long> ids = getForeignKeys("tag", "track_id");
List<Trackpoint> res = new LinkedList<Trackpoint>();
for (Long l : ids)
res.add(new Trackpoint(l));
return res;
}
| List<Trackpoint> function() { List<Long> ids = getForeignKeys("tag", STR); List<Trackpoint> res = new LinkedList<Trackpoint>(); for (Long l : ids) res.add(new Trackpoint(l)); return res; } | /**
* Gets the trackpoints of this segment
*
* @return all segment's trackpoints
*/ | Gets the trackpoints of this segment | getTrackpoints | {
"repo_name": "abrauchli/Footware",
"path": "src/org/footware/server/db/TrackSegment.java",
"license": "apache-2.0",
"size": 5902
} | [
"java.util.LinkedList",
"java.util.List"
] | import java.util.LinkedList; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,688,532 |
public void run() {
// fetch document text, retry up to RETRIES times
String docText = null;
int retries = RETRIES;
boolean cached = false;
do {
// fetch document and convert to plain text
try {
docText = HTMLConverter.url2text(snippet.getDocID());
if (docText == null)
MsgPrinter.printHttpError("Document " +
snippet.getDocID() + " not available.");
} catch (SocketTimeoutException e) {
docText = null;
MsgPrinter.printHttpError("Connection to " +
snippet.getDocID() + " timed out.");
}
retries--;
// retrieve cached document if original document unavailable
if (docText == null && retries < 0 &&
snippet.getCacheID() != null &&
!snippet.getCacheID().equals(snippet.getDocID())) {
MsgPrinter.printErrorMsg("\nCould not fetch original source, " +
"trying cached source instead...");
snippet.setDocID(snippet.getCacheID());
retries = RETRIES;
cached = true;
}
} while (docText == null && retries >= 0);
// pass document to WebDocumentFetcherFilter
if (docText != null) {
Result doc = new Result(docText, snippet.getQuery(),
snippet.getDocID(), snippet.getHitPos());
doc.setScore(0);
filter.addDoc(doc, cached);
} else {
MsgPrinter.printErrorMsg("\nCould not fetch document.");
filter.addDoc(null, cached);
// System.exit(1);
}
} | void function() { String docText = null; int retries = RETRIES; boolean cached = false; do { try { docText = HTMLConverter.url2text(snippet.getDocID()); if (docText == null) MsgPrinter.printHttpError(STR + snippet.getDocID() + STR); } catch (SocketTimeoutException e) { docText = null; MsgPrinter.printHttpError(STR + snippet.getDocID() + STR); } retries--; if (docText == null && retries < 0 && snippet.getCacheID() != null && !snippet.getCacheID().equals(snippet.getDocID())) { MsgPrinter.printErrorMsg(STR + STR); snippet.setDocID(snippet.getCacheID()); retries = RETRIES; cached = true; } } while (docText == null && retries >= 0); if (docText != null) { Result doc = new Result(docText, snippet.getQuery(), snippet.getDocID(), snippet.getHitPos()); doc.setScore(0); filter.addDoc(doc, cached); } else { MsgPrinter.printErrorMsg(STR); filter.addDoc(null, cached); } } | /**
* Fetches the document text and returns it to the
* <code>WebDocumentFetcherFilter</code>.
*/ | Fetches the document text and returns it to the <code>WebDocumentFetcherFilter</code> | run | {
"repo_name": "csarron/PriaQA",
"path": "src/info/ephyra/answerselection/filters/WebDocumentFetcherFilter.java",
"license": "gpl-3.0",
"size": 9528
} | [
"info.ephyra.io.MsgPrinter",
"info.ephyra.search.Result",
"info.ephyra.util.HTMLConverter",
"java.net.SocketTimeoutException"
] | import info.ephyra.io.MsgPrinter; import info.ephyra.search.Result; import info.ephyra.util.HTMLConverter; import java.net.SocketTimeoutException; | import info.ephyra.io.*; import info.ephyra.search.*; import info.ephyra.util.*; import java.net.*; | [
"info.ephyra.io",
"info.ephyra.search",
"info.ephyra.util",
"java.net"
] | info.ephyra.io; info.ephyra.search; info.ephyra.util; java.net; | 471,130 |
List<OntologyElement> returnClassElements(Set<String> classes) throws Exception {
List<OntologyElement> elements = new ArrayList<OntologyElement>();
for (String euri : classes) {
SerializableURI elementUri = null;
try {
elementUri = new SerializableURI(euri, false);
} catch (Exception e) {
e.printStackTrace();
}
OntologyElement e = new ClassElement();
e.setData(elementUri);
elements.add(e);
}
return elements;
}
| List<OntologyElement> returnClassElements(Set<String> classes) throws Exception { List<OntologyElement> elements = new ArrayList<OntologyElement>(); for (String euri : classes) { SerializableURI elementUri = null; try { elementUri = new SerializableURI(euri, false); } catch (Exception e) { e.printStackTrace(); } OntologyElement e = new ClassElement(); e.setData(elementUri); elements.add(e); } return elements; } | /**
* generate class elements from the set of class uris
*
* @param classes
* @return
*/ | generate class elements from the set of class uris | returnClassElements | {
"repo_name": "danicadamljanovic/freya",
"path": "freya/freya-annotate/src/main/java/org/freya/dialogue/SuggestionsCreatorScale.java",
"license": "agpl-3.0",
"size": 41097
} | [
"java.util.ArrayList",
"java.util.List",
"java.util.Set",
"org.freya.model.ClassElement",
"org.freya.model.OntologyElement",
"org.freya.model.SerializableURI"
] | import java.util.ArrayList; import java.util.List; import java.util.Set; import org.freya.model.ClassElement; import org.freya.model.OntologyElement; import org.freya.model.SerializableURI; | import java.util.*; import org.freya.model.*; | [
"java.util",
"org.freya.model"
] | java.util; org.freya.model; | 1,647,692 |
List<Flight> getEmployeeLastFiveFlights(Long id) throws ServiceException, ServiceValidateException; | List<Flight> getEmployeeLastFiveFlights(Long id) throws ServiceException, ServiceValidateException; | /**
* Returns a list of five last flights of the concrete employee from the DB
*
* @param id - The ID of the employee
* @return - the list of last five flight of the concrete employee
* @throws DaoException If something fails at DB level
*/ | Returns a list of five last flights of the concrete employee from the DB | getEmployeeLastFiveFlights | {
"repo_name": "alexeykish/aircompany-spring",
"path": "services/src/main/java/by/pvt/kish/aircompany/services/IEmployeeService.java",
"license": "gpl-3.0",
"size": 2398
} | [
"by.pvt.kish.aircompany.exceptions.ServiceException",
"by.pvt.kish.aircompany.exceptions.ServiceValidateException",
"by.pvt.kish.aircompany.pojos.Flight",
"java.util.List"
] | import by.pvt.kish.aircompany.exceptions.ServiceException; import by.pvt.kish.aircompany.exceptions.ServiceValidateException; import by.pvt.kish.aircompany.pojos.Flight; import java.util.List; | import by.pvt.kish.aircompany.exceptions.*; import by.pvt.kish.aircompany.pojos.*; import java.util.*; | [
"by.pvt.kish",
"java.util"
] | by.pvt.kish; java.util; | 2,584,318 |
@POST
@Consumes(MediaType.APPLICATION_JSON)
public Response createTunnel(InputStream input) throws IOException {
ObjectMapper mapper = new ObjectMapper();
ObjectNode tunnelJson = readTreeFromStream(mapper, input);
SegmentRoutingService srService = get(SegmentRoutingService.class);
Tunnel tunnelInfo = TUNNEL_CODEC.decode(tunnelJson, this);
srService.createTunnel(tunnelInfo);
return Response.ok().build();
} | @Consumes(MediaType.APPLICATION_JSON) Response function(InputStream input) throws IOException { ObjectMapper mapper = new ObjectMapper(); ObjectNode tunnelJson = readTreeFromStream(mapper, input); SegmentRoutingService srService = get(SegmentRoutingService.class); Tunnel tunnelInfo = TUNNEL_CODEC.decode(tunnelJson, this); srService.createTunnel(tunnelInfo); return Response.ok().build(); } | /**
* Create a new segment routing tunnel.
*
* @param input JSON stream for tunnel to create
* @return status of the request - OK if the tunnel is created,
* @throws IOException if the JSON is invalid
*/ | Create a new segment routing tunnel | createTunnel | {
"repo_name": "kuujo/onos",
"path": "apps/segmentrouting/web/src/main/java/org/onosproject/segmentrouting/web/TunnelWebResource.java",
"license": "apache-2.0",
"size": 3449
} | [
"com.fasterxml.jackson.databind.ObjectMapper",
"com.fasterxml.jackson.databind.node.ObjectNode",
"java.io.IOException",
"java.io.InputStream",
"javax.ws.rs.Consumes",
"javax.ws.rs.core.MediaType",
"javax.ws.rs.core.Response",
"org.onlab.util.Tools",
"org.onosproject.segmentrouting.SegmentRoutingService",
"org.onosproject.segmentrouting.Tunnel"
] | import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ObjectNode; import java.io.IOException; import java.io.InputStream; import javax.ws.rs.Consumes; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import org.onlab.util.Tools; import org.onosproject.segmentrouting.SegmentRoutingService; import org.onosproject.segmentrouting.Tunnel; | import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.node.*; import java.io.*; import javax.ws.rs.*; import javax.ws.rs.core.*; import org.onlab.util.*; import org.onosproject.segmentrouting.*; | [
"com.fasterxml.jackson",
"java.io",
"javax.ws",
"org.onlab.util",
"org.onosproject.segmentrouting"
] | com.fasterxml.jackson; java.io; javax.ws; org.onlab.util; org.onosproject.segmentrouting; | 495,067 |
private static boolean moveDeprecatedHashAlgorithmIntoLegacySection(PropertyReader reader,
ConfigurationData configData) {
HashAlgorithm currentHash = SecuritySettings.PASSWORD_HASH.determineValue(reader);
// Skip CUSTOM (has no class) and PLAINTEXT (is force-migrated later on in the startup process)
if (currentHash != HashAlgorithm.CUSTOM && currentHash != HashAlgorithm.PLAINTEXT) {
Class<?> encryptionClass = currentHash.getClazz();
if (encryptionClass.isAnnotationPresent(Deprecated.class)) {
configData.setValue(SecuritySettings.PASSWORD_HASH, HashAlgorithm.SHA256);
Set<HashAlgorithm> legacyHashes = SecuritySettings.LEGACY_HASHES.determineValue(reader);
legacyHashes.add(currentHash);
configData.setValue(SecuritySettings.LEGACY_HASHES, legacyHashes);
ConsoleLogger.warning("The hash algorithm '" + currentHash
+ "' is no longer supported for active use. New hashes will be in SHA256.");
return true;
}
}
return false;
} | static boolean function(PropertyReader reader, ConfigurationData configData) { HashAlgorithm currentHash = SecuritySettings.PASSWORD_HASH.determineValue(reader); if (currentHash != HashAlgorithm.CUSTOM && currentHash != HashAlgorithm.PLAINTEXT) { Class<?> encryptionClass = currentHash.getClazz(); if (encryptionClass.isAnnotationPresent(Deprecated.class)) { configData.setValue(SecuritySettings.PASSWORD_HASH, HashAlgorithm.SHA256); Set<HashAlgorithm> legacyHashes = SecuritySettings.LEGACY_HASHES.determineValue(reader); legacyHashes.add(currentHash); configData.setValue(SecuritySettings.LEGACY_HASHES, legacyHashes); ConsoleLogger.warning(STR + currentHash + STR); return true; } } return false; } | /**
* If a deprecated hash is used, it is added to the legacy hashes option and the active hash
* is changed to SHA256.
*
* @param reader The property reader
* @param configData Configuration data
* @return True if the configuration has changed, false otherwise
*/ | If a deprecated hash is used, it is added to the legacy hashes option and the active hash is changed to SHA256 | moveDeprecatedHashAlgorithmIntoLegacySection | {
"repo_name": "Xephi/AuthMeReloaded",
"path": "src/main/java/fr/xephi/authme/settings/SettingsMigrationService.java",
"license": "gpl-3.0",
"size": 18645
} | [
"ch.jalu.configme.configurationdata.ConfigurationData",
"ch.jalu.configme.resource.PropertyReader",
"fr.xephi.authme.ConsoleLogger",
"fr.xephi.authme.security.HashAlgorithm",
"fr.xephi.authme.settings.properties.SecuritySettings",
"java.util.Set"
] | import ch.jalu.configme.configurationdata.ConfigurationData; import ch.jalu.configme.resource.PropertyReader; import fr.xephi.authme.ConsoleLogger; import fr.xephi.authme.security.HashAlgorithm; import fr.xephi.authme.settings.properties.SecuritySettings; import java.util.Set; | import ch.jalu.configme.configurationdata.*; import ch.jalu.configme.resource.*; import fr.xephi.authme.*; import fr.xephi.authme.security.*; import fr.xephi.authme.settings.properties.*; import java.util.*; | [
"ch.jalu.configme",
"fr.xephi.authme",
"java.util"
] | ch.jalu.configme; fr.xephi.authme; java.util; | 1,570,521 |
public static void prepareResourcesToInject(Props props, String workingDir) {
try {
Configuration conf = new Configuration(false);
// First, inject a series of Azkaban links. These are equivalent to
// CommonJobProperties.[EXECUTION,WORKFLOW,JOB,JOBEXEC,ATTEMPT]_LINK
addHadoopProperties(props);
// Next, automatically inject any properties that begin with the
// designated injection prefix.
Map<String, String> confProperties = props.getMapByPrefix(INJECT_PREFIX);
for (Map.Entry<String, String> entry : confProperties.entrySet()) {
String confKey = entry.getKey().replace(INJECT_PREFIX, "");
String confVal = entry.getValue();
conf.set(confKey, confVal);
}
// Now write out the configuration file to inject.
File file = getConfFile(props, workingDir, INJECT_FILE);
OutputStream xmlOut = new FileOutputStream(file);
conf.writeXml(xmlOut);
xmlOut.close();
} catch (Throwable e) {
_logger.error("Encountered error while preparing the Hadoop configuration resource file", e);
}
} | static void function(Props props, String workingDir) { try { Configuration conf = new Configuration(false); addHadoopProperties(props); Map<String, String> confProperties = props.getMapByPrefix(INJECT_PREFIX); for (Map.Entry<String, String> entry : confProperties.entrySet()) { String confKey = entry.getKey().replace(INJECT_PREFIX, STREncountered error while preparing the Hadoop configuration resource file", e); } } | /**
* Writes out the XML configuration file that will be injected by the client
* as a configuration resource.
* <p>
* This file will include a series of links injected by Azkaban as well as
* any job properties that begin with the designated injection prefix.
*
* @param props The Azkaban properties
* @param workingDir The Azkaban job working directory
*/ | Writes out the XML configuration file that will be injected by the client as a configuration resource. This file will include a series of links injected by Azkaban as well as any job properties that begin with the designated injection prefix | prepareResourcesToInject | {
"repo_name": "johnyu0520/azkaban-plugins",
"path": "plugins/jobtype/src/azkaban/jobtype/HadoopConfigurationInjector.java",
"license": "apache-2.0",
"size": 7445
} | [
"java.util.Map",
"org.apache.hadoop.conf.Configuration"
] | import java.util.Map; import org.apache.hadoop.conf.Configuration; | import java.util.*; import org.apache.hadoop.conf.*; | [
"java.util",
"org.apache.hadoop"
] | java.util; org.apache.hadoop; | 2,403,729 |
public void removeNode(String nodeId) throws MonitorException {
try {
Vector<Object> argList = new Vector<Object>();
argList.add(nodeId);
client.execute("resourcemgr.removeNode", argList);
}catch (Exception e) {
throw new MonitorException(e.getMessage(), e);
}
} | void function(String nodeId) throws MonitorException { try { Vector<Object> argList = new Vector<Object>(); argList.add(nodeId); client.execute(STR, argList); }catch (Exception e) { throw new MonitorException(e.getMessage(), e); } } | /**
* Removes the node with the given id
* @param nodeId The id of the node to be removed
* @throws MonitorException on any error
*/ | Removes the node with the given id | removeNode | {
"repo_name": "OSBI/oodt",
"path": "resource/src/main/java/org/apache/oodt/cas/resource/system/XmlRpcResourceManagerClient.java",
"license": "apache-2.0",
"size": 18412
} | [
"java.util.Vector",
"org.apache.oodt.cas.resource.structs.exceptions.MonitorException"
] | import java.util.Vector; import org.apache.oodt.cas.resource.structs.exceptions.MonitorException; | import java.util.*; import org.apache.oodt.cas.resource.structs.exceptions.*; | [
"java.util",
"org.apache.oodt"
] | java.util; org.apache.oodt; | 1,718,317 |
public void test05Hebrew() {
StringBuilder mSearchNameOffsets = new StringBuilder();
String mSearchName = HanziToPinyin.getInstance().getTokensForDialerSearch(mHebrew,
mSearchNameOffsets);
StringBuilder mShortSubStr = new StringBuilder();
StringBuilder mShortSubStrSet = new StringBuilder();
StringBuilder subStrSet = new StringBuilder();
int size = mHebrewMapping.length();
mShortSubStr.insert(0, mHebrewMapping);
mShortSubStr.insert(0, (char) size);
mShortSubStrSet.insert(0, mShortSubStr);
subStrSet.append(mShortSubStrSet);
assertEquals(mSearchName.toString(), subStrSet.toString());
} | void function() { StringBuilder mSearchNameOffsets = new StringBuilder(); String mSearchName = HanziToPinyin.getInstance().getTokensForDialerSearch(mHebrew, mSearchNameOffsets); StringBuilder mShortSubStr = new StringBuilder(); StringBuilder mShortSubStrSet = new StringBuilder(); StringBuilder subStrSet = new StringBuilder(); int size = mHebrewMapping.length(); mShortSubStr.insert(0, mHebrewMapping); mShortSubStr.insert(0, (char) size); mShortSubStrSet.insert(0, mShortSubStr); subStrSet.append(mShortSubStrSet); assertEquals(mSearchName.toString(), subStrSet.toString()); } | /**
* Test mHebrew result
*/ | Test mHebrew result | test05Hebrew | {
"repo_name": "rex-xxx/mt6572_x201",
"path": "packages/providers/ContactsProvider/tests/src/com/mediatek/providers/contacts/dialersearchtestcase/GetTokensForDialerSearchTest.java",
"license": "gpl-2.0",
"size": 11472
} | [
"com.android.providers.contacts.HanziToPinyin"
] | import com.android.providers.contacts.HanziToPinyin; | import com.android.providers.contacts.*; | [
"com.android.providers"
] | com.android.providers; | 1,677,265 |
public static void shutdown() {
log.debug("Shutting down the scheduler");
try {
// Needs to be shutdown before Hibernate
SchedulerUtil.shutdown();
}
catch (Exception e) {
log.warn("Error while shutting down scheduler service", e);
}
log.debug("Shutting down the modules");
try {
ModuleUtil.shutdown();
}
catch (Exception e) {
log.warn("Error while shutting down module system", e);
}
log.debug("Shutting down the context");
try {
ContextDAO dao = null;
try {
dao = getContextDAO();
}
catch (APIException e) {
// pass
}
if (dao != null) {
dao.shutdown();
}
}
catch (Exception e) {
log.warn("Error while shutting down context dao", e);
}
} | static void function() { log.debug(STR); try { SchedulerUtil.shutdown(); } catch (Exception e) { log.warn(STR, e); } log.debug(STR); try { ModuleUtil.shutdown(); } catch (Exception e) { log.warn(STR, e); } log.debug(STR); try { ContextDAO dao = null; try { dao = getContextDAO(); } catch (APIException e) { } if (dao != null) { dao.shutdown(); } } catch (Exception e) { log.warn(STR, e); } } | /**
* Stops the OpenMRS System Should be called after all activity has ended and application is
* closing
*/ | Stops the OpenMRS System Should be called after all activity has ended and application is closing | shutdown | {
"repo_name": "preethi29/openmrs-core",
"path": "api/src/main/java/org/openmrs/api/context/Context.java",
"license": "mpl-2.0",
"size": 41482
} | [
"org.openmrs.api.APIException",
"org.openmrs.api.db.ContextDAO",
"org.openmrs.module.ModuleUtil",
"org.openmrs.scheduler.SchedulerUtil"
] | import org.openmrs.api.APIException; import org.openmrs.api.db.ContextDAO; import org.openmrs.module.ModuleUtil; import org.openmrs.scheduler.SchedulerUtil; | import org.openmrs.api.*; import org.openmrs.api.db.*; import org.openmrs.module.*; import org.openmrs.scheduler.*; | [
"org.openmrs.api",
"org.openmrs.module",
"org.openmrs.scheduler"
] | org.openmrs.api; org.openmrs.module; org.openmrs.scheduler; | 2,173,882 |
public Color getColor() {
return m_Color;
} | Color function() { return m_Color; } | /**
* Get the stroke color for the paintlet.
*
* @return color of the stroke
*/ | Get the stroke color for the paintlet | getColor | {
"repo_name": "waikato-datamining/adams-base",
"path": "adams-core/src/main/java/adams/gui/visualization/sequence/MathExpressionOverlayPaintlet.java",
"license": "gpl-3.0",
"size": 8990
} | [
"java.awt.Color"
] | import java.awt.Color; | import java.awt.*; | [
"java.awt"
] | java.awt; | 1,025,050 |
public RunStatus status() {
return this.status;
} | RunStatus function() { return this.status; } | /**
* Get the status property: The current status of the run.
*
* @return the status value.
*/ | Get the status property: The current status of the run | status | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/resourcemanagerhybrid/azure-resourcemanager-containerregistry/src/main/java/com/azure/resourcemanager/containerregistry/fluent/models/RunInner.java",
"license": "mit",
"size": 16245
} | [
"com.azure.resourcemanager.containerregistry.models.RunStatus"
] | import com.azure.resourcemanager.containerregistry.models.RunStatus; | import com.azure.resourcemanager.containerregistry.models.*; | [
"com.azure.resourcemanager"
] | com.azure.resourcemanager; | 1,728,905 |
void sendDetailMovieToPresenter (MovieDetail response); | void sendDetailMovieToPresenter (MovieDetail response); | /**
* Sends the MovieDetailResponse thought the communication system
* to be received by the presenter
*
* @param response the response containing the details of the film
*/ | Sends the MovieDetailResponse thought the communication system to be received by the presenter | sendDetailMovieToPresenter | {
"repo_name": "hanhailong/Material-Movies",
"path": "HackVG/domain/src/main/java/com/hackvg/domain/GetMovieDetailUsecase.java",
"license": "apache-2.0",
"size": 2276
} | [
"com.hackvg.model.entities.MovieDetail"
] | import com.hackvg.model.entities.MovieDetail; | import com.hackvg.model.entities.*; | [
"com.hackvg.model"
] | com.hackvg.model; | 1,166,934 |
public static MapLayers mapLayerRecordsToLayers(List<Maps> mapLayerRecords)
{
MapLayers mapLayers = new MapLayers();
List<MapLayer> mapLayerList = new ArrayList<MapLayer>();
for (Maps mapLayerRecord : mapLayerRecords)
{
MapLayer mapLayer = new MapLayer();
mapLayer.setId(mapLayerRecord.getId());
mapLayer.setName(mapLayerRecord.getDisplayName());
mapLayerList.add(mapLayer);
}
mapLayers.setLayers(mapLayerList.toArray(new MapLayer[]{}));
return mapLayers;
} | static MapLayers function(List<Maps> mapLayerRecords) { MapLayers mapLayers = new MapLayers(); List<MapLayer> mapLayerList = new ArrayList<MapLayer>(); for (Maps mapLayerRecord : mapLayerRecords) { MapLayer mapLayer = new MapLayer(); mapLayer.setId(mapLayerRecord.getId()); mapLayer.setName(mapLayerRecord.getDisplayName()); mapLayerList.add(mapLayer); } mapLayers.setLayers(mapLayerList.toArray(new MapLayer[]{})); return mapLayers; } | /**
* Converts a set of map layer database records into an object returnable by a web service
*
* @param mapLayerRecords set of map layer records
* @return map layers web service object
*/ | Converts a set of map layer database records into an object returnable by a web service | mapLayerRecordsToLayers | {
"repo_name": "nstarke/hootenanny",
"path": "hoot-services/src/main/java/hoot/services/models/osm/Map.java",
"license": "gpl-3.0",
"size": 38226
} | [
"java.util.ArrayList",
"java.util.List"
] | import java.util.ArrayList; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,258,213 |
public void requireJob() {
if ($(JOB_ID).isEmpty()) {
badRequest("missing job ID");
throw new RuntimeException("Bad Request: Missing job ID");
}
JobId jobID = MRApps.toJobID($(JOB_ID));
app.setJob(app.context.getJob(jobID));
if (app.getJob() == null) {
notFound($(JOB_ID));
throw new RuntimeException("Not Found: " + $(JOB_ID));
}
Job job = app.context.getJob(jobID);
if (!checkAccess(job)) {
accessDenied("User " + request().getRemoteUser() + " does not have " +
" permission to view job " + $(JOB_ID));
throw new RuntimeException("Access denied: User " +
request().getRemoteUser() + " does not have permission to view job " +
$(JOB_ID));
}
} | void function() { if ($(JOB_ID).isEmpty()) { badRequest(STR); throw new RuntimeException(STR); } JobId jobID = MRApps.toJobID($(JOB_ID)); app.setJob(app.context.getJob(jobID)); if (app.getJob() == null) { notFound($(JOB_ID)); throw new RuntimeException(STR + $(JOB_ID)); } Job job = app.context.getJob(jobID); if (!checkAccess(job)) { accessDenied(STR + request().getRemoteUser() + STR + STR + $(JOB_ID)); throw new RuntimeException(STR + request().getRemoteUser() + STR + $(JOB_ID)); } } | /**
* Ensure that a JOB_ID was passed into the page.
*/ | Ensure that a JOB_ID was passed into the page | requireJob | {
"repo_name": "VicoWu/hadoop-2.7.3",
"path": "hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/webapp/AppController.java",
"license": "apache-2.0",
"size": 11778
} | [
"org.apache.hadoop.mapreduce.v2.api.records.JobId",
"org.apache.hadoop.mapreduce.v2.app.job.Job",
"org.apache.hadoop.mapreduce.v2.util.MRApps"
] | import org.apache.hadoop.mapreduce.v2.api.records.JobId; import org.apache.hadoop.mapreduce.v2.app.job.Job; import org.apache.hadoop.mapreduce.v2.util.MRApps; | import org.apache.hadoop.mapreduce.v2.api.records.*; import org.apache.hadoop.mapreduce.v2.app.job.*; import org.apache.hadoop.mapreduce.v2.util.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 1,655,965 |
void takeSuccessfully() {
assertEquals(EXPECTED_TAKE, takeUninterruptibly(queue));
completed.assertCompletionExpected();
assertTrue(queue.isEmpty());
} | void takeSuccessfully() { assertEquals(EXPECTED_TAKE, takeUninterruptibly(queue)); completed.assertCompletionExpected(); assertTrue(queue.isEmpty()); } | /**
* Perform a {@code take} and assert that operation completed in the
* expected timeframe.
*/ | Perform a take and assert that operation completed in the expected timeframe | takeSuccessfully | {
"repo_name": "jakubmalek/guava",
"path": "guava-tests/test/com/google/common/util/concurrent/UninterruptiblesTest.java",
"license": "apache-2.0",
"size": 23138
} | [
"com.google.common.util.concurrent.Uninterruptibles"
] | import com.google.common.util.concurrent.Uninterruptibles; | import com.google.common.util.concurrent.*; | [
"com.google.common"
] | com.google.common; | 1,372,733 |
public boolean attackEntityFrom(DamageSource source, float amount)
{
return true;
} | boolean function(DamageSource source, float amount) { return true; } | /**
* Called when the entity is attacked.
*/ | Called when the entity is attacked | attackEntityFrom | {
"repo_name": "MartyParty21/AwakenDreamsClient",
"path": "mcp/src/minecraft/net/minecraft/client/entity/EntityOtherPlayerMP.java",
"license": "gpl-3.0",
"size": 5423
} | [
"net.minecraft.util.DamageSource"
] | import net.minecraft.util.DamageSource; | import net.minecraft.util.*; | [
"net.minecraft.util"
] | net.minecraft.util; | 1,644,117 |
public void cast(final Type from, final Type to) {
if (from != to) {
if (from == Type.DOUBLE_TYPE) {
if (to == Type.FLOAT_TYPE) {
mv.visitInsn(Opcodes.D2F);
} else if (to == Type.LONG_TYPE) {
mv.visitInsn(Opcodes.D2L);
} else {
mv.visitInsn(Opcodes.D2I);
cast(Type.INT_TYPE, to);
}
} else if (from == Type.FLOAT_TYPE) {
if (to == Type.DOUBLE_TYPE) {
mv.visitInsn(Opcodes.F2D);
} else if (to == Type.LONG_TYPE) {
mv.visitInsn(Opcodes.F2L);
} else {
mv.visitInsn(Opcodes.F2I);
cast(Type.INT_TYPE, to);
}
} else if (from == Type.LONG_TYPE) {
if (to == Type.DOUBLE_TYPE) {
mv.visitInsn(Opcodes.L2D);
} else if (to == Type.FLOAT_TYPE) {
mv.visitInsn(Opcodes.L2F);
} else {
mv.visitInsn(Opcodes.L2I);
cast(Type.INT_TYPE, to);
}
} else {
if (to == Type.BYTE_TYPE) {
mv.visitInsn(Opcodes.I2B);
} else if (to == Type.CHAR_TYPE) {
mv.visitInsn(Opcodes.I2C);
} else if (to == Type.DOUBLE_TYPE) {
mv.visitInsn(Opcodes.I2D);
} else if (to == Type.FLOAT_TYPE) {
mv.visitInsn(Opcodes.I2F);
} else if (to == Type.LONG_TYPE) {
mv.visitInsn(Opcodes.I2L);
} else if (to == Type.SHORT_TYPE) {
mv.visitInsn(Opcodes.I2S);
}
}
}
}
// ------------------------------------------------------------------------
// Instructions to do boxing and unboxing operations
// ------------------------------------------------------------------------ | void function(final Type from, final Type to) { if (from != to) { if (from == Type.DOUBLE_TYPE) { if (to == Type.FLOAT_TYPE) { mv.visitInsn(Opcodes.D2F); } else if (to == Type.LONG_TYPE) { mv.visitInsn(Opcodes.D2L); } else { mv.visitInsn(Opcodes.D2I); cast(Type.INT_TYPE, to); } } else if (from == Type.FLOAT_TYPE) { if (to == Type.DOUBLE_TYPE) { mv.visitInsn(Opcodes.F2D); } else if (to == Type.LONG_TYPE) { mv.visitInsn(Opcodes.F2L); } else { mv.visitInsn(Opcodes.F2I); cast(Type.INT_TYPE, to); } } else if (from == Type.LONG_TYPE) { if (to == Type.DOUBLE_TYPE) { mv.visitInsn(Opcodes.L2D); } else if (to == Type.FLOAT_TYPE) { mv.visitInsn(Opcodes.L2F); } else { mv.visitInsn(Opcodes.L2I); cast(Type.INT_TYPE, to); } } else { if (to == Type.BYTE_TYPE) { mv.visitInsn(Opcodes.I2B); } else if (to == Type.CHAR_TYPE) { mv.visitInsn(Opcodes.I2C); } else if (to == Type.DOUBLE_TYPE) { mv.visitInsn(Opcodes.I2D); } else if (to == Type.FLOAT_TYPE) { mv.visitInsn(Opcodes.I2F); } else if (to == Type.LONG_TYPE) { mv.visitInsn(Opcodes.I2L); } else if (to == Type.SHORT_TYPE) { mv.visitInsn(Opcodes.I2S); } } } } | /**
* Generates the instructions to cast a numerical value from one type to
* another.
*
* @param from
* the type of the top stack value
* @param to
* the type into which this value must be cast.
*/ | Generates the instructions to cast a numerical value from one type to another | cast | {
"repo_name": "lrytz/asm",
"path": "src/org/objectweb/asm/commons/GeneratorAdapter.java",
"license": "bsd-3-clause",
"size": 50886
} | [
"org.objectweb.asm.Opcodes",
"org.objectweb.asm.Type"
] | import org.objectweb.asm.Opcodes; import org.objectweb.asm.Type; | import org.objectweb.asm.*; | [
"org.objectweb.asm"
] | org.objectweb.asm; | 929,449 |
public Set<SettingDefinitionProvider> getProviders(SettingDefinition<?, ?> setting) {
Set<SettingDefinitionProvider> set = this.providersByDefinition.get(setting);
if (set == null) {
return Collections.emptySet();
} else {
return Collections.unmodifiableSet(set);
}
} | Set<SettingDefinitionProvider> function(SettingDefinition<?, ?> setting) { Set<SettingDefinitionProvider> set = this.providersByDefinition.get(setting); if (set == null) { return Collections.emptySet(); } else { return Collections.unmodifiableSet(set); } } | /**
* Returns all providers that declared a specific setting.
* <p/>
*
* @param setting
* the setting
* <p/>
* @return the providers
*/ | Returns all providers that declared a specific setting. | getProviders | {
"repo_name": "nuest/SOS",
"path": "core/api/src/main/java/org/n52/sos/config/SettingDefinitionProviderRepository.java",
"license": "gpl-2.0",
"size": 5489
} | [
"java.util.Collections",
"java.util.Set"
] | import java.util.Collections; import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 2,602,008 |
EReference getDataObjectMetadata_MetaData(); | EReference getDataObjectMetadata_MetaData(); | /**
* Returns the meta object for the containment reference list '{@link org.eclipse.bpel4chor.model.globalDataModel.DataObjectMetadata#getMetaData <em>Meta Data</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the containment reference list '<em>Meta Data</em>'.
* @see org.eclipse.bpel4chor.model.globalDataModel.DataObjectMetadata#getMetaData()
* @see #getDataObjectMetadata()
* @generated
*/ | Returns the meta object for the containment reference list '<code>org.eclipse.bpel4chor.model.globalDataModel.DataObjectMetadata#getMetaData Meta Data</code>'. | getDataObjectMetadata_MetaData | {
"repo_name": "chorsystem/middleware",
"path": "chorDataModel/src/main/java/org/eclipse/bpel4chor/model/globalDataModel/GlobalDataModelPackage.java",
"license": "mit",
"size": 43056
} | [
"org.eclipse.emf.ecore.EReference"
] | import org.eclipse.emf.ecore.EReference; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 352,762 |
@Ignore("This does not run consistently on different environments")
@Test
public void ensureBadDataWasIgnored() {
assumeTrue(badHostsDoNotResolve);
assertFalse("firewall treated our malformed data as a host. If " +
"`host \"bad data should be skipped\"` works locally, this test should have been " +
"skipped.",
ipsFirewall.isPermissible("bad data should be skipped"));
assertFalse("firewall treated our malformed data as a host. If " +
"`host \"more bad data\"` works locally, this test should have been " +
"skipped.",
ipsFirewall.isPermissible("more bad data"));
} | @Ignore(STR) void function() { assumeTrue(badHostsDoNotResolve); assertFalse(STR + STRbad data should be skipped\STR + STR, ipsFirewall.isPermissible(STR)); assertFalse(STR + STRmore bad data\STR + STR, ipsFirewall.isPermissible(STR)); } | /**
* We have two garbage lines in our test config file, ensure they didn't get turned into hosts.
*/ | We have two garbage lines in our test config file, ensure they didn't get turned into hosts | ensureBadDataWasIgnored | {
"repo_name": "mcgilman/nifi",
"path": "nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/test/java/org/apache/nifi/cluster/firewall/impl/FileBasedClusterNodeFirewallTest.java",
"license": "apache-2.0",
"size": 5214
} | [
"org.junit.Assert",
"org.junit.Assume",
"org.junit.Ignore"
] | import org.junit.Assert; import org.junit.Assume; import org.junit.Ignore; | import org.junit.*; | [
"org.junit"
] | org.junit; | 1,737,922 |
request.setAttribute(PATH_ATTRIBUTE, path);
}
private DefinitionsFactory definitionsFactory;
| request.setAttribute(PATH_ATTRIBUTE, path); } private DefinitionsFactory definitionsFactory; | /**
* Set the path of the layout page to render.
* @param request current HTTP request
* @param path the path of the layout page
* @see #PATH_ATTRIBUTE
*/ | Set the path of the layout page to render | setPath | {
"repo_name": "codeApeFromChina/resource",
"path": "frame_packages/java_libs/spring-2.5.6-src/src/org/springframework/web/servlet/view/tiles/TilesView.java",
"license": "unlicense",
"size": 7509
} | [
"org.apache.struts.tiles.DefinitionsFactory"
] | import org.apache.struts.tiles.DefinitionsFactory; | import org.apache.struts.tiles.*; | [
"org.apache.struts"
] | org.apache.struts; | 1,404,749 |
public ArrayList<String> vps_GET() throws IOException {
String qPath = "/order/vps";
StringBuilder sb = path(qPath);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t1);
}
/**
* Get prices and contracts information
*
* REST: GET /order/hosting/web/new/{duration} | ArrayList<String> function() throws IOException { String qPath = STR; StringBuilder sb = path(qPath); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t1); } /** * Get prices and contracts information * * REST: GET /order/hosting/web/new/{duration} | /**
* List available services
*
* REST: GET /order/vps
*/ | List available services | vps_GET | {
"repo_name": "UrielCh/ovh-java-sdk",
"path": "ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java",
"license": "bsd-3-clause",
"size": 511080
} | [
"java.io.IOException",
"java.util.ArrayList"
] | import java.io.IOException; import java.util.ArrayList; | import java.io.*; import java.util.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 1,423,113 |
@Override
public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object)
{
super.getPropertyDescriptors(object);
addThrottlePropertyDescriptor(object);
// addProxyForPropertyDescriptor(object);
// addReceptorsPropertyDescriptor(object);
return itemPropertyDescriptors;
}
| List<IItemPropertyDescriptor> function(Object object) { super.getPropertyDescriptors(object); addThrottlePropertyDescriptor(object); return itemPropertyDescriptors; } | /**
* This returns the property descriptors for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/ | This returns the property descriptors for the adapted class. | getPropertyDescriptors | {
"repo_name": "roboidstudio/embedded",
"path": "org.roboid.robot.model.edit/src/org/roboid/robot/provider/SensorItemProvider.java",
"license": "lgpl-2.1",
"size": 7984
} | [
"java.util.List",
"org.eclipse.emf.edit.provider.IItemPropertyDescriptor"
] | import java.util.List; import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; | import java.util.*; import org.eclipse.emf.edit.provider.*; | [
"java.util",
"org.eclipse.emf"
] | java.util; org.eclipse.emf; | 755,550 |
ApplicationManagementResponse stopApplication(Group group, Service service, Host host, Application application) throws IOException; | ApplicationManagementResponse stopApplication(Group group, Service service, Host host, Application application) throws IOException; | /**
* Stops the specified application
*
* @param group The Compatible Group/Cluster of tc Runtime servers on which the application is deployed
* @param service The tc Runtime service (defined in server.xml) on which the application is deployed
* @param host The tc Runtime host (defined in server.xml) on which the application is deployed
* @param application The application to stop
* @return An {@link ApplicationManagementResponse} object indicating Success/Failure of the stop operation
* @throws IOException
*/ | Stops the specified application | stopApplication | {
"repo_name": "pivotal/tcs-hq-management-plugin",
"path": "com.springsource.hq.plugin.tcserver.cli/com.springsource.hq.plugin.tcserver.cli.client/src/main/java/com/springsource/hq/plugin/tcserver/cli/client/application/ApplicationManager.java",
"license": "gpl-2.0",
"size": 13907
} | [
"com.springsource.hq.plugin.tcserver.cli.client.schema.Application",
"com.springsource.hq.plugin.tcserver.cli.client.schema.ApplicationManagementResponse",
"com.springsource.hq.plugin.tcserver.cli.client.schema.Group",
"com.springsource.hq.plugin.tcserver.cli.client.schema.Host",
"com.springsource.hq.plugin.tcserver.cli.client.schema.Service",
"java.io.IOException"
] | import com.springsource.hq.plugin.tcserver.cli.client.schema.Application; import com.springsource.hq.plugin.tcserver.cli.client.schema.ApplicationManagementResponse; import com.springsource.hq.plugin.tcserver.cli.client.schema.Group; import com.springsource.hq.plugin.tcserver.cli.client.schema.Host; import com.springsource.hq.plugin.tcserver.cli.client.schema.Service; import java.io.IOException; | import com.springsource.hq.plugin.tcserver.cli.client.schema.*; import java.io.*; | [
"com.springsource.hq",
"java.io"
] | com.springsource.hq; java.io; | 126,136 |
public ColorSpace getColorSpace()
{
return cs == null ? ColorSpace.getInstance(ColorSpace.CS_sRGB) : cs;
} | ColorSpace function() { return cs == null ? ColorSpace.getInstance(ColorSpace.CS_sRGB) : cs; } | /**
* Returns the color space of this color. Except for the constructor which
* takes a ColorSpace argument, this will be an implementation of
* ColorSpace.CS_sRGB.
*
* @return the color space
*/ | Returns the color space of this color. Except for the constructor which takes a ColorSpace argument, this will be an implementation of ColorSpace.CS_sRGB | getColorSpace | {
"repo_name": "aosm/gcc_40",
"path": "libjava/java/awt/Color.java",
"license": "gpl-2.0",
"size": 34386
} | [
"java.awt.color.ColorSpace"
] | import java.awt.color.ColorSpace; | import java.awt.color.*; | [
"java.awt"
] | java.awt; | 1,647,464 |
private void placeImageAccess(Rectangle rect, PDFXObject xobj) {
generator.saveGraphicsState(imageMCI.tag, imageMCI.mcid);
generator.add(format(rect.width) + " 0 0 "
+ format(-rect.height) + " "
+ format(rect.x) + " "
+ format(rect.y + rect.height)
+ " cm " + xobj.getName() + " Do\n");
generator.restoreGraphicsStateAccess();
} | void function(Rectangle rect, PDFXObject xobj) { generator.saveGraphicsState(imageMCI.tag, imageMCI.mcid); generator.add(format(rect.width) + STR + format(-rect.height) + " " + format(rect.x) + " " + format(rect.y + rect.height) + STR + xobj.getName() + STR); generator.restoreGraphicsStateAccess(); } | /**
* Places a previously registered image at a certain place on the page - Accessibility version
* @param rect the rectangle for the image
* @param xobj the image XObject
*/ | Places a previously registered image at a certain place on the page - Accessibility version | placeImageAccess | {
"repo_name": "StrategyObject/fop",
"path": "src/java/org/apache/fop/render/pdf/PDFPainter.java",
"license": "apache-2.0",
"size": 23326
} | [
"java.awt.Rectangle",
"org.apache.fop.pdf.PDFXObject"
] | import java.awt.Rectangle; import org.apache.fop.pdf.PDFXObject; | import java.awt.*; import org.apache.fop.pdf.*; | [
"java.awt",
"org.apache.fop"
] | java.awt; org.apache.fop; | 2,849,845 |
public Long getLongEnvVar(String arg1) throws RemoteException, NamingException; | Long function(String arg1) throws RemoteException, NamingException; | /**
* get Long environment variable using java:comp/env
*/ | get Long environment variable using java:comp/env | getLongEnvVar | {
"repo_name": "OpenLiberty/open-liberty",
"path": "dev/com.ibm.ws.ejbcontainer.legacy_fat/test-applications/EJB2XSLRemoteSpecEJB.jar/src/com/ibm/ejb2x/base/spec/slr/ejb/SLRa.java",
"license": "epl-1.0",
"size": 6110
} | [
"java.rmi.RemoteException",
"javax.naming.NamingException"
] | import java.rmi.RemoteException; import javax.naming.NamingException; | import java.rmi.*; import javax.naming.*; | [
"java.rmi",
"javax.naming"
] | java.rmi; javax.naming; | 606,949 |
public static Image getImage(String key) {
return JFaceResources.getImageRegistry().get(key);
} | static Image function(String key) { return JFaceResources.getImageRegistry().get(key); } | /**
* Returns the standard dialog image with the given key. Note that these
* images are managed by the dialog framework, and must not be disposed by
* another party.
*
* @param key
* one of the <code>Dialog.DLG_IMG_* </code> constants
* @return the standard dialog image
*
* NOTE: Dialog does not use the following images in the registry
* DLG_IMG_ERROR DLG_IMG_INFO DLG_IMG_QUESTION DLG_IMG_WARNING
*
* They are now coming directly from SWT, see ImageRegistry. For backwards
* compatibility they are still supported, however new code should use SWT
* for these.
*
* @see Display#getSystemImage(int)
*/ | Returns the standard dialog image with the given key. Note that these images are managed by the dialog framework, and must not be disposed by another party | getImage | {
"repo_name": "ControlSystemStudio/org.csstudio.iter",
"path": "plugins/org.eclipse.jface/src/org/eclipse/jface/dialogs/Dialog.java",
"license": "epl-1.0",
"size": 41148
} | [
"org.eclipse.jface.resource.JFaceResources",
"org.eclipse.swt.graphics.Image"
] | import org.eclipse.jface.resource.JFaceResources; import org.eclipse.swt.graphics.Image; | import org.eclipse.jface.resource.*; import org.eclipse.swt.graphics.*; | [
"org.eclipse.jface",
"org.eclipse.swt"
] | org.eclipse.jface; org.eclipse.swt; | 435,597 |
public static boolean hasIndexedFieldChanged(BSONObject oldObject, Index index, Document entity)
{
//DocumentRepository docRepo = new DocumentRepositoryImpl(session);
BSONObject newObject = entity.getObject();
//BSONObject oldObject = (BSONObject) JSON.parse(docRepo.read(entity.getId()).object());
for (IndexField indexField : index.getFields())
{
String field = indexField.getField();
if (newObject.get(field) == null && oldObject.get(field) == null)//this shouldn't happen?
{//if there is not a field in either index
return false;//if it's not in ether doc, it couldn't have changed
} else if (newObject.get(field) == null || oldObject.get(field) == null)
{//there is a field in one of the indexes, but not the other.
return true;//the index field must have changed, it either went from missing to present or present to missing.
}
if (!newObject.get(field).equals(oldObject.get(field)))
{
return true;//fail early
}
}
return false;
} | static boolean function(BSONObject oldObject, Index index, Document entity) { BSONObject newObject = entity.getObject(); for (IndexField indexField : index.getFields()) { String field = indexField.getField(); if (newObject.get(field) == null && oldObject.get(field) == null) { return false; } else if (newObject.get(field) == null oldObject.get(field) == null) { return true; } if (!newObject.get(field).equals(oldObject.get(field))) { return true; } } return false; } | /**
* Determines if an indexed field has changed as part of an update. This
* would be private but keeping public for ease of testing.
*
* @param oldObject the old BSON object.
* @param index Index containing the getFields to check for changes.
* @param entity New version of a document.
* @return True if an indexed field has changed. False if there is no change
* of indexed getFields.
*/ | Determines if an indexed field has changed as part of an update. This would be private but keeping public for ease of testing | hasIndexedFieldChanged | {
"repo_name": "PearsonEducation/Docussandra",
"path": "cassandra/src/main/java/com/pearson/docussandra/handler/IndexMaintainerHelper.java",
"license": "apache-2.0",
"size": 20649
} | [
"com.pearson.docussandra.domain.objects.Document",
"com.pearson.docussandra.domain.objects.Index",
"com.pearson.docussandra.domain.objects.IndexField",
"org.bson.BSONObject"
] | import com.pearson.docussandra.domain.objects.Document; import com.pearson.docussandra.domain.objects.Index; import com.pearson.docussandra.domain.objects.IndexField; import org.bson.BSONObject; | import com.pearson.docussandra.domain.objects.*; import org.bson.*; | [
"com.pearson.docussandra",
"org.bson"
] | com.pearson.docussandra; org.bson; | 2,373,921 |
public ActorRef getSender() {
return sender;
} | ActorRef function() { return sender; } | /**
* Sender of message
*
* @return sender reference
*/ | Sender of message | getSender | {
"repo_name": "shaunstanislaus/actor-platform",
"path": "actor-apps/core/src/main/java/im/actor/model/droidkit/actors/mailbox/Envelope.java",
"license": "mit",
"size": 1558
} | [
"im.actor.model.droidkit.actors.ActorRef"
] | import im.actor.model.droidkit.actors.ActorRef; | import im.actor.model.droidkit.actors.*; | [
"im.actor.model"
] | im.actor.model; | 2,339,611 |
public void updateSyncGroups(List<Player> players, Player activePlayer) {
Map<String, Player> connectedPlayers = new HashMap<String, Player>();
// Make a copy of the players we know about, ignoring unconnected ones.
for (Player player : players) {
if (!player.getConnected())
continue;
connectedPlayers.put(player.getId(), player);
}
mPlayerSyncGroups.clear();
// Iterate over all the connected players to build the list of master players.
for (Player player : connectedPlayers.values()) {
String playerId = player.getId();
PlayerState playerState = player.getPlayerState();
String syncMaster = playerState.getSyncMaster();
// If a player doesn't have a sync master then it's in a group of its own.
if (syncMaster == null) {
mPlayerSyncGroups.put(playerId, player);
continue;
}
// If the master is this player then add itself and all the slaves.
if (playerId.equals(syncMaster)) {
mPlayerSyncGroups.put(playerId, player);
continue;
}
// Must be a slave. Add it under the master. This might have already
// happened (in the block above), but might not. For example, it's possible
// to have a player that's a syncslave of an player that is not connected.
mPlayerSyncGroups.put(syncMaster, player);
}
} | void function(List<Player> players, Player activePlayer) { Map<String, Player> connectedPlayers = new HashMap<String, Player>(); for (Player player : players) { if (!player.getConnected()) continue; connectedPlayers.put(player.getId(), player); } mPlayerSyncGroups.clear(); for (Player player : connectedPlayers.values()) { String playerId = player.getId(); PlayerState playerState = player.getPlayerState(); String syncMaster = playerState.getSyncMaster(); if (syncMaster == null) { mPlayerSyncGroups.put(playerId, player); continue; } if (playerId.equals(syncMaster)) { mPlayerSyncGroups.put(playerId, player); continue; } mPlayerSyncGroups.put(syncMaster, player); } } | /**
* Builds the list of lists that is a sync group.
*
* @param players List of players.
* @param activePlayer The currently active player.
*/ | Builds the list of lists that is a sync group | updateSyncGroups | {
"repo_name": "stefandb/android-squeezer",
"path": "Squeezer/src/main/java/uk/org/ngo/squeezer/itemlist/PlayerListActivity.java",
"license": "apache-2.0",
"size": 10274
} | [
"java.util.HashMap",
"java.util.List",
"java.util.Map",
"uk.org.ngo.squeezer.model.Player",
"uk.org.ngo.squeezer.model.PlayerState"
] | import java.util.HashMap; import java.util.List; import java.util.Map; import uk.org.ngo.squeezer.model.Player; import uk.org.ngo.squeezer.model.PlayerState; | import java.util.*; import uk.org.ngo.squeezer.model.*; | [
"java.util",
"uk.org.ngo"
] | java.util; uk.org.ngo; | 184,101 |
public static String getServerKey(UURI uuri) throws URIException {
// TODO: evaluate if this is really necessary -- why not
// make the server of a dns CandidateURI the looked-up domain,
// also simplifying FetchDNS?
String key = uuri.getAuthorityMinusUserinfo();
if (key == null) {
// Fallback for cases where getAuthority() fails (eg 'dns:'.
// DNS UURIs have the 'domain' in the 'path' parameter, not
// in the authority).
key = uuri.getCurrentHierPath();
if (key != null && !key.matches("[-_\\w\\.:]+")) {
// Not just word chars and dots and colons and dashes and
// underscores; throw away
key = null;
}
}
if (key != null && uuri.getScheme().equals(UURIFactory.HTTPS)) {
// If https and no port specified, add default https port to
// distinuish https from http server without a port.
if (!key.matches(".+:[0-9]+")) {
key += UURIFactory.HTTPS_PORT;
}
}
return key;
} | static String function(UURI uuri) throws URIException { String key = uuri.getAuthorityMinusUserinfo(); if (key == null) { key = uuri.getCurrentHierPath(); if (key != null && !key.matches(STR)) { key = null; } } if (key != null && uuri.getScheme().equals(UURIFactory.HTTPS)) { if (!key.matches(STR)) { key += UURIFactory.HTTPS_PORT; } } return key; } | /**
* Get key to use doing lookup on server instances.
*
* @param cauri CandidateURI we're to get server key for.
* @return String to use as server key.
* @throws URIException
*/ | Get key to use doing lookup on server instances | getServerKey | {
"repo_name": "searchtechnologies/heritrix-connector",
"path": "engine-3.1.1/modules/src/main/java/org/archive/modules/net/CrawlServer.java",
"license": "apache-2.0",
"size": 11527
} | [
"org.apache.commons.httpclient.URIException",
"org.archive.net.UURIFactory"
] | import org.apache.commons.httpclient.URIException; import org.archive.net.UURIFactory; | import org.apache.commons.httpclient.*; import org.archive.net.*; | [
"org.apache.commons",
"org.archive.net"
] | org.apache.commons; org.archive.net; | 2,221,981 |
Location getFullBlock(int x, int y, int z); | Location getFullBlock(int x, int y, int z); | /**
* Get a representation of the block at the given position.
*
* @param x The X position
* @param y The Y position
* @param z The Z position
* @return The block
*/ | Get a representation of the block at the given position | getFullBlock | {
"repo_name": "kenzierocks/SpongeAPI",
"path": "src/main/java/org/spongepowered/api/world/extent/Extent.java",
"license": "mit",
"size": 33484
} | [
"org.spongepowered.api.world.Location"
] | import org.spongepowered.api.world.Location; | import org.spongepowered.api.world.*; | [
"org.spongepowered.api"
] | org.spongepowered.api; | 723,924 |
public StructDefinition getStreamEventHeaderDefinition(@NonNull BitBuffer input) throws CTFReaderException {
return fStreamEventHeaderDecl.createDefinition(this, LexicalScope.STREAM_EVENT_HEADER.getName(), input);
} | StructDefinition function(@NonNull BitBuffer input) throws CTFReaderException { return fStreamEventHeaderDecl.createDefinition(this, LexicalScope.STREAM_EVENT_HEADER.getName(), input); } | /**
* Get the stream context defintiion
*
* @param input
* the bitbuffer to read from
* @return an context definition, can be null
* @throws CTFReaderException
* out of bounds exception or such
*/ | Get the stream context defintiion | getStreamEventHeaderDefinition | {
"repo_name": "soctrace-inria/framesoc.importers",
"path": "fr.inria.soctrace.tools.importer.ctf/fr.inria.linuxtools.ctf.core/src/fr/inria/linuxtools/ctf/core/trace/CTFStreamInputPacketReader.java",
"license": "epl-1.0",
"size": 18844
} | [
"fr.inria.linuxtools.ctf.core.event.io.BitBuffer",
"fr.inria.linuxtools.ctf.core.event.scope.LexicalScope",
"fr.inria.linuxtools.ctf.core.event.types.StructDefinition",
"org.eclipse.jdt.annotation.NonNull"
] | import fr.inria.linuxtools.ctf.core.event.io.BitBuffer; import fr.inria.linuxtools.ctf.core.event.scope.LexicalScope; import fr.inria.linuxtools.ctf.core.event.types.StructDefinition; import org.eclipse.jdt.annotation.NonNull; | import fr.inria.linuxtools.ctf.core.event.io.*; import fr.inria.linuxtools.ctf.core.event.scope.*; import fr.inria.linuxtools.ctf.core.event.types.*; import org.eclipse.jdt.annotation.*; | [
"fr.inria.linuxtools",
"org.eclipse.jdt"
] | fr.inria.linuxtools; org.eclipse.jdt; | 1,729,267 |
public ServiceRegistry getServiceRegistry() {
return _serviceRegistry;
} | ServiceRegistry function() { return _serviceRegistry; } | /**
* Convenient access to the domain's service registry.
* @return service registry
*/ | Convenient access to the domain's service registry | getServiceRegistry | {
"repo_name": "tadayosi/switchyard",
"path": "core/runtime/src/main/java/org/switchyard/internal/DomainImpl.java",
"license": "apache-2.0",
"size": 9815
} | [
"org.switchyard.spi.ServiceRegistry"
] | import org.switchyard.spi.ServiceRegistry; | import org.switchyard.spi.*; | [
"org.switchyard.spi"
] | org.switchyard.spi; | 945,993 |
public static ExecutorService decorate(final ExecutorService executorService) {
return new ContextExecutorService(executorService);
} | static ExecutorService function(final ExecutorService executorService) { return new ContextExecutorService(executorService); } | /**
* Returns an ExecutorService that wraps *ables before submission to the passed in
* ExecutorService.
*
* @param executorService The ExecutorService to decorate.
* @return The decorated ExecutorService.
*/ | Returns an ExecutorService that wraps *ables before submission to the passed in ExecutorService | decorate | {
"repo_name": "stewnorriss/helios",
"path": "helios-client/src/main/java/com/spotify/helios/common/context/Context.java",
"license": "apache-2.0",
"size": 8181
} | [
"java.util.concurrent.ExecutorService"
] | import java.util.concurrent.ExecutorService; | import java.util.concurrent.*; | [
"java.util"
] | java.util; | 1,133,239 |
public static String decodePostSensorRequest(String response){
InputStream input = new ByteArrayInputStream(response.getBytes());
JsonReader reader = Json.createReader(input);
JsonObject jsonObject = reader.readObject();
return jsonObject.getString("_id");
} | static String function(String response){ InputStream input = new ByteArrayInputStream(response.getBytes()); JsonReader reader = Json.createReader(input); JsonObject jsonObject = reader.readObject(); return jsonObject.getString("_id"); } | /**
* Decodes a POST sensor request and returns the id of the
* new sensor.
* @param response The server response.
* @return The id of the new sensor.
*/ | Decodes a POST sensor request and returns the id of the new sensor | decodePostSensorRequest | {
"repo_name": "mrunde/WoT-Vertical-Approach",
"path": "pi/SensorController/src/de/ifgi/gwot/SensorController/util/JSONUtil.java",
"license": "mit",
"size": 5268
} | [
"com.oracle.json.Json",
"com.oracle.json.JsonObject",
"com.oracle.json.JsonReader",
"java.io.ByteArrayInputStream",
"java.io.InputStream"
] | import com.oracle.json.Json; import com.oracle.json.JsonObject; import com.oracle.json.JsonReader; import java.io.ByteArrayInputStream; import java.io.InputStream; | import com.oracle.json.*; import java.io.*; | [
"com.oracle.json",
"java.io"
] | com.oracle.json; java.io; | 2,626,796 |
public static byte[] getImageTail(byte[] data)
{
byte[] out;
int[] bounds = getBoundaries(data);
if (bounds.length != 0)
{
int offset = 256 * (data[bounds[bounds.length-1]+2] & 0xFF)+(data[bounds[bounds.length-1]+3] & 0xFF);
offset += bounds[bounds.length-1];
offset += 2;
out = Arrays.copyOfRange(data, offset, data.length);
return out;
} else return null;
} | static byte[] function(byte[] data) { byte[] out; int[] bounds = getBoundaries(data); if (bounds.length != 0) { int offset = 256 * (data[bounds[bounds.length-1]+2] & 0xFF)+(data[bounds[bounds.length-1]+3] & 0xFF); offset += bounds[bounds.length-1]; offset += 2; out = Arrays.copyOfRange(data, offset, data.length); return out; } else return null; } | /**
* Returns the tail of the data array that is not content of any block. In case of the google camera this contains the JPEG image data
*
* @param data byte array
* @return the trailing headless imagedata
*/ | Returns the tail of the data array that is not content of any block. In case of the google camera this contains the JPEG image data | getImageTail | {
"repo_name": "vanitasvitae/DepthMapNeedle",
"path": "src/JPEGUtils.java",
"license": "gpl-3.0",
"size": 15580
} | [
"java.util.Arrays"
] | import java.util.Arrays; | import java.util.*; | [
"java.util"
] | java.util; | 1,427,463 |
public void valueUnbound( HttpSessionBindingEvent event )
{
//
// Unless this pageflow has been pushed onto the nesting stack, do the onDestroy() callback.
//
if ( ! _isOnNestingStack )
{
super.valueUnbound( event );
}
} | void function( HttpSessionBindingEvent event ) { { super.valueUnbound( event ); } } | /**
* Callback when this object is removed from the user session. Causes {@link #onDestroy} to be called. This is a
* framework-invoked method that should not be called directly.
*/ | Callback when this object is removed from the user session. Causes <code>#onDestroy</code> to be called. This is a framework-invoked method that should not be called directly | valueUnbound | {
"repo_name": "moparisthebest/beehive",
"path": "beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowController.java",
"license": "apache-2.0",
"size": 47418
} | [
"javax.servlet.http.HttpSessionBindingEvent"
] | import javax.servlet.http.HttpSessionBindingEvent; | import javax.servlet.http.*; | [
"javax.servlet"
] | javax.servlet; | 2,038,170 |
private void processPreparedView(NetView v) {
assert initialView != null;
if (currentView == null || currentView.getViewId() < v.getViewId()) {
// we have a prepared view that is newer than the current view
// form a new View ID
int viewId = Math.max(initialView.getViewId(), v.getViewId());
viewId += 1;
NetView newView = new NetView(initialView, viewId);
// add the new members from the prepared view to the new view,
// preserving their failure-detection ports
List<InternalDistributedMember> newMembers;
if (currentView != null) {
newMembers = v.getNewMembers(currentView);
} else {
newMembers = v.getMembers();
}
for (InternalDistributedMember newMember : newMembers) {
newView.add(newMember);
newView.setFailureDetectionPort(newMember, v.getFailureDetectionPort(newMember));
newView.setPublicKey(newMember, v.getPublicKey(newMember));
}
// use the new view as the initial view
synchronized (this) {
setInitialView(newView, newMembers, initialLeaving, initialRemovals);
}
}
} | void function(NetView v) { assert initialView != null; if (currentView == null currentView.getViewId() < v.getViewId()) { int viewId = Math.max(initialView.getViewId(), v.getViewId()); viewId += 1; NetView newView = new NetView(initialView, viewId); List<InternalDistributedMember> newMembers; if (currentView != null) { newMembers = v.getNewMembers(currentView); } else { newMembers = v.getMembers(); } for (InternalDistributedMember newMember : newMembers) { newView.add(newMember); newView.setFailureDetectionPort(newMember, v.getFailureDetectionPort(newMember)); newView.setPublicKey(newMember, v.getPublicKey(newMember)); } synchronized (this) { setInitialView(newView, newMembers, initialLeaving, initialRemovals); } } } | /**
* During initial view processing a prepared view was discovered. This method will extract its
* new members and create a new initial view containing them.
*
* @param v The prepared view
*/ | During initial view processing a prepared view was discovered. This method will extract its new members and create a new initial view containing them | processPreparedView | {
"repo_name": "smanvi-pivotal/geode",
"path": "geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/membership/GMSJoinLeave.java",
"license": "apache-2.0",
"size": 99806
} | [
"java.util.List",
"org.apache.geode.distributed.internal.membership.InternalDistributedMember",
"org.apache.geode.distributed.internal.membership.NetView"
] | import java.util.List; import org.apache.geode.distributed.internal.membership.InternalDistributedMember; import org.apache.geode.distributed.internal.membership.NetView; | import java.util.*; import org.apache.geode.distributed.internal.membership.*; | [
"java.util",
"org.apache.geode"
] | java.util; org.apache.geode; | 2,843,231 |
public void recalculateAllAttributeStatistics() {
List<Attribute> allAttributes = new ArrayList<Attribute>();
Iterator<Attribute> a = getAttributes().allAttributes();
while (a.hasNext()) {
allAttributes.add(a.next());
}
recalculateAttributeStatistics(allAttributes);
}
| void function() { List<Attribute> allAttributes = new ArrayList<Attribute>(); Iterator<Attribute> a = getAttributes().allAttributes(); while (a.hasNext()) { allAttributes.add(a.next()); } recalculateAttributeStatistics(allAttributes); } | /**
* Recalculates the attribute statistics for all attributes. They are
* average value, variance, minimum, and maximum. For nominal attributes the
* occurences for all values are counted. This method collects all
* attributes (regular and special) in a list and invokes
* <code>recalculateAttributeStatistics(List attributes)</code> and
* performs only one data scan.
*/ | Recalculates the attribute statistics for all attributes. They are average value, variance, minimum, and maximum. For nominal attributes the occurences for all values are counted. This method collects all attributes (regular and special) in a list and invokes <code>recalculateAttributeStatistics(List attributes)</code> and performs only one data scan | recalculateAllAttributeStatistics | {
"repo_name": "aborg0/rapidminer-vega",
"path": "src/com/rapidminer/example/set/AbstractExampleSet.java",
"license": "agpl-3.0",
"size": 20103
} | [
"com.rapidminer.example.Attribute",
"java.util.ArrayList",
"java.util.Iterator",
"java.util.List"
] | import com.rapidminer.example.Attribute; import java.util.ArrayList; import java.util.Iterator; import java.util.List; | import com.rapidminer.example.*; import java.util.*; | [
"com.rapidminer.example",
"java.util"
] | com.rapidminer.example; java.util; | 923,726 |
public static Iterator<RevObject> all(ObjectId top, ObjectStore database,
Deduplicator deduplicator) {
List<ObjectId> start = new ArrayList<ObjectId>();
start.add(top);
return new PostOrderIterator(start, database,
uniqueWithDeduplicator(ALL_SUCCESSORS, deduplicator));
} | static Iterator<RevObject> function(ObjectId top, ObjectStore database, Deduplicator deduplicator) { List<ObjectId> start = new ArrayList<ObjectId>(); start.add(top); return new PostOrderIterator(start, database, uniqueWithDeduplicator(ALL_SUCCESSORS, deduplicator)); } | /**
* A traversal of all objects reachable from the given origin, with deduplication.
*/ | A traversal of all objects reachable from the given origin, with deduplication | all | {
"repo_name": "jdgarrett/geogig",
"path": "src/core/src/main/java/org/locationtech/geogig/remote/http/PostOrderIterator.java",
"license": "bsd-3-clause",
"size": 22509
} | [
"java.util.ArrayList",
"java.util.Iterator",
"java.util.List",
"org.locationtech.geogig.model.ObjectId",
"org.locationtech.geogig.model.RevObject",
"org.locationtech.geogig.repository.impl.Deduplicator",
"org.locationtech.geogig.storage.ObjectStore"
] | import java.util.ArrayList; import java.util.Iterator; import java.util.List; import org.locationtech.geogig.model.ObjectId; import org.locationtech.geogig.model.RevObject; import org.locationtech.geogig.repository.impl.Deduplicator; import org.locationtech.geogig.storage.ObjectStore; | import java.util.*; import org.locationtech.geogig.model.*; import org.locationtech.geogig.repository.impl.*; import org.locationtech.geogig.storage.*; | [
"java.util",
"org.locationtech.geogig"
] | java.util; org.locationtech.geogig; | 1,316,658 |
@Override
public final void setBeanName(String beanName) {
this.beanName = beanName;
}
/**
* {@inheritDoc}
* <p>Any environment set here overrides the {@link StandardServletEnvironment} | final void function(String beanName) { this.beanName = beanName; } /** * {@inheritDoc} * <p>Any environment set here overrides the {@link StandardServletEnvironment} | /**
* Stores the bean name as defined in the Spring bean factory.
* <p>Only relevant in case of initialization as bean, to have a name as
* fallback to the filter name usually provided by a FilterConfig instance.
* @see org.springframework.beans.factory.BeanNameAware
* @see #getFilterName()
*/ | Stores the bean name as defined in the Spring bean factory. Only relevant in case of initialization as bean, to have a name as fallback to the filter name usually provided by a FilterConfig instance | setBeanName | {
"repo_name": "shivpun/spring-framework",
"path": "spring-web/src/main/java/org/springframework/web/filter/GenericFilterBean.java",
"license": "apache-2.0",
"size": 12387
} | [
"org.springframework.web.context.support.StandardServletEnvironment"
] | import org.springframework.web.context.support.StandardServletEnvironment; | import org.springframework.web.context.support.*; | [
"org.springframework.web"
] | org.springframework.web; | 149,333 |
public void setObservedProperty(String observedProperty) {
this.observedProperty = Val.chkStr(observedProperty);
}
| void function(String observedProperty) { this.observedProperty = Val.chkStr(observedProperty); } | /**
* Sets observed property.
* @param observedProperty the observedProperty to set
*/ | Sets observed property | setObservedProperty | {
"repo_name": "usgin/usgin-geoportal",
"path": "src/com/esri/gpt/control/livedata/sos/SOSContext.java",
"license": "apache-2.0",
"size": 4586
} | [
"com.esri.gpt.framework.util.Val"
] | import com.esri.gpt.framework.util.Val; | import com.esri.gpt.framework.util.*; | [
"com.esri.gpt"
] | com.esri.gpt; | 1,126,726 |
public PutIndexTemplateRequest source(String templateSource) {
try (XContentParser parser = XContentFactory.xContent(templateSource).createParser(templateSource)) {
return source(parser.mapOrdered());
} catch (Exception e) {
throw new IllegalArgumentException("failed to parse template source [" + templateSource + "]", e);
}
} | PutIndexTemplateRequest function(String templateSource) { try (XContentParser parser = XContentFactory.xContent(templateSource).createParser(templateSource)) { return source(parser.mapOrdered()); } catch (Exception e) { throw new IllegalArgumentException(STR + templateSource + "]", e); } } | /**
* The template source definition.
*/ | The template source definition | source | {
"repo_name": "apepper/elasticsearch",
"path": "core/src/main/java/org/elasticsearch/action/admin/indices/template/put/PutIndexTemplateRequest.java",
"license": "apache-2.0",
"size": 16425
} | [
"org.elasticsearch.common.xcontent.XContentFactory",
"org.elasticsearch.common.xcontent.XContentParser"
] | import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.common.xcontent.XContentParser; | import org.elasticsearch.common.xcontent.*; | [
"org.elasticsearch.common"
] | org.elasticsearch.common; | 1,102,155 |
@ImmediateService
public TaskLogs getLogs() {
this.flushStreams();
TaskLogs logs = new Log4JTaskLogs(this.logAppender.getStorage(), this.taskId.getJobId().value());
return logs;
} | TaskLogs function() { this.flushStreams(); TaskLogs logs = new Log4JTaskLogs(this.logAppender.getStorage(), this.taskId.getJobId().value()); return logs; } | /**
* Return a TaskLogs object that contains the logs produced by the executed tasks
*
* @return a TaskLogs object that contains the logs produced by the executed tasks
*/ | Return a TaskLogs object that contains the logs produced by the executed tasks | getLogs | {
"repo_name": "acontes/scheduling",
"path": "src/scheduler/src/org/ow2/proactive/scheduler/task/launcher/TaskLauncher.java",
"license": "agpl-3.0",
"size": 57813
} | [
"org.ow2.proactive.scheduler.common.task.Log4JTaskLogs",
"org.ow2.proactive.scheduler.common.task.TaskLogs"
] | import org.ow2.proactive.scheduler.common.task.Log4JTaskLogs; import org.ow2.proactive.scheduler.common.task.TaskLogs; | import org.ow2.proactive.scheduler.common.task.*; | [
"org.ow2.proactive"
] | org.ow2.proactive; | 932,706 |
public void looseMarshal(OpenWireFormat wireFormat, Object o, DataByteArrayOutputStream dataOut) throws IOException {
super.looseMarshal(wireFormat, o, dataOut);
} | void function(OpenWireFormat wireFormat, Object o, DataByteArrayOutputStream dataOut) throws IOException { super.looseMarshal(wireFormat, o, dataOut); } | /**
* Write the booleans that this object uses to a BooleanStream
*/ | Write the booleans that this object uses to a BooleanStream | looseMarshal | {
"repo_name": "jludvice/fabric8",
"path": "gateway/gateway-core/src/main/java/io/fabric8/gateway/handlers/detecting/protocol/openwire/codec/v1/ActiveMQStreamMessageMarshaller.java",
"license": "apache-2.0",
"size": 3689
} | [
"io.fabric8.gateway.handlers.detecting.protocol.openwire.codec.OpenWireFormat",
"java.io.IOException",
"org.fusesource.hawtbuf.DataByteArrayOutputStream"
] | import io.fabric8.gateway.handlers.detecting.protocol.openwire.codec.OpenWireFormat; import java.io.IOException; import org.fusesource.hawtbuf.DataByteArrayOutputStream; | import io.fabric8.gateway.handlers.detecting.protocol.openwire.codec.*; import java.io.*; import org.fusesource.hawtbuf.*; | [
"io.fabric8.gateway",
"java.io",
"org.fusesource.hawtbuf"
] | io.fabric8.gateway; java.io; org.fusesource.hawtbuf; | 1,902,929 |
private List sortByUniqueId(Criteria crit)
throws Exception
{
crit.addSelectColumn(IssuePeer.ISSUE_ID);
crit.addSelectColumn(IssuePeer.MODULE_ID);
crit.addSelectColumn(IssuePeer.TYPE_ID);
crit.addSelectColumn(IssuePeer.ID_PREFIX);
crit.addSelectColumn(IssuePeer.ID_COUNT);
if (getSortPolarity().equals("desc"))
{
crit.addDescendingOrderByColumn(IssuePeer.ID_COUNT);
}
else
{
crit.addAscendingOrderByColumn(IssuePeer.ID_COUNT);
}
// add pk sort so that rows can be combined easily
crit.addAscendingOrderByColumn(IssuePeer.ISSUE_ID);
// add the attribute value columns that will be shown in the list.
// these are joined using a left outer join, so the additional
// columns do not affect the results of the search (no additional
// criteria are added to the where clause.) Criteria object does
// not provide support for outer joins, so we will need to manipulate
// the query manually
String sql = BasePeer.createQueryString(crit);
int valueListSize = -1;
List rmuas = getIssueListAttributeColumns();
if (rmuas != null)
{
StringBuffer sb = new StringBuffer(sql.length() + 500);
sb.append(sql);
valueListSize = rmuas.size();
StringBuffer outerJoin = new StringBuffer(10 * valueListSize + 20);
StringBuffer selectColumns = new StringBuffer(20 * valueListSize);
for (Iterator i = rmuas.iterator(); i.hasNext();)
{
RModuleUserAttribute rmua = (RModuleUserAttribute)i.next();
String id = rmua.getAttributeId().toString();
String alias = "av" + id;
// add column to SELECT column clause
selectColumns.append(',').append(alias).append(".VALUE");
// if no criteria was specified for a displayed attribute
// add it as an outer join
if (crit.getTableForAlias(alias) == null)
{
outerJoin.append(
" LEFT OUTER JOIN SCARAB_ISSUE_ATTRIBUTE_VALUE ")
.append(alias).append(" ON (SCARAB_ISSUE.ISSUE_ID=")
.append(alias).append(".ISSUE_ID AND ").append(alias)
.append(".DELETED=0 AND ").append(alias)
.append(".ATTRIBUTE_ID=").append(id).append(')');
}
}
// add left outer join
sb.insert(sql.indexOf(WHERE), outerJoin.toString());
// add attribute columns for the table
sb.insert(sql.indexOf(FROM), selectColumns.toString());
sql = sb.toString();
}
// return a List of QueryResult objects
return buildQueryResults(BasePeer.executeQuery(sql),
NO_ATTRIBUTE_SORT, valueListSize);
} | List function(Criteria crit) throws Exception { crit.addSelectColumn(IssuePeer.ISSUE_ID); crit.addSelectColumn(IssuePeer.MODULE_ID); crit.addSelectColumn(IssuePeer.TYPE_ID); crit.addSelectColumn(IssuePeer.ID_PREFIX); crit.addSelectColumn(IssuePeer.ID_COUNT); if (getSortPolarity().equals("desc")) { crit.addDescendingOrderByColumn(IssuePeer.ID_COUNT); } else { crit.addAscendingOrderByColumn(IssuePeer.ID_COUNT); } crit.addAscendingOrderByColumn(IssuePeer.ISSUE_ID); String sql = BasePeer.createQueryString(crit); int valueListSize = -1; List rmuas = getIssueListAttributeColumns(); if (rmuas != null) { StringBuffer sb = new StringBuffer(sql.length() + 500); sb.append(sql); valueListSize = rmuas.size(); StringBuffer outerJoin = new StringBuffer(10 * valueListSize + 20); StringBuffer selectColumns = new StringBuffer(20 * valueListSize); for (Iterator i = rmuas.iterator(); i.hasNext();) { RModuleUserAttribute rmua = (RModuleUserAttribute)i.next(); String id = rmua.getAttributeId().toString(); String alias = "av" + id; selectColumns.append(',').append(alias).append(STR); if (crit.getTableForAlias(alias) == null) { outerJoin.append( STR) .append(alias).append(STR) .append(alias).append(STR).append(alias) .append(STR).append(alias) .append(STR).append(id).append(')'); } } sb.insert(sql.indexOf(WHERE), outerJoin.toString()); sb.insert(sql.indexOf(FROM), selectColumns.toString()); sql = sb.toString(); } return buildQueryResults(BasePeer.executeQuery(sql), NO_ATTRIBUTE_SORT, valueListSize); } | /**
* Sorts on issue unique id (default)
*/ | Sorts on issue unique id (default) | sortByUniqueId | {
"repo_name": "SpoonLabs/gumtree-spoon-ast-diff",
"path": "src/test/resources/examples/t_227985/right_IssueSearch_1.66.java",
"license": "apache-2.0",
"size": 72744
} | [
"java.util.Iterator",
"java.util.List",
"org.apache.torque.util.BasePeer",
"org.apache.torque.util.Criteria",
"org.tigris.scarab.om.IssuePeer",
"org.tigris.scarab.om.RModuleUserAttribute"
] | import java.util.Iterator; import java.util.List; import org.apache.torque.util.BasePeer; import org.apache.torque.util.Criteria; import org.tigris.scarab.om.IssuePeer; import org.tigris.scarab.om.RModuleUserAttribute; | import java.util.*; import org.apache.torque.util.*; import org.tigris.scarab.om.*; | [
"java.util",
"org.apache.torque",
"org.tigris.scarab"
] | java.util; org.apache.torque; org.tigris.scarab; | 296,374 |
public KeyNamePair getKeyNamePair()
{
return new KeyNamePair(get_ID(), getName());
} | KeyNamePair function() { return new KeyNamePair(get_ID(), getName()); } | /** Get Record ID/ColumnName
@return ID/ColumnName pair
*/ | Get Record ID/ColumnName | getKeyNamePair | {
"repo_name": "klst-com/metasfresh",
"path": "de.metas.adempiere.adempiere/base/src/main/java-gen/org/compiere/model/X_AD_Language.java",
"license": "gpl-2.0",
"size": 8078
} | [
"org.compiere.util.KeyNamePair"
] | import org.compiere.util.KeyNamePair; | import org.compiere.util.*; | [
"org.compiere.util"
] | org.compiere.util; | 1,435,154 |
private void deleteAllDockableActions() {
// now actually search for all elements that start with "workspace_"
GlobalSearchResultBuilder builder = new GlobalSearchResultBuilder(FIELD_DOCKABLE_TYPE + GlobalSearchUtilities.QUERY_FIELD_SPECIFIER + String.valueOf(Boolean.TRUE));
builder.setMaxNumberOfResults(Integer.MAX_VALUE).setSearchCategories(GlobalSearchRegistry.INSTANCE.getSearchCategoryById(getSearchCategoryId()));
try {
GlobalSearchResult result = builder.runSearch();
removeDocumentsFromIndex(result.getResultDocuments());
} catch (ParseException e) {
LogService.getRoot().log(Level.WARNING, "com.rapidminer.gui.actions.search.ActionsGlobalSearchManager.error.delete_dockables_error", e);
}
} | void function() { GlobalSearchResultBuilder builder = new GlobalSearchResultBuilder(FIELD_DOCKABLE_TYPE + GlobalSearchUtilities.QUERY_FIELD_SPECIFIER + String.valueOf(Boolean.TRUE)); builder.setMaxNumberOfResults(Integer.MAX_VALUE).setSearchCategories(GlobalSearchRegistry.INSTANCE.getSearchCategoryById(getSearchCategoryId())); try { GlobalSearchResult result = builder.runSearch(); removeDocumentsFromIndex(result.getResultDocuments()); } catch (ParseException e) { LogService.getRoot().log(Level.WARNING, STR, e); } } | /**
* Deletes all dockable actions from the index.
*
*/ | Deletes all dockable actions from the index | deleteAllDockableActions | {
"repo_name": "rapidminer/rapidminer-studio",
"path": "src/main/java/com/rapidminer/gui/actions/search/ActionsGlobalSearchManager.java",
"license": "agpl-3.0",
"size": 17182
} | [
"com.rapidminer.search.GlobalSearchRegistry",
"com.rapidminer.search.GlobalSearchResult",
"com.rapidminer.search.GlobalSearchResultBuilder",
"com.rapidminer.search.GlobalSearchUtilities",
"com.rapidminer.tools.LogService",
"java.util.logging.Level",
"org.apache.lucene.queryparser.classic.ParseException"
] | import com.rapidminer.search.GlobalSearchRegistry; import com.rapidminer.search.GlobalSearchResult; import com.rapidminer.search.GlobalSearchResultBuilder; import com.rapidminer.search.GlobalSearchUtilities; import com.rapidminer.tools.LogService; import java.util.logging.Level; import org.apache.lucene.queryparser.classic.ParseException; | import com.rapidminer.search.*; import com.rapidminer.tools.*; import java.util.logging.*; import org.apache.lucene.queryparser.classic.*; | [
"com.rapidminer.search",
"com.rapidminer.tools",
"java.util",
"org.apache.lucene"
] | com.rapidminer.search; com.rapidminer.tools; java.util; org.apache.lucene; | 2,726,870 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.