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 Point topRightAlignmentPoint() {
return new Point(this.maxX, this.trackMinY);
} | Point function() { return new Point(this.maxX, this.trackMinY); } | /**
* Point at top right used to align with other plot elements.
* @return A point
*/ | Point at top right used to align with other plot elements | topRightAlignmentPoint | {
"repo_name": "NCIP/webgenome",
"path": "tags/WEBGENOME_R3.2_6MAR2009_BUILD1/java/core/src/org/rti/webgenome/graphics/widget/HeatMapPlot.java",
"license": "bsd-3-clause",
"size": 17281
} | [
"java.awt.Point"
] | import java.awt.Point; | import java.awt.*; | [
"java.awt"
] | java.awt; | 1,505,738 |
Configuration setIncomingInterceptorClassNames(List<String> interceptors); | Configuration setIncomingInterceptorClassNames(List<String> interceptors); | /**
* Sets the list of interceptors classes used by this server for incoming messages (i.e. those being delivered to
* the server from clients).
* <br>
* Classes must implement {@link org.apache.activemq.artemis.api.core.Interceptor}.
*/ | Sets the list of interceptors classes used by this server for incoming messages (i.e. those being delivered to the server from clients). Classes must implement <code>org.apache.activemq.artemis.api.core.Interceptor</code> | setIncomingInterceptorClassNames | {
"repo_name": "wildfly/activemq-artemis",
"path": "artemis-server/src/main/java/org/apache/activemq/artemis/core/config/Configuration.java",
"license": "apache-2.0",
"size": 31421
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 479,547 |
@Override
@Generated(value = "com.sun.tools.xjc.Driver", date = "2014-09-19T03:10:02-06:00", comment = "JAXB RI v2.2.6")
public String toString() {
return ToStringBuilder.reflectionToString(this, JAXBToStringStyle.MULTI_LINE_STYLE);
} | @Generated(value = STR, date = STR, comment = STR) String function() { return ToStringBuilder.reflectionToString(this, JAXBToStringStyle.MULTI_LINE_STYLE); } | /**
* Generates a String representation of the contents of this type.
* This is an extension method, produced by the 'ts' xjc plugin
*
*/ | Generates a String representation of the contents of this type. This is an extension method, produced by the 'ts' xjc plugin | toString | {
"repo_name": "angecab10/travelport-uapi-tutorial",
"path": "src/com/travelport/schema/common_v29_0/OperatedBy.java",
"license": "gpl-3.0",
"size": 3107
} | [
"javax.annotation.Generated",
"org.apache.commons.lang.builder.ToStringBuilder",
"org.apache.cxf.xjc.runtime.JAXBToStringStyle"
] | import javax.annotation.Generated; import org.apache.commons.lang.builder.ToStringBuilder; import org.apache.cxf.xjc.runtime.JAXBToStringStyle; | import javax.annotation.*; import org.apache.commons.lang.builder.*; import org.apache.cxf.xjc.runtime.*; | [
"javax.annotation",
"org.apache.commons",
"org.apache.cxf"
] | javax.annotation; org.apache.commons; org.apache.cxf; | 2,351,530 |
public BigDataPoolResourceInfoInner withSparkConfigProperties(SparkConfigProperties sparkConfigProperties) {
if (this.innerProperties() == null) {
this.innerProperties = new BigDataPoolResourceProperties();
}
this.innerProperties().withSparkConfigProperties(sparkConfigProperties);
return this;
} | BigDataPoolResourceInfoInner function(SparkConfigProperties sparkConfigProperties) { if (this.innerProperties() == null) { this.innerProperties = new BigDataPoolResourceProperties(); } this.innerProperties().withSparkConfigProperties(sparkConfigProperties); return this; } | /**
* Set the sparkConfigProperties property: Spark pool Config Properties Spark configuration file to specify
* additional properties.
*
* @param sparkConfigProperties the sparkConfigProperties value to set.
* @return the BigDataPoolResourceInfoInner object itself.
*/ | Set the sparkConfigProperties property: Spark pool Config Properties Spark configuration file to specify additional properties | withSparkConfigProperties | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/synapse/azure-resourcemanager-synapse/src/main/java/com/azure/resourcemanager/synapse/fluent/models/BigDataPoolResourceInfoInner.java",
"license": "mit",
"size": 16850
} | [
"com.azure.resourcemanager.synapse.models.SparkConfigProperties"
] | import com.azure.resourcemanager.synapse.models.SparkConfigProperties; | import com.azure.resourcemanager.synapse.models.*; | [
"com.azure.resourcemanager"
] | com.azure.resourcemanager; | 2,489,074 |
public static boolean matches(TieredIdentity.LocalityTier tier,
TieredIdentity.LocalityTier otherTier, boolean resolveIpAddress) {
String otherTierName = otherTier.getTierName();
if (!tier.getTierName().equals(otherTierName)) {
return false;
}
String otherTierValue = otherTier.getValue();
if (tier.getValue() != null && tier.getValue().equals(otherTierValue)) {
return true;
}
// For node tiers, attempt to resolve hostnames to IP addresses, this avoids common
// misconfiguration errors where a worker is using one hostname and the client is using
// another.
if (resolveIpAddress) {
if (Constants.LOCALITY_NODE.equals(tier.getTierName())) {
try {
String tierIpAddress = NetworkAddressUtils.resolveIpAddress(tier.getValue());
String otherTierIpAddress = NetworkAddressUtils.resolveIpAddress(otherTierValue);
if (tierIpAddress != null && tierIpAddress.equals(otherTierIpAddress)) {
return true;
}
} catch (UnknownHostException e) {
return false;
}
}
}
return false;
} | static boolean function(TieredIdentity.LocalityTier tier, TieredIdentity.LocalityTier otherTier, boolean resolveIpAddress) { String otherTierName = otherTier.getTierName(); if (!tier.getTierName().equals(otherTierName)) { return false; } String otherTierValue = otherTier.getValue(); if (tier.getValue() != null && tier.getValue().equals(otherTierValue)) { return true; } if (resolveIpAddress) { if (Constants.LOCALITY_NODE.equals(tier.getTierName())) { try { String tierIpAddress = NetworkAddressUtils.resolveIpAddress(tier.getValue()); String otherTierIpAddress = NetworkAddressUtils.resolveIpAddress(otherTierValue); if (tierIpAddress != null && tierIpAddress.equals(otherTierIpAddress)) { return true; } } catch (UnknownHostException e) { return false; } } } return false; } | /**
* Locality comparison for wire type locality tiers, two locality tiers matches if both name and
* values are equal, or for the "node" tier, if the node names resolve to the same IP address.
*
* @param tier a wire type locality tier
* @param otherTier a wire type locality tier to compare to
* @param resolveIpAddress whether or not to resolve hostnames to IP addresses for node locality
* @return true if the wire type locality tier matches the given tier
*/ | Locality comparison for wire type locality tiers, two locality tiers matches if both name and values are equal, or for the "node" tier, if the node names resolve to the same IP address | matches | {
"repo_name": "bf8086/alluxio",
"path": "core/common/src/main/java/alluxio/util/TieredIdentityUtils.java",
"license": "apache-2.0",
"size": 3669
} | [
"java.net.UnknownHostException"
] | import java.net.UnknownHostException; | import java.net.*; | [
"java.net"
] | java.net; | 837,169 |
public synchronized void dispose() throws SQLException {
if (isDisposed) return;
isDisposed = true;
SQLException e = null;
while (!recycledConnections.isEmpty()) {
PooledConnection pconn = recycledConnections.pop();
try {
pconn.close(); }
catch (SQLException e2) {
if (e == null) e = e2; }}
if (e != null) throw e; }
| synchronized void function() throws SQLException { if (isDisposed) return; isDisposed = true; SQLException e = null; while (!recycledConnections.isEmpty()) { PooledConnection pconn = recycledConnections.pop(); try { pconn.close(); } catch (SQLException e2) { if (e == null) e = e2; }} if (e != null) throw e; } | /**
* Closes all unused pooled connections.
*/ | Closes all unused pooled connections | dispose | {
"repo_name": "chrisvest/nanopool",
"path": "src/test/java/biz/source_code/miniConnectionPoolManager/MiniConnectionPoolManager.java",
"license": "apache-2.0",
"size": 7715
} | [
"java.sql.SQLException",
"javax.sql.PooledConnection"
] | import java.sql.SQLException; import javax.sql.PooledConnection; | import java.sql.*; import javax.sql.*; | [
"java.sql",
"javax.sql"
] | java.sql; javax.sql; | 1,815,251 |
protected HttpResponse executeMethod(HttpUriRequest httpRequest) throws IOException {
HttpContext localContext = new BasicHttpContext();
if (getEndpoint().isAuthenticationPreemptive()) {
BasicScheme basicAuth = new BasicScheme();
localContext.setAttribute("preemptive-auth", basicAuth);
}
if (httpContext != null) {
localContext = new BasicHttpContext(httpContext);
}
return httpClient.execute(httpRequest, localContext);
} | HttpResponse function(HttpUriRequest httpRequest) throws IOException { HttpContext localContext = new BasicHttpContext(); if (getEndpoint().isAuthenticationPreemptive()) { BasicScheme basicAuth = new BasicScheme(); localContext.setAttribute(STR, basicAuth); } if (httpContext != null) { localContext = new BasicHttpContext(httpContext); } return httpClient.execute(httpRequest, localContext); } | /**
* Strategy when executing the method (calling the remote server).
*
* @param httpRequest the http Request to execute
* @return the response
* @throws IOException can be thrown
*/ | Strategy when executing the method (calling the remote server) | executeMethod | {
"repo_name": "ullgren/camel",
"path": "components/camel-http/src/main/java/org/apache/camel/component/http/HttpProducer.java",
"license": "apache-2.0",
"size": 27966
} | [
"java.io.IOException",
"org.apache.http.HttpResponse",
"org.apache.http.client.methods.HttpUriRequest",
"org.apache.http.impl.auth.BasicScheme",
"org.apache.http.protocol.BasicHttpContext",
"org.apache.http.protocol.HttpContext"
] | import java.io.IOException; import org.apache.http.HttpResponse; import org.apache.http.client.methods.HttpUriRequest; import org.apache.http.impl.auth.BasicScheme; import org.apache.http.protocol.BasicHttpContext; import org.apache.http.protocol.HttpContext; | import java.io.*; import org.apache.http.*; import org.apache.http.client.methods.*; import org.apache.http.impl.auth.*; import org.apache.http.protocol.*; | [
"java.io",
"org.apache.http"
] | java.io; org.apache.http; | 886,959 |
public ExprUnion copy(CopyState copyState) {
return new ExprUnion(this, copyState);
} | ExprUnion function(CopyState copyState) { return new ExprUnion(this, copyState); } | /**
* Returns a (deep) clone of this object.
*/ | Returns a (deep) clone of this object | copy | {
"repo_name": "viqueen/closure-templates",
"path": "java/src/com/google/template/soy/soytree/ExprUnion.java",
"license": "apache-2.0",
"size": 3380
} | [
"com.google.template.soy.basetree.CopyState"
] | import com.google.template.soy.basetree.CopyState; | import com.google.template.soy.basetree.*; | [
"com.google.template"
] | com.google.template; | 120,362 |
protected void waitTimeout(long timeout) throws RetriableException {
if (timeout > 0) {
try {
Thread.sleep(timeout);
} catch (InterruptedException interException) {
LOGGER.debug("Interrupted during timeout", interException);
}
}
}
/**
* Calls the {@link #retriableCall()} ('the call') up to {@code times} times and returns the result.
*
* If the call was successful, this method returns.
* If the call was not successful due to a missing implementation (throws {@link NoSuchAlgorithmException}),
* this method throws a {@link RetriableException}.
* If the call was not successful due to an {@link java.net.UnknownHostException} and the number of trials does
* not exceed {@code times}, this method retries the call after sleeping for {@code timeout} milliseconds.
* If the call was not successful and/or the number of trials is exceeded, this method throws a
* {@link RetriableException}.
*
* @param times the number of times this method should be called
* @param timeout the timeout in milliseconds
* @return the result of {@link #retriableCall()} | void function(long timeout) throws RetriableException { if (timeout > 0) { try { Thread.sleep(timeout); } catch (InterruptedException interException) { LOGGER.debug(STR, interException); } } } /** * Calls the {@link #retriableCall()} ('the call') up to {@code times} times and returns the result. * * If the call was successful, this method returns. * If the call was not successful due to a missing implementation (throws {@link NoSuchAlgorithmException}), * this method throws a {@link RetriableException}. * If the call was not successful due to an {@link java.net.UnknownHostException} and the number of trials does * not exceed {@code times}, this method retries the call after sleeping for {@code timeout} milliseconds. * If the call was not successful and/or the number of trials is exceeded, this method throws a * {@link RetriableException}. * * @param times the number of times this method should be called * @param timeout the timeout in milliseconds * @return the result of {@link #retriableCall()} | /**
* Waits for specified number of milliseconds.
*
* @param timeout sleep time in milliseconds.
* @throws RetriableException when sleep is interrupted
*/ | Waits for specified number of milliseconds | waitTimeout | {
"repo_name": "intuit/wasabi",
"path": "modules/authentication/src/main/java/com/intuit/wasabi/authentication/util/Retriable.java",
"license": "apache-2.0",
"size": 4598
} | [
"java.security.NoSuchAlgorithmException"
] | import java.security.NoSuchAlgorithmException; | import java.security.*; | [
"java.security"
] | java.security; | 1,904,616 |
public final void setMap(TurtleMap map)
{
this.map = map;
} | final void function(TurtleMap map) { this.map = map; } | /**
* Set a turtle map this entity is in
*
* @param map the map
*/ | Set a turtle map this entity is in | setMap | {
"repo_name": "MightyPork/tortuga",
"path": "src/net/tortuga/level/map/entities/Entity.java",
"license": "bsd-2-clause",
"size": 27043
} | [
"net.tortuga.level.map.TurtleMap"
] | import net.tortuga.level.map.TurtleMap; | import net.tortuga.level.map.*; | [
"net.tortuga.level"
] | net.tortuga.level; | 1,126,992 |
public static boolean isViewClosed(final String viewKey, final MainFrame mainFrame) {
if (viewKey == null || "".equals(viewKey.trim())) {
throw new IllegalArgumentException("viewKey must not be null or empty!");
}
if (mainFrame == null) {
throw new IllegalArgumentException("mainFrame must not be null or empty!");
}
DockableState state = getDockableState(viewKey, mainFrame);
return state == null || state.isClosed() || state.isHidden();
} | static boolean function(final String viewKey, final MainFrame mainFrame) { if (viewKey == null STRviewKey must not be null or empty!STRmainFrame must not be null or empty!"); } DockableState state = getDockableState(viewKey, mainFrame); return state == null state.isClosed() state.isHidden(); } | /**
* Returns <code>true</code> if the view with the given key is closed.
*
* @param viewKey
* @param mainFrame
* @return
*/ | Returns <code>true</code> if the view with the given key is closed | isViewClosed | {
"repo_name": "brtonnies/rapidminer-studio",
"path": "src/main/java/com/rapidminer/gui/tour/comic/episodes/EpisodeHelper.java",
"license": "agpl-3.0",
"size": 13087
} | [
"com.rapidminer.gui.MainFrame",
"com.vlsolutions.swing.docking.DockableState"
] | import com.rapidminer.gui.MainFrame; import com.vlsolutions.swing.docking.DockableState; | import com.rapidminer.gui.*; import com.vlsolutions.swing.docking.*; | [
"com.rapidminer.gui",
"com.vlsolutions.swing"
] | com.rapidminer.gui; com.vlsolutions.swing; | 1,655,600 |
public boolean setNextDoc(int docId) throws IOException {
ordinalToAssociationMap.clear();
boolean docContainsAssociations = false;
try {
docContainsAssociations = fetchAssociations(docId);
} catch (IOException e) {
IOException ioe = new IOException(
"An Error occured while reading a document's associations payload (docId="
+ docId + ")");
ioe.initCause(e);
throw ioe;
}
return docContainsAssociations;
}
| boolean function(int docId) throws IOException { ordinalToAssociationMap.clear(); boolean docContainsAssociations = false; try { docContainsAssociations = fetchAssociations(docId); } catch (IOException e) { IOException ioe = new IOException( STR + docId + ")"); ioe.initCause(e); throw ioe; } return docContainsAssociations; } | /**
* Skipping to the next document, fetching its associations & populating the
* map.
*
* @param docId
* document id to be skipped to
* @return true if the document contains associations and they were fetched
* correctly. false otherwise.
* @throws IOException
* on error
*/ | Skipping to the next document, fetching its associations & populating the map | setNextDoc | {
"repo_name": "terrancesnyder/solr-analytics",
"path": "lucene/facet/src/java/org/apache/lucene/facet/enhancements/association/AssociationsPayloadIterator.java",
"license": "apache-2.0",
"size": 7876
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,080,332 |
public void setTrackColor(@NonNull ColorStateList colorStateList) {
mTrack.setColorStateList(colorStateList);
} | void function(@NonNull ColorStateList colorStateList) { mTrack.setColorStateList(colorStateList); } | /**
* Sets the color of the seekbar scrubber
*
* @param colorStateList The ColorStateList the track will be changed to
*/ | Sets the color of the seekbar scrubber | setTrackColor | {
"repo_name": "AOrobator/discreteSeekBar",
"path": "library/src/main/java/org/adw/library/widgets/discreteseekbar/DiscreteSeekBar.java",
"license": "apache-2.0",
"size": 41578
} | [
"android.content.res.ColorStateList",
"android.support.annotation.NonNull"
] | import android.content.res.ColorStateList; import android.support.annotation.NonNull; | import android.content.res.*; import android.support.annotation.*; | [
"android.content",
"android.support"
] | android.content; android.support; | 964,930 |
public Engine execute() throws ScanAgentException {
Engine engine = null;
try {
engine = executeDependencyCheck();
if (this.generateReport) {
generateExternalReports(engine, new File(this.reportOutputDirectory));
}
if (this.showSummary) {
showSummary(engine.getDependencies());
}
if (this.failBuildOnCVSS <= 10) {
checkForFailure(engine.getDependencies());
}
} catch (DatabaseException ex) {
LOGGER.error(
"Unable to connect to the dependency-check database; analysis has stopped");
LOGGER.debug("", ex);
} finally {
Settings.cleanup(true);
if (engine != null) {
engine.cleanup();
}
}
return engine;
} | Engine function() throws ScanAgentException { Engine engine = null; try { engine = executeDependencyCheck(); if (this.generateReport) { generateExternalReports(engine, new File(this.reportOutputDirectory)); } if (this.showSummary) { showSummary(engine.getDependencies()); } if (this.failBuildOnCVSS <= 10) { checkForFailure(engine.getDependencies()); } } catch (DatabaseException ex) { LOGGER.error( STR); LOGGER.debug("", ex); } finally { Settings.cleanup(true); if (engine != null) { engine.cleanup(); } } return engine; } | /**
* Executes the dependency-check and generates the report.
*
* @return a reference to the engine used to perform the scan.
* @throws org.owasp.dependencycheck.exception.ScanAgentException thrown if there is an exception executing the scan.
*/ | Executes the dependency-check and generates the report | execute | {
"repo_name": "adilakhter/DependencyCheck",
"path": "dependency-check-core/src/main/java/org/owasp/dependencycheck/agent/DependencyCheckScanAgent.java",
"license": "apache-2.0",
"size": 31316
} | [
"java.io.File",
"org.owasp.dependencycheck.Engine",
"org.owasp.dependencycheck.data.nvdcve.DatabaseException",
"org.owasp.dependencycheck.exception.ScanAgentException",
"org.owasp.dependencycheck.utils.Settings"
] | import java.io.File; import org.owasp.dependencycheck.Engine; import org.owasp.dependencycheck.data.nvdcve.DatabaseException; import org.owasp.dependencycheck.exception.ScanAgentException; import org.owasp.dependencycheck.utils.Settings; | import java.io.*; import org.owasp.dependencycheck.*; import org.owasp.dependencycheck.data.nvdcve.*; import org.owasp.dependencycheck.exception.*; import org.owasp.dependencycheck.utils.*; | [
"java.io",
"org.owasp.dependencycheck"
] | java.io; org.owasp.dependencycheck; | 627,817 |
List<Attribute> getAttributes(PerunSession sess, Member member, boolean workWithUserAttributes); | List<Attribute> getAttributes(PerunSession sess, Member member, boolean workWithUserAttributes); | /**
* Get all <b>non-empty</b> attributes associated with the member and if workWithUserAttributes is
* true, get all <b>non-empty</b> attributes associated with user, who is this member.
*
* @param sess perun session
* @param member to get the attributes from
* @return list of attributes
*
* @throws InternalErrorException if an exception raise in concrete implementation, the exception is wrapped in InternalErrorException
*/ | Get all non-empty attributes associated with the member and if workWithUserAttributes is true, get all non-empty attributes associated with user, who is this member | getAttributes | {
"repo_name": "zlamalp/perun",
"path": "perun-core/src/main/java/cz/metacentrum/perun/core/bl/AttributesManagerBl.java",
"license": "bsd-2-clause",
"size": 244560
} | [
"cz.metacentrum.perun.core.api.Attribute",
"cz.metacentrum.perun.core.api.Member",
"cz.metacentrum.perun.core.api.PerunSession",
"java.util.List"
] | import cz.metacentrum.perun.core.api.Attribute; import cz.metacentrum.perun.core.api.Member; import cz.metacentrum.perun.core.api.PerunSession; import java.util.List; | import cz.metacentrum.perun.core.api.*; import java.util.*; | [
"cz.metacentrum.perun",
"java.util"
] | cz.metacentrum.perun; java.util; | 1,813,911 |
protected void defineFilter(Context ctx, String name,
String classname, Map<String,String> parameters, String[] urls) {
FilterHolder holder = new FilterHolder();
holder.setName(name);
holder.setClassName(classname);
holder.setInitParameters(parameters);
FilterMapping fmap = new FilterMapping();
fmap.setPathSpecs(urls);
fmap.setDispatches(Handler.ALL);
fmap.setFilterName(name);
ServletHandler handler = ctx.getServletHandler();
handler.addFilter(holder, fmap);
} | void function(Context ctx, String name, String classname, Map<String,String> parameters, String[] urls) { FilterHolder holder = new FilterHolder(); holder.setName(name); holder.setClassName(classname); holder.setInitParameters(parameters); FilterMapping fmap = new FilterMapping(); fmap.setPathSpecs(urls); fmap.setDispatches(Handler.ALL); fmap.setFilterName(name); ServletHandler handler = ctx.getServletHandler(); handler.addFilter(holder, fmap); } | /**
* Define a filter for a context and set up default url mappings.
*/ | Define a filter for a context and set up default url mappings | defineFilter | {
"repo_name": "daniarherikurniawan/Chameleon512",
"path": "src/core/org/apache/hadoop/http/HttpServer.java",
"license": "apache-2.0",
"size": 18270
} | [
"java.util.Map",
"org.mortbay.jetty.Handler",
"org.mortbay.jetty.servlet.Context",
"org.mortbay.jetty.servlet.FilterHolder",
"org.mortbay.jetty.servlet.FilterMapping",
"org.mortbay.jetty.servlet.ServletHandler"
] | import java.util.Map; import org.mortbay.jetty.Handler; import org.mortbay.jetty.servlet.Context; import org.mortbay.jetty.servlet.FilterHolder; import org.mortbay.jetty.servlet.FilterMapping; import org.mortbay.jetty.servlet.ServletHandler; | import java.util.*; import org.mortbay.jetty.*; import org.mortbay.jetty.servlet.*; | [
"java.util",
"org.mortbay.jetty"
] | java.util; org.mortbay.jetty; | 1,260,799 |
public boolean matchRecordType(DNSRecordType recordType) {
return this.getRecordType().equals(recordType);
} | boolean function(DNSRecordType recordType) { return this.getRecordType().equals(recordType); } | /**
* Check if the requested record tyep match the current record type
*
* @param recordType
* @return <code>true</code> if the two entries have compatible type, <code>false</code> otherwise
*/ | Check if the requested record tyep match the current record type | matchRecordType | {
"repo_name": "jmdns/jmdns",
"path": "src/main/java/javax/jmdns/impl/DNSEntry.java",
"license": "apache-2.0",
"size": 10432
} | [
"javax.jmdns.impl.constants.DNSRecordType"
] | import javax.jmdns.impl.constants.DNSRecordType; | import javax.jmdns.impl.constants.*; | [
"javax.jmdns"
] | javax.jmdns; | 444,080 |
public BigDecimal getStep() {
return step;
} | BigDecimal function() { return step; } | /**
* Returns the step size.
*
* @return step size
*/ | Returns the step size | getStep | {
"repo_name": "adimova/smarthome",
"path": "bundles/core/org.eclipse.smarthome.core/src/main/java/org/eclipse/smarthome/core/types/StateDescription.java",
"license": "epl-1.0",
"size": 3200
} | [
"java.math.BigDecimal"
] | import java.math.BigDecimal; | import java.math.*; | [
"java.math"
] | java.math; | 2,540,696 |
public final void setSideEffectFlags(int flags) {
checkState(
this.isCall() || this.isOptChainCall() || this.isNew() || this.isTaggedTemplateLit(),
"Side-effect flags can only be set on invocation nodes; got %s",
this);
// We invert the flags before setting because we also invert the them when getting; they go
// full circle.
//
// We apply the mask after inversion so that if all flags are being set (all 1s), it's
// equivalent to storing a 0, the default value of an int-prop, which has no memory cost.
putIntProp(Prop.SIDE_EFFECT_FLAGS, ~flags & SideEffectFlags.USED_BITS_MASK);
} | final void function(int flags) { checkState( this.isCall() this.isOptChainCall() this.isNew() this.isTaggedTemplateLit(), STR, this); putIntProp(Prop.SIDE_EFFECT_FLAGS, ~flags & SideEffectFlags.USED_BITS_MASK); } | /**
* Marks this function or constructor call's side effect flags.
* This property is only meaningful for {@link Token#CALL} and
* {@link Token#NEW} nodes.
*/ | Marks this function or constructor call's side effect flags. This property is only meaningful for <code>Token#CALL</code> and <code>Token#NEW</code> nodes | setSideEffectFlags | {
"repo_name": "vobruba-martin/closure-compiler",
"path": "src/com/google/javascript/rhino/Node.java",
"license": "apache-2.0",
"size": 112945
} | [
"com.google.common.base.Preconditions"
] | import com.google.common.base.Preconditions; | import com.google.common.base.*; | [
"com.google.common"
] | com.google.common; | 2,069,363 |
public static int totalThreadCount() {
return getThreadMXBean().getThreadCount();
} | static int function() { return getThreadMXBean().getThreadCount(); } | /**
* Get the total number of threads.
*
* @return total number of threads
*/ | Get the total number of threads | totalThreadCount | {
"repo_name": "mikkokar/styx",
"path": "system-tests/e2e-testsupport/src/main/java/com/hotels/styx/threads/Threads.java",
"license": "apache-2.0",
"size": 1738
} | [
"java.lang.management.ManagementFactory"
] | import java.lang.management.ManagementFactory; | import java.lang.management.*; | [
"java.lang"
] | java.lang; | 245,904 |
static public VoltXMLDiff computeDiff(VoltXMLElement before, VoltXMLElement after)
{
// Top level call needs both names to match (I think this makes sense)
if (!before.getUniqueName().equals(after.getUniqueName())) {
// not sure this is best behavior, ponder as progress is made
return null;
}
VoltXMLDiff result = new VoltXMLDiff(before.getUniqueName());
// Short-circuit check for any differences first. Can return early if there are no changes
if (before.toMinString().equals(after.toMinString())) {
return result;
}
// Store the final desired element order
for (int i = 0; i < after.children.size(); i++) {
VoltXMLElement child = after.children.get(i);
result.m_elementOrder.put(child.getUniqueName(), i);
}
// first, check the attributes
Set<String> firstKeys = before.attributes.keySet();
Set<String> secondKeys = new HashSet<String>();
secondKeys.addAll(after.attributes.keySet());
// Do removed and changed attributes walking the first element's attributes
for (String firstKey : firstKeys) {
if (!secondKeys.contains(firstKey)) {
result.m_removedAttributes.add(firstKey);
}
else if (!(after.attributes.get(firstKey).equals(before.attributes.get(firstKey)))) {
result.m_changedAttributes.put(firstKey, after.attributes.get(firstKey));
}
// remove the firstKey from secondKeys to track things added
secondKeys.remove(firstKey);
}
// everything in secondKeys should be something added
for (String key : secondKeys) {
result.m_addedAttributes.put(key, after.attributes.get(key));
}
// Now, need to check the children. Each pair of children with the same names
// need to be descended to look for changes
// Probably more efficient ways to do this, but brute force it for now
// Would be helpful if the underlying children objects were Maps rather than
// Lists.
Set<String> firstChildren = new HashSet<String>();
for (VoltXMLElement child : before.children) {
firstChildren.add(child.getUniqueName());
}
Set<String> secondChildren = new HashSet<String>();
for (VoltXMLElement child : after.children) {
secondChildren.add(child.getUniqueName());
}
Set<String> commonNames = new HashSet<String>();
for (VoltXMLElement firstChild : before.children) {
if (!secondChildren.contains(firstChild.getUniqueName())) {
// Need to duplicate the
result.m_removedElements.add(firstChild);
}
else {
commonNames.add(firstChild.getUniqueName());
}
}
for (VoltXMLElement secondChild : after.children) {
if (!firstChildren.contains(secondChild.getUniqueName())) {
result.m_addedElements.add(secondChild);
}
else {
assert(commonNames.contains(secondChild.getUniqueName()));
}
}
// This set contains uniquenames
for (String name : commonNames) {
VoltXMLDiff childDiff = computeDiff(before.findChild(name), after.findChild(name));
if (!childDiff.isEmpty()) {
result.m_changedElements.put(name, childDiff);
}
}
return result;
} | static VoltXMLDiff function(VoltXMLElement before, VoltXMLElement after) { if (!before.getUniqueName().equals(after.getUniqueName())) { return null; } VoltXMLDiff result = new VoltXMLDiff(before.getUniqueName()); if (before.toMinString().equals(after.toMinString())) { return result; } for (int i = 0; i < after.children.size(); i++) { VoltXMLElement child = after.children.get(i); result.m_elementOrder.put(child.getUniqueName(), i); } Set<String> firstKeys = before.attributes.keySet(); Set<String> secondKeys = new HashSet<String>(); secondKeys.addAll(after.attributes.keySet()); for (String firstKey : firstKeys) { if (!secondKeys.contains(firstKey)) { result.m_removedAttributes.add(firstKey); } else if (!(after.attributes.get(firstKey).equals(before.attributes.get(firstKey)))) { result.m_changedAttributes.put(firstKey, after.attributes.get(firstKey)); } secondKeys.remove(firstKey); } for (String key : secondKeys) { result.m_addedAttributes.put(key, after.attributes.get(key)); } Set<String> firstChildren = new HashSet<String>(); for (VoltXMLElement child : before.children) { firstChildren.add(child.getUniqueName()); } Set<String> secondChildren = new HashSet<String>(); for (VoltXMLElement child : after.children) { secondChildren.add(child.getUniqueName()); } Set<String> commonNames = new HashSet<String>(); for (VoltXMLElement firstChild : before.children) { if (!secondChildren.contains(firstChild.getUniqueName())) { result.m_removedElements.add(firstChild); } else { commonNames.add(firstChild.getUniqueName()); } } for (VoltXMLElement secondChild : after.children) { if (!firstChildren.contains(secondChild.getUniqueName())) { result.m_addedElements.add(secondChild); } else { assert(commonNames.contains(secondChild.getUniqueName())); } } for (String name : commonNames) { VoltXMLDiff childDiff = computeDiff(before.findChild(name), after.findChild(name)); if (!childDiff.isEmpty()) { result.m_changedElements.put(name, childDiff); } } return result; } | /**
* Compute the diff necessary to turn the 'before' tree into the 'after'
* tree.
*/ | Compute the diff necessary to turn the 'before' tree into the 'after' tree | computeDiff | {
"repo_name": "wolffcm/voltdb",
"path": "src/hsqldb19b3/org/hsqldb_voltpatches/VoltXMLElement.java",
"license": "agpl-3.0",
"size": 14659
} | [
"java.util.HashSet",
"java.util.Set"
] | import java.util.HashSet; import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 471,282 |
public static void removeAuthenticationRequestFromCache(String key) {
if (key != null) {
AuthenticationRequestCacheKey cacheKey = new AuthenticationRequestCacheKey(key);
AuthenticationRequestCache.getInstance().clearCacheEntry(cacheKey);
}
} | static void function(String key) { if (key != null) { AuthenticationRequestCacheKey cacheKey = new AuthenticationRequestCacheKey(key); AuthenticationRequestCache.getInstance().clearCacheEntry(cacheKey); } } | /**
* removes authentication request from cache.
*
* @param key SessionDataKey
*/ | removes authentication request from cache | removeAuthenticationRequestFromCache | {
"repo_name": "dharshanaw/carbon-identity-framework",
"path": "components/authentication-framework/org.wso2.carbon.identity.application.authentication.framework/src/main/java/org/wso2/carbon/identity/application/authentication/framework/util/FrameworkUtils.java",
"license": "apache-2.0",
"size": 55252
} | [
"org.wso2.carbon.identity.application.authentication.framework.cache.AuthenticationRequestCache",
"org.wso2.carbon.identity.application.authentication.framework.cache.AuthenticationRequestCacheKey"
] | import org.wso2.carbon.identity.application.authentication.framework.cache.AuthenticationRequestCache; import org.wso2.carbon.identity.application.authentication.framework.cache.AuthenticationRequestCacheKey; | import org.wso2.carbon.identity.application.authentication.framework.cache.*; | [
"org.wso2.carbon"
] | org.wso2.carbon; | 2,545,986 |
@Test
public void testParseParameterTypesDistinction() throws ParseException, ExpanderException {
String str = "pckg.AClass#method1[Generator1()] <= pckg.AClass#method2()[Generator1()]";
ParserContext context = initContext();
Parser.parseAndExpandFormula(str, context);
assertEquals(0, context.getErrors().size());
assertEquals(0, context.getWarnings().size());
ReturningSet<Method> methods = context.getMethods();
for (Method method : methods) {
if ("method1".equals(method.getName())) {
assertEquals(method.getDeclarated(), Method.DeclarationType.WITHOUT_PARAMETERS);
assertEquals(0, method.getParameterTypes().size());
} else if ("method2".equals(method.getName())) {
assertEquals(method.getDeclarated(), Method.DeclarationType.WITH_PARAMETERS);
assertEquals(0, method.getParameterTypes().size());
}
}
} | void function() throws ParseException, ExpanderException { String str = STR; ParserContext context = initContext(); Parser.parseAndExpandFormula(str, context); assertEquals(0, context.getErrors().size()); assertEquals(0, context.getWarnings().size()); ReturningSet<Method> methods = context.getMethods(); for (Method method : methods) { if (STR.equals(method.getName())) { assertEquals(method.getDeclarated(), Method.DeclarationType.WITHOUT_PARAMETERS); assertEquals(0, method.getParameterTypes().size()); } else if (STR.equals(method.getName())) { assertEquals(method.getDeclarated(), Method.DeclarationType.WITH_PARAMETERS); assertEquals(0, method.getParameterTypes().size()); } } } | /**
* Checking that parser recognize that method does not have declared
* parameter types and the second event is that it has declared zero
* parameters.
*
* @throws ExpanderException
*/ | Checking that parser recognize that method does not have declared parameter types and the second event is that it has declared zero parameters | testParseParameterTypesDistinction | {
"repo_name": "lottie-c/spl_tests_new",
"path": "src/test/junit/cz/cuni/mff/spl/formula/parser/ParserStructureTest.java",
"license": "bsd-3-clause",
"size": 36480
} | [
"cz.cuni.mff.spl.annotation.Method",
"cz.cuni.mff.spl.formula.context.ParserContext",
"cz.cuni.mff.spl.formula.expander.Expander",
"cz.cuni.mff.spl.utils.ReturningSet",
"org.junit.Assert"
] | import cz.cuni.mff.spl.annotation.Method; import cz.cuni.mff.spl.formula.context.ParserContext; import cz.cuni.mff.spl.formula.expander.Expander; import cz.cuni.mff.spl.utils.ReturningSet; import org.junit.Assert; | import cz.cuni.mff.spl.annotation.*; import cz.cuni.mff.spl.formula.context.*; import cz.cuni.mff.spl.formula.expander.*; import cz.cuni.mff.spl.utils.*; import org.junit.*; | [
"cz.cuni.mff",
"org.junit"
] | cz.cuni.mff; org.junit; | 2,859,430 |
final JPanel content = new TextBlockPanel("This is some really long text that we will use "
+ "for testing purposes. You'll need to resize the window to see how the TextBlock "
+ "is dynamically updated. Also note what happens when there is a really long "
+ "word like ABCDEFGHIJKLMNOPQRSTUVWXYZ (OK, that's not really a word).",
new Font("Serif", Font.PLAIN, 14));
return content;
}
| final JPanel content = new TextBlockPanel(STR + STR + STR + STR, new Font("Serif", Font.PLAIN, 14)); return content; } | /**
* Creates the content pane for the demo frame.
*
* @return The content pane.
*/ | Creates the content pane for the demo frame | createContentPane | {
"repo_name": "nologic/nabs",
"path": "client/trunk/shared/libraries/jcommon-1.0.10/source/org/jfree/demo/TextBlockDemo.java",
"license": "gpl-2.0",
"size": 3129
} | [
"java.awt.Font",
"javax.swing.JPanel"
] | import java.awt.Font; import javax.swing.JPanel; | import java.awt.*; import javax.swing.*; | [
"java.awt",
"javax.swing"
] | java.awt; javax.swing; | 783,829 |
public Date getLastModifiedDate() {
return lastModifiedDate;
} | Date function() { return lastModifiedDate; } | /**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column deploy_agent.last_modified_date
*
* @return the value of deploy_agent.last_modified_date
* @mbggenerated
*/ | This method was generated by MyBatis Generator. This method returns the value of the database column deploy_agent.last_modified_date | getLastModifiedDate | {
"repo_name": "leonindy/camel",
"path": "camel-admin/src/main/java/com/dianping/phoenix/lb/deploy/model/DeployAgent.java",
"license": "gpl-3.0",
"size": 7152
} | [
"java.util.Date"
] | import java.util.Date; | import java.util.*; | [
"java.util"
] | java.util; | 1,431,844 |
// -----------------------------------------------------------------
public void addAppliesToType(DatabaseType t) {
appliesToTypes.add(t);
} | void function(DatabaseType t) { appliesToTypes.add(t); } | /**
* Add another database type to the list of types that this test case
* applies to.
*
* @param t
* The new type.
*/ | Add another database type to the list of types that this test case applies to | addAppliesToType | {
"repo_name": "Ensembl/ensj-healthcheck",
"path": "src/org/ensembl/healthcheck/testcase/EnsTestCase.java",
"license": "apache-2.0",
"size": 70295
} | [
"org.ensembl.healthcheck.DatabaseType"
] | import org.ensembl.healthcheck.DatabaseType; | import org.ensembl.healthcheck.*; | [
"org.ensembl.healthcheck"
] | org.ensembl.healthcheck; | 2,185,285 |
public BlendMode getBlendMode()
{
return blendMode;
} | BlendMode function() { return blendMode; } | /**
* Returns the current blend mode
*
* @return the current blend mode
*/ | Returns the current blend mode | getBlendMode | {
"repo_name": "ZhenyaM/veraPDF-pdfbox",
"path": "pdfbox/src/main/java/org/apache/pdfbox/pdmodel/graphics/state/PDGraphicsState.java",
"license": "apache-2.0",
"size": 14457
} | [
"org.apache.pdfbox.pdmodel.graphics.blend.BlendMode"
] | import org.apache.pdfbox.pdmodel.graphics.blend.BlendMode; | import org.apache.pdfbox.pdmodel.graphics.blend.*; | [
"org.apache.pdfbox"
] | org.apache.pdfbox; | 2,911,431 |
public final Node getNode(int nodeType,
Object arg1,
Object arg2,
Object arg3,
Object arg4,
Object arg5,
Object arg6,
Object arg7,
Object arg8,
Object arg9,
Object arg10,
Object arg11,
Object arg12,
ContextManager cm)
throws StandardException
{
Node retval = getNode(nodeType, cm);
retval.init(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9,
arg10, arg11, arg12);
return retval;
} | final Node function(int nodeType, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6, Object arg7, Object arg8, Object arg9, Object arg10, Object arg11, Object arg12, ContextManager cm) throws StandardException { Node retval = getNode(nodeType, cm); retval.init(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12); return retval; } | /**
* Get a node that takes twelve initializer arguments.
*
* @param nodeType Identifier for the type of node.
* @param arg1 An initializer argument
* @param arg2 An initializer argument
* @param arg3 An initializer argument
* @param arg4 An initializer argument
* @param arg5 An initializer argument
* @param arg6 An initializer argument
* @param arg7 An initializer argument
* @param arg8 An initializer argument
* @param arg9 An initializer argument
* @param arg10 An initializer argument
* @param arg11 An initializer argument
* @param arg12 An initializer argument
* @param cm A ContextManager
*
* @return A new QueryTree node.
*
* @exception StandardException Thrown on error.
*/ | Get a node that takes twelve initializer arguments | getNode | {
"repo_name": "viaper/DBPlus",
"path": "DerbyHodgepodge/java/engine/org/apache/derby/iapi/sql/compile/NodeFactory.java",
"license": "apache-2.0",
"size": 14899
} | [
"org.apache.derby.iapi.error.StandardException",
"org.apache.derby.iapi.services.context.ContextManager"
] | import org.apache.derby.iapi.error.StandardException; import org.apache.derby.iapi.services.context.ContextManager; | import org.apache.derby.iapi.error.*; import org.apache.derby.iapi.services.context.*; | [
"org.apache.derby"
] | org.apache.derby; | 414,326 |
public void setChannelFamilies(Set<ChannelFamily> channelFamiliesIn) {
if (channelFamiliesIn.size() > 1) {
throw new TooManyChannelFamiliesException(this.getId(),
"A channel can only have one channel family");
}
this.channelFamilies = channelFamiliesIn;
} | void function(Set<ChannelFamily> channelFamiliesIn) { if (channelFamiliesIn.size() > 1) { throw new TooManyChannelFamiliesException(this.getId(), STR); } this.channelFamilies = channelFamiliesIn; } | /**
* Sets the channelFamilies set for this channel
* @param channelFamiliesIn The set of channelFamilies
*/ | Sets the channelFamilies set for this channel | setChannelFamilies | {
"repo_name": "xkollar/spacewalk",
"path": "java/code/src/com/redhat/rhn/domain/channel/Channel.java",
"license": "gpl-2.0",
"size": 21863
} | [
"java.util.Set"
] | import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 1,587,270 |
ResourceProfile getResourceProfile(); | ResourceProfile getResourceProfile(); | /**
* Get resource profile of this slot.
*
* @return resource profile of this slot
*/ | Get resource profile of this slot | getResourceProfile | {
"repo_name": "apache/flink",
"path": "flink-runtime/src/main/java/org/apache/flink/runtime/resourcemanager/slotmanager/TaskManagerSlotInformation.java",
"license": "apache-2.0",
"size": 2127
} | [
"org.apache.flink.runtime.clusterframework.types.ResourceProfile"
] | import org.apache.flink.runtime.clusterframework.types.ResourceProfile; | import org.apache.flink.runtime.clusterframework.types.*; | [
"org.apache.flink"
] | org.apache.flink; | 1,263,943 |
public void testResponsesComplete2() {
GroupRequest<Integer> req=new GroupRequest<Integer>(null, null, Arrays.asList(a,b,c), RequestOptions.SYNC());
req.suspect(a);
checkComplete(req, false);
req.receiveResponse(1, a, false);
checkComplete(req, false);
req.receiveResponse(2, b, false);
checkComplete(req, false);
req.suspect(b);
checkComplete(req, false);
req.receiveResponse(3, c, false);
req.suspect(c);
checkComplete(req, true);
} | void function() { GroupRequest<Integer> req=new GroupRequest<Integer>(null, null, Arrays.asList(a,b,c), RequestOptions.SYNC()); req.suspect(a); checkComplete(req, false); req.receiveResponse(1, a, false); checkComplete(req, false); req.receiveResponse(2, b, false); checkComplete(req, false); req.suspect(b); checkComplete(req, false); req.receiveResponse(3, c, false); req.suspect(c); checkComplete(req, true); } | /**
* Verifies that a received *and* suspected flag on a Rsp counts only once, to prevent premature termination of
* a blocking RPC. https://issues.jboss.org/browse/JGRP-1505
*/ | Verifies that a received *and* suspected flag on a Rsp counts only once, to prevent premature termination of a blocking RPC. HREF | testResponsesComplete2 | {
"repo_name": "ibrahimshbat/JGroups",
"path": "tests/junit-functional/org/jgroups/blocks/GroupRequestTest.java",
"license": "apache-2.0",
"size": 15682
} | [
"java.util.Arrays"
] | import java.util.Arrays; | import java.util.*; | [
"java.util"
] | java.util; | 2,706,918 |
@ServiceMethod(returns = ReturnType.SINGLE)
Mono<KubeEnvironmentInner> createOrUpdateAsync(
String resourceGroupName, String name, KubeEnvironmentInner kubeEnvironmentEnvelope); | @ServiceMethod(returns = ReturnType.SINGLE) Mono<KubeEnvironmentInner> createOrUpdateAsync( String resourceGroupName, String name, KubeEnvironmentInner kubeEnvironmentEnvelope); | /**
* Description for Creates or updates a Kubernetes Environment.
*
* @param resourceGroupName Name of the resource group to which the resource belongs.
* @param name Name of the Kubernetes Environment.
* @param kubeEnvironmentEnvelope Configuration details of the Kubernetes Environment.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.appservice.models.DefaultErrorResponseErrorException thrown if the request is
* rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a Kubernetes cluster specialized for web workloads by Azure App Service on successful completion of
* {@link Mono}.
*/ | Description for Creates or updates a Kubernetes Environment | createOrUpdateAsync | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/resourcemanager/azure-resourcemanager-appservice/src/main/java/com/azure/resourcemanager/appservice/fluent/KubeEnvironmentsClient.java",
"license": "mit",
"size": 25824
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.resourcemanager.appservice.fluent.models.KubeEnvironmentInner"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.resourcemanager.appservice.fluent.models.KubeEnvironmentInner; | import com.azure.core.annotation.*; import com.azure.resourcemanager.appservice.fluent.models.*; | [
"com.azure.core",
"com.azure.resourcemanager"
] | com.azure.core; com.azure.resourcemanager; | 1,041,753 |
@Nullable private IgniteUuid fileId(IgfsPath path, boolean skipTx) throws IgniteCheckedException {
List<IgniteUuid> ids = fileIds(path, skipTx);
assert ids != null && !ids.isEmpty() : "Invalid file IDs [path=" + path + ", ids=" + ids + ']';
return ids.get(ids.size() - 1);
} | @Nullable IgniteUuid function(IgfsPath path, boolean skipTx) throws IgniteCheckedException { List<IgniteUuid> ids = fileIds(path, skipTx); assert ids != null && !ids.isEmpty() : STR + path + STR + ids + ']'; return ids.get(ids.size() - 1); } | /**
* Gets file ID for specified path possibly skipping existing transaction.
*
* @param path Path.
* @param skipTx Whether to skip existing transaction.
* @return File ID for specified path or {@code null} if such file doesn't exist.
* @throws IgniteCheckedException If failed.
*/ | Gets file ID for specified path possibly skipping existing transaction | fileId | {
"repo_name": "zzcclp/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManager.java",
"license": "apache-2.0",
"size": 123208
} | [
"java.util.List",
"org.apache.ignite.IgniteCheckedException",
"org.apache.ignite.igfs.IgfsPath",
"org.apache.ignite.lang.IgniteUuid",
"org.jetbrains.annotations.Nullable"
] | import java.util.List; import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.igfs.IgfsPath; import org.apache.ignite.lang.IgniteUuid; import org.jetbrains.annotations.Nullable; | import java.util.*; import org.apache.ignite.*; import org.apache.ignite.igfs.*; import org.apache.ignite.lang.*; import org.jetbrains.annotations.*; | [
"java.util",
"org.apache.ignite",
"org.jetbrains.annotations"
] | java.util; org.apache.ignite; org.jetbrains.annotations; | 2,879,517 |
public PlanElement nextSafeAction(String intention, PlanParameter param, Desire des) {
prepareKnowhow(intention, param, des);
PlanElement candidate = null;
ViolatesResult res = new ViolatesResult(false);
while(!res.isAlright()) {
candidate = iterateKnowhow(param, des);
if(candidate == null)
return null;
if(Boolean.parseBoolean(param.getSetting("allowUnsafe", String.valueOf(false))))
return candidate;
OperatorCallWrapper vop = param.getAgent().getOperators().getPreferedByType(ViolatesOperator.OPERATION_NAME);
EvaluateParameter eparam = new EvaluateParameter(param.getAgent(), param.getAgent().getBeliefs(), candidate);
res = (ViolatesResult) vop.process(eparam);
if(!res.isAlright())
lastUsedStrategy.fallback();
}
return candidate;
}
| PlanElement function(String intention, PlanParameter param, Desire des) { prepareKnowhow(intention, param, des); PlanElement candidate = null; ViolatesResult res = new ViolatesResult(false); while(!res.isAlright()) { candidate = iterateKnowhow(param, des); if(candidate == null) return null; if(Boolean.parseBoolean(param.getSetting(STR, String.valueOf(false)))) return candidate; OperatorCallWrapper vop = param.getAgent().getOperators().getPreferedByType(ViolatesOperator.OPERATION_NAME); EvaluateParameter eparam = new EvaluateParameter(param.getAgent(), param.getAgent().getBeliefs(), candidate); res = (ViolatesResult) vop.process(eparam); if(!res.isAlright()) lastUsedStrategy.fallback(); } return candidate; } | /**
* Finds the next safe action by appying different knowhow processes until a action is found which
* does not violates secrecy.
* @param intention The intitial intention for searching the next safe action
* @param param The subgoal generation parameter data structrue
* @param des The desire which will be fulfilled by the next safe action.
* @return A plan element containing a safe atomic action.
*/ | Finds the next safe action by appying different knowhow processes until a action is found which does not violates secrecy | nextSafeAction | {
"repo_name": "Angerona/angerona-framework",
"path": "knowhow/src/main/java/com/github/angerona/knowhow/asp/KnowhowASP.java",
"license": "gpl-3.0",
"size": 19968
} | [
"com.github.angerona.fw.Desire",
"com.github.angerona.fw.PlanElement",
"com.github.angerona.fw.am.secrecy.operators.ViolatesResult",
"com.github.angerona.fw.am.secrecy.operators.parameter.PlanParameter",
"com.github.angerona.fw.example.operators.ViolatesOperator",
"com.github.angerona.fw.operators.OperatorCallWrapper",
"com.github.angerona.fw.operators.parameter.EvaluateParameter"
] | import com.github.angerona.fw.Desire; import com.github.angerona.fw.PlanElement; import com.github.angerona.fw.am.secrecy.operators.ViolatesResult; import com.github.angerona.fw.am.secrecy.operators.parameter.PlanParameter; import com.github.angerona.fw.example.operators.ViolatesOperator; import com.github.angerona.fw.operators.OperatorCallWrapper; import com.github.angerona.fw.operators.parameter.EvaluateParameter; | import com.github.angerona.fw.*; import com.github.angerona.fw.am.secrecy.operators.*; import com.github.angerona.fw.am.secrecy.operators.parameter.*; import com.github.angerona.fw.example.operators.*; import com.github.angerona.fw.operators.*; import com.github.angerona.fw.operators.parameter.*; | [
"com.github.angerona"
] | com.github.angerona; | 1,746,380 |
public void createELFRelocObject(Map<Symbol, List<Relocation>> relocationTable, Collection<Symbol> symbols) throws IOException {
// Allocate ELF Header
ElfHeader eh = new ElfHeader();
ArrayList<ElfSection> sections = new ArrayList<>();
// Create the null section
createByteSection(sections, null, null, false, 1, 0, 0);
// Create text section
createCodeSection(sections, binContainer.getCodeContainer());
createReadOnlySection(sections, binContainer.getMetaspaceNamesContainer());
createReadOnlySection(sections, binContainer.getKlassesOffsetsContainer());
createReadOnlySection(sections, binContainer.getMethodsOffsetsContainer());
createReadOnlySection(sections, binContainer.getKlassesDependenciesContainer());
createReadOnlySection(sections, binContainer.getMethodMetadataContainer());
createReadOnlySection(sections, binContainer.getStubsOffsetsContainer());
createReadOnlySection(sections, binContainer.getHeaderContainer().getContainer());
createReadOnlySection(sections, binContainer.getCodeSegmentsContainer());
createReadOnlySection(sections, binContainer.getConstantDataContainer());
createReadOnlySection(sections, binContainer.getConfigContainer());
createReadWriteSection(sections, binContainer.getKlassesGotContainer());
createReadWriteSection(sections, binContainer.getCountersGotContainer());
createReadWriteSection(sections, binContainer.getMetadataGotContainer());
createReadWriteSection(sections, binContainer.getOopGotContainer());
createReadWriteSection(sections, binContainer.getMethodStateContainer());
createReadWriteSection(sections, binContainer.getExtLinkageGOTContainer());
// Get ELF symbol data from BinaryContainer object's symbol tables
ElfSymtab symtab = createELFSymbolTables(symbols);
// Create string table section and symbol table sections in
// that order since symtab section needs to set the index of
// strtab in sh_link field
ElfSection strTabSection = createByteSection(sections, ".strtab",
symtab.getStrtabArray(),
false, 1, 0,
Elf64_Shdr.SHT_STRTAB);
// Now create .symtab section with the symtab data constructed.
// On Linux, sh_link of symtab contains the index of string table
// its symbols reference and sh_info contains the index of first
// non-local symbol
ElfSection symTabSection = createByteSection(sections, ".symtab",
symtab.getSymtabArray(),
false, 8, 0,
Elf64_Shdr.SHT_SYMTAB);
symTabSection.setLink(strTabSection.getSectionId());
symTabSection.setInfo(symtab.getNumLocalSyms());
ElfRelocTable elfRelocTable = createElfRelocTable(sections, relocationTable);
createElfRelocSections(sections, elfRelocTable, symTabSection.getSectionId());
// Now, finally, after creating all sections, create shstrtab section
ElfSection shStrTabSection = createByteSection(sections, ".shstrtab",
null, false, 1, 0,
Elf64_Shdr.SHT_STRTAB);
eh.setSectionStrNdx(shStrTabSection.getSectionId());
// Update all section offsets and the Elf header section offset
// Write the Header followed by the contents of each section
// and then the section structures (section table).
int fileOffset = Elf64_Ehdr.totalsize;
// and round it up
fileOffset = (fileOffset + (sections.get(1).getDataAlign() - 1)) &
~((sections.get(1).getDataAlign() - 1));
// Calc file offsets for section data skipping null section
for (int i = 1; i < sections.size(); i++) {
ElfSection sect = sections.get(i);
fileOffset = (fileOffset + (sect.getDataAlign() - 1)) &
~((sect.getDataAlign() - 1));
sect.setOffset(fileOffset);
fileOffset += sect.getSize();
}
// Align the section table
fileOffset = (fileOffset + (ElfSection.getShdrAlign() - 1)) &
~((ElfSection.getShdrAlign() - 1));
// Update the Elf Header with the offset of the first Elf64_Shdr
// and the number of sections.
eh.setSectionOff(fileOffset);
eh.setSectionNum(sections.size());
// Write out the Header
elfContainer.writeBytes(eh.getArray());
// Write out each section contents skipping null section
for (int i = 1; i < sections.size(); i++) {
ElfSection sect = sections.get(i);
elfContainer.writeBytes(sect.getDataArray(), sect.getDataAlign());
}
// Write out the section table
for (int i = 0; i < sections.size(); i++) {
ElfSection sect = sections.get(i);
elfContainer.writeBytes(sect.getArray(), ElfSection.getShdrAlign());
}
elfContainer.close();
} | void function(Map<Symbol, List<Relocation>> relocationTable, Collection<Symbol> symbols) throws IOException { ElfHeader eh = new ElfHeader(); ArrayList<ElfSection> sections = new ArrayList<>(); createByteSection(sections, null, null, false, 1, 0, 0); createCodeSection(sections, binContainer.getCodeContainer()); createReadOnlySection(sections, binContainer.getMetaspaceNamesContainer()); createReadOnlySection(sections, binContainer.getKlassesOffsetsContainer()); createReadOnlySection(sections, binContainer.getMethodsOffsetsContainer()); createReadOnlySection(sections, binContainer.getKlassesDependenciesContainer()); createReadOnlySection(sections, binContainer.getMethodMetadataContainer()); createReadOnlySection(sections, binContainer.getStubsOffsetsContainer()); createReadOnlySection(sections, binContainer.getHeaderContainer().getContainer()); createReadOnlySection(sections, binContainer.getCodeSegmentsContainer()); createReadOnlySection(sections, binContainer.getConstantDataContainer()); createReadOnlySection(sections, binContainer.getConfigContainer()); createReadWriteSection(sections, binContainer.getKlassesGotContainer()); createReadWriteSection(sections, binContainer.getCountersGotContainer()); createReadWriteSection(sections, binContainer.getMetadataGotContainer()); createReadWriteSection(sections, binContainer.getOopGotContainer()); createReadWriteSection(sections, binContainer.getMethodStateContainer()); createReadWriteSection(sections, binContainer.getExtLinkageGOTContainer()); ElfSymtab symtab = createELFSymbolTables(symbols); ElfSection strTabSection = createByteSection(sections, STR, symtab.getStrtabArray(), false, 1, 0, Elf64_Shdr.SHT_STRTAB); ElfSection symTabSection = createByteSection(sections, STR, symtab.getSymtabArray(), false, 8, 0, Elf64_Shdr.SHT_SYMTAB); symTabSection.setLink(strTabSection.getSectionId()); symTabSection.setInfo(symtab.getNumLocalSyms()); ElfRelocTable elfRelocTable = createElfRelocTable(sections, relocationTable); createElfRelocSections(sections, elfRelocTable, symTabSection.getSectionId()); ElfSection shStrTabSection = createByteSection(sections, STR, null, false, 1, 0, Elf64_Shdr.SHT_STRTAB); eh.setSectionStrNdx(shStrTabSection.getSectionId()); int fileOffset = Elf64_Ehdr.totalsize; fileOffset = (fileOffset + (sections.get(1).getDataAlign() - 1)) & ~((sections.get(1).getDataAlign() - 1)); for (int i = 1; i < sections.size(); i++) { ElfSection sect = sections.get(i); fileOffset = (fileOffset + (sect.getDataAlign() - 1)) & ~((sect.getDataAlign() - 1)); sect.setOffset(fileOffset); fileOffset += sect.getSize(); } fileOffset = (fileOffset + (ElfSection.getShdrAlign() - 1)) & ~((ElfSection.getShdrAlign() - 1)); eh.setSectionOff(fileOffset); eh.setSectionNum(sections.size()); elfContainer.writeBytes(eh.getArray()); for (int i = 1; i < sections.size(); i++) { ElfSection sect = sections.get(i); elfContainer.writeBytes(sect.getDataArray(), sect.getDataAlign()); } for (int i = 0; i < sections.size(); i++) { ElfSection sect = sections.get(i); elfContainer.writeBytes(sect.getArray(), ElfSection.getShdrAlign()); } elfContainer.close(); } | /**
* Creates an ELF relocatable object.
*
* @param relocationTable
* @param symbols
* @throws IOException throws {@code IOException} as a result of file system access failures.
*/ | Creates an ELF relocatable object | createELFRelocObject | {
"repo_name": "md-5/jdk10",
"path": "src/jdk.aot/share/classes/jdk.tools.jaotc.binformat/src/jdk/tools/jaotc/binformat/elf/JELFRelocObject.java",
"license": "gpl-2.0",
"size": 13560
} | [
"java.io.IOException",
"java.util.ArrayList",
"java.util.Collection",
"java.util.List",
"java.util.Map"
] | import java.io.IOException; import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Map; | import java.io.*; import java.util.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 2,477,139 |
public static String formatApiDate(final DateTime date) {
Preconditions.checkNotNull(date);
return API_TIMESTAMP_FORMAT.print(date.toDateTime(DateTimeZone.UTC));
} | static String function(final DateTime date) { Preconditions.checkNotNull(date); return API_TIMESTAMP_FORMAT.print(date.toDateTime(DateTimeZone.UTC)); } | /**
* Converts the specified date to a timestamp in the MediaWiki API format
* and in the UTC time zone.
*
* @param date the date to convert
* @return the specified date as a UTC timestamp
*/ | Converts the specified date to a timestamp in the MediaWiki API format and in the UTC time zone | formatApiDate | {
"repo_name": "robinkrahl/org.ireas.mediawiki",
"path": "src/main/java/org/ireas/mediawiki/MediaWikiUtils.java",
"license": "mit",
"size": 9614
} | [
"com.google.common.base.Preconditions",
"org.joda.time.DateTime",
"org.joda.time.DateTimeZone"
] | import com.google.common.base.Preconditions; import org.joda.time.DateTime; import org.joda.time.DateTimeZone; | import com.google.common.base.*; import org.joda.time.*; | [
"com.google.common",
"org.joda.time"
] | com.google.common; org.joda.time; | 1,140,883 |
@Override
public void deleteBlob(String blobName) throws IOException {
throw new UnsupportedOperationException("URL repository is read only");
} | void function(String blobName) throws IOException { throw new UnsupportedOperationException(STR); } | /**
* This operation is not supported by URLBlobContainer
*/ | This operation is not supported by URLBlobContainer | deleteBlob | {
"repo_name": "coding0011/elasticsearch",
"path": "modules/repository-url/src/main/java/org/elasticsearch/common/blobstore/url/URLBlobContainer.java",
"license": "apache-2.0",
"size": 4685
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 941,320 |
public double tune(AbstractStochasticCachingDiffUpdateFunction function, double[] initial, int sampleSize, double seta) {
Timing timer = new Timing();
int[] sample = function.getSample(sampleSize);
double sobj = getObjective(function, initial, 1, sample);
double besteta = 1;
double bestobj = sobj;
double eta = seta;
int totest = 10;
double factor = 2;
boolean phase2 = false;
while (totest > 0 || !phase2)
{
double obj = tryEta(function, initial, sample, eta);
boolean okay = (obj < sobj);
sayln(" Trying eta=" + eta + " obj=" + obj + ((okay)? "(possible)":"(too large)"));
if (okay)
{
totest -= 1;
if (obj < bestobj) {
bestobj = obj;
besteta = eta;
}
}
if (! phase2)
{
if (okay) {
eta = eta * factor;
} else {
phase2 = true;
eta = seta;
}
}
if (phase2) {
eta = eta / factor;
}
}
// take it on the safe side (implicit regularization)
besteta /= factor;
// determine t
t0 = (int) (1 / (besteta * lambda));
sayln(" Taking eta=" + besteta + " t0=" + t0);
sayln(" Tuning completed in: " + Timing.toSecondsString(timer.report()) + " s");
return besteta;
} | double function(AbstractStochasticCachingDiffUpdateFunction function, double[] initial, int sampleSize, double seta) { Timing timer = new Timing(); int[] sample = function.getSample(sampleSize); double sobj = getObjective(function, initial, 1, sample); double besteta = 1; double bestobj = sobj; double eta = seta; int totest = 10; double factor = 2; boolean phase2 = false; while (totest > 0 !phase2) { double obj = tryEta(function, initial, sample, eta); boolean okay = (obj < sobj); sayln(STR + eta + STR + obj + ((okay)? STR:STR)); if (okay) { totest -= 1; if (obj < bestobj) { bestobj = obj; besteta = eta; } } if (! phase2) { if (okay) { eta = eta * factor; } else { phase2 = true; eta = seta; } } if (phase2) { eta = eta / factor; } } besteta /= factor; t0 = (int) (1 / (besteta * lambda)); sayln(STR + besteta + STR + t0); sayln(STR + Timing.toSecondsString(timer.report()) + STR); return besteta; } | /**
* Finds a good learning rate to start with.
* eta = 1/(lambda*(t0+t)) - we find good t0
* @param function
* @param initial
* @param sampleSize
* @param seta
*/ | Finds a good learning rate to start with. eta = 1/(lambda*(t0+t)) - we find good t0 | tune | {
"repo_name": "intfloat/CoreNLP",
"path": "src/edu/stanford/nlp/optimization/SGDMinimizer.java",
"license": "gpl-2.0",
"size": 11577
} | [
"edu.stanford.nlp.util.Timing"
] | import edu.stanford.nlp.util.Timing; | import edu.stanford.nlp.util.*; | [
"edu.stanford.nlp"
] | edu.stanford.nlp; | 878,089 |
public static void chooseProfile(Context context, int mode) {
AudioManager audio = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
if (mode == 0)
audio.setRingerMode(AudioManager.RINGER_MODE_SILENT);
else if (mode == 1)
audio.setRingerMode(AudioManager.RINGER_MODE_VIBRATE);
else if (mode == 2)
audio.setRingerMode(AudioManager.RINGER_MODE_NORMAL);
} | static void function(Context context, int mode) { AudioManager audio = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); if (mode == 0) audio.setRingerMode(AudioManager.RINGER_MODE_SILENT); else if (mode == 1) audio.setRingerMode(AudioManager.RINGER_MODE_VIBRATE); else if (mode == 2) audio.setRingerMode(AudioManager.RINGER_MODE_NORMAL); } | /**
* Changes mobile profile to "Silent" or "Vibrate" or "Normal" mode
*
* @param context
* @param mode types of mode - "0- Silent"
* - "1 - Vibrate"
* - "2 - Normal"
*/ | Changes mobile profile to "Silent" or "Vibrate" or "Normal" mode | chooseProfile | {
"repo_name": "CommonUtils/android",
"path": "common-task/src/main/java/com/common/utils/Common.java",
"license": "mit",
"size": 71901
} | [
"android.content.Context",
"android.media.AudioManager"
] | import android.content.Context; import android.media.AudioManager; | import android.content.*; import android.media.*; | [
"android.content",
"android.media"
] | android.content; android.media; | 447,266 |
@Override
public boolean deleteSingleTicket(final String ticketId) {
final Ticket ticket = getTicket(ticketId);
if (ticket == null) {
LOGGER.debug("Ticket [{}] cannot be retrieved from the cache", ticketId);
return true;
}
final TicketDefinition metadata = this.ticketCatalog.find(ticket);
final Ehcache cache = getTicketCacheFor(metadata);
if (cache.remove(encodeTicketId(ticket.getId()))) {
LOGGER.debug("Ticket [{}] is removed", ticket.getId());
}
return true;
} | boolean function(final String ticketId) { final Ticket ticket = getTicket(ticketId); if (ticket == null) { LOGGER.debug(STR, ticketId); return true; } final TicketDefinition metadata = this.ticketCatalog.find(ticket); final Ehcache cache = getTicketCacheFor(metadata); if (cache.remove(encodeTicketId(ticket.getId()))) { LOGGER.debug(STR, ticket.getId()); } return true; } | /**
* Either the element is removed from the cache
* or it's not found in the cache and is already removed.
* Thus the result of this op would always be true.
*/ | Either the element is removed from the cache or it's not found in the cache and is already removed. Thus the result of this op would always be true | deleteSingleTicket | {
"repo_name": "prigaux/cas",
"path": "support/cas-server-support-ehcache-ticket-registry/src/main/java/org/apereo/cas/ticket/registry/EhCacheTicketRegistry.java",
"license": "apache-2.0",
"size": 6271
} | [
"net.sf.ehcache.Ehcache",
"org.apereo.cas.ticket.Ticket",
"org.apereo.cas.ticket.TicketDefinition"
] | import net.sf.ehcache.Ehcache; import org.apereo.cas.ticket.Ticket; import org.apereo.cas.ticket.TicketDefinition; | import net.sf.ehcache.*; import org.apereo.cas.ticket.*; | [
"net.sf.ehcache",
"org.apereo.cas"
] | net.sf.ehcache; org.apereo.cas; | 758,231 |
public static final String printArray(ArrayList<?> array, String delimeter, boolean addSpaces) {
return printArray(array, delimeter, addSpaces, null);
} | static final String function(ArrayList<?> array, String delimeter, boolean addSpaces) { return printArray(array, delimeter, addSpaces, null); } | /**
* Generates a readable string representation the elements of the specified
* generic array without applying any kind of formatting.
*
* @param array the array to pring, as an ArrayList<?>
* @param delimeter the delimeter to use between array elements
* @param addSpaces if true, a space will be added between a delimeter and
* the subsequent array element
*
* @return the generate string representation, as a String
*/ | Generates a readable string representation the elements of the specified generic array without applying any kind of formatting | printArray | {
"repo_name": "ganast/xnumbers",
"path": "src/xnumbers/XNumbers.java",
"license": "gpl-3.0",
"size": 48155
} | [
"java.util.ArrayList"
] | import java.util.ArrayList; | import java.util.*; | [
"java.util"
] | java.util; | 2,874,215 |
public void cancel(AjaxRequestTarget ajaxRequestTarget)
{
sortableBehavior.cancel(ajaxRequestTarget);
} | void function(AjaxRequestTarget ajaxRequestTarget) { sortableBehavior.cancel(ajaxRequestTarget); } | /**
* Method to cancel within the ajax request
*
* @param ajaxRequestTarget
*/ | Method to cancel within the ajax request | cancel | {
"repo_name": "rasyahadlinugraha/wiquery",
"path": "wiquery-jquery-ui/src/main/java/org/odlabs/wiquery/ui/sortable/SortableAjaxBehavior.java",
"license": "mit",
"size": 27836
} | [
"org.apache.wicket.ajax.AjaxRequestTarget"
] | import org.apache.wicket.ajax.AjaxRequestTarget; | import org.apache.wicket.ajax.*; | [
"org.apache.wicket"
] | org.apache.wicket; | 1,705,370 |
public ContextEjb[] findEjbs(); | ContextEjb[] function(); | /**
* Return the defined EJB resource references for this application.
* If there are none, a zero-length array is returned.
*/ | Return the defined EJB resource references for this application. If there are none, a zero-length array is returned | findEjbs | {
"repo_name": "devjin24/howtomcatworks",
"path": "bookrefer/jakarta-tomcat-5.0.18-src/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/DefaultContext.java",
"license": "apache-2.0",
"size": 17854
} | [
"org.apache.catalina.deploy.ContextEjb"
] | import org.apache.catalina.deploy.ContextEjb; | import org.apache.catalina.deploy.*; | [
"org.apache.catalina"
] | org.apache.catalina; | 1,921,099 |
public void submitApplication(ApplicationId applicationId, String user,
String queue) throws AccessControlException; | void function(ApplicationId applicationId, String user, String queue) throws AccessControlException; | /**
* Submit a new application to the queue.
* @param applicationId the applicationId of the application being submitted
* @param user user who submitted the application
* @param queue queue to which the application is submitted
*/ | Submit a new application to the queue | submitApplication | {
"repo_name": "dennishuo/hadoop",
"path": "hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/CSQueue.java",
"license": "apache-2.0",
"size": 15066
} | [
"org.apache.hadoop.security.AccessControlException",
"org.apache.hadoop.yarn.api.records.ApplicationId"
] | import org.apache.hadoop.security.AccessControlException; import org.apache.hadoop.yarn.api.records.ApplicationId; | import org.apache.hadoop.security.*; import org.apache.hadoop.yarn.api.records.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 2,265,288 |
@Override
protected boolean handleObject(PrismObject<ShadowType> accountShadow, RunningTask workerTask, OperationResult result) {
long started = System.currentTimeMillis();
try {
workerTask.recordIterativeOperationStart(accountShadow.asObjectable());
boolean rv = handleObjectInternal(accountShadow, workerTask, result);
result.computeStatusIfUnknown();
if (result.isError()) {
workerTask.recordIterativeOperationEnd(accountShadow.asObjectable(), started, RepoCommonUtils.getResultException(result));
} else {
workerTask.recordIterativeOperationEnd(accountShadow.asObjectable(), started, null);
}
return rv;
} catch (Throwable t) {
workerTask.recordIterativeOperationEnd(accountShadow.asObjectable(), started, t);
throw t;
}
} | boolean function(PrismObject<ShadowType> accountShadow, RunningTask workerTask, OperationResult result) { long started = System.currentTimeMillis(); try { workerTask.recordIterativeOperationStart(accountShadow.asObjectable()); boolean rv = handleObjectInternal(accountShadow, workerTask, result); result.computeStatusIfUnknown(); if (result.isError()) { workerTask.recordIterativeOperationEnd(accountShadow.asObjectable(), started, RepoCommonUtils.getResultException(result)); } else { workerTask.recordIterativeOperationEnd(accountShadow.asObjectable(), started, null); } return rv; } catch (Throwable t) { workerTask.recordIterativeOperationEnd(accountShadow.asObjectable(), started, t); throw t; } } | /**
* This methods will be called for each search result. It means it will be
* called for each account on a resource. We will pretend that the account
* was created and invoke notification interface.
*/ | This methods will be called for each search result. It means it will be called for each account on a resource. We will pretend that the account was created and invoke notification interface | handleObject | {
"repo_name": "bshp/midPoint",
"path": "model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/sync/SynchronizeAccountResultHandler.java",
"license": "apache-2.0",
"size": 10204
} | [
"com.evolveum.midpoint.prism.PrismObject",
"com.evolveum.midpoint.repo.common.util.RepoCommonUtils",
"com.evolveum.midpoint.schema.result.OperationResult",
"com.evolveum.midpoint.task.api.RunningTask",
"com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType"
] | import com.evolveum.midpoint.prism.PrismObject; import com.evolveum.midpoint.repo.common.util.RepoCommonUtils; import com.evolveum.midpoint.schema.result.OperationResult; import com.evolveum.midpoint.task.api.RunningTask; import com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType; | import com.evolveum.midpoint.prism.*; import com.evolveum.midpoint.repo.common.util.*; import com.evolveum.midpoint.schema.result.*; import com.evolveum.midpoint.task.api.*; import com.evolveum.midpoint.xml.ns._public.common.common_3.*; | [
"com.evolveum.midpoint"
] | com.evolveum.midpoint; | 1,581,577 |
return Looper.myLooper() == handler.getLooper();
} | return Looper.myLooper() == handler.getLooper(); } | /**
* Checks whether the current thread is the same thread that the {@link Handler} is associated with.
*
* @return true if the current thread is the same thread that the {@link Handler} is associated with; otherwise false.
*/ | Checks whether the current thread is the same thread that the <code>Handler</code> is associated with | checkThreadAccess | {
"repo_name": "gavanx/learn-stetho",
"path": "stetho/src/main/java/com/facebook/stetho/common/android/HandlerUtil.java",
"license": "bsd-3-clause",
"size": 4696
} | [
"android.os.Looper"
] | import android.os.Looper; | import android.os.*; | [
"android.os"
] | android.os; | 2,823,117 |
public static boolean isPointOnScreen(Point p, int xOffset) {
Point moved = new Point(p.x + xOffset, p.y);
return isPointOnScreen(moved);
} | static boolean function(Point p, int xOffset) { Point moved = new Point(p.x + xOffset, p.y); return isPointOnScreen(moved); } | /**
* Checks if the given {@code Point} is on a screen. The point can be moved
* horizontally before checking by specifying a {@code xOffset}. The
* original point is not modified.
*
* @param p The {@code Point} to check
* @param xOffset The horizontal offset in pixels
* @return {@code true} if the point is on screen, {@code false} otherwise
*/ | Checks if the given Point is on a screen. The point can be moved horizontally before checking by specifying a xOffset. The original point is not modified | isPointOnScreen | {
"repo_name": "Javaec/ChattyRus",
"path": "src/chatty/gui/GuiUtil.java",
"license": "apache-2.0",
"size": 6791
} | [
"java.awt.Point"
] | import java.awt.Point; | import java.awt.*; | [
"java.awt"
] | java.awt; | 2,451,618 |
Map<String, List<T>> clusterNamesToAsgs = new HashMap<String, List<T>>();
for (T input : inputs) {
String clusterName = Names.parseName(nameProvider.extractAsgName(input)).getCluster();
if (!clusterNamesToAsgs.containsKey(clusterName)) {
clusterNamesToAsgs.put(clusterName, new ArrayList<T>());
}
clusterNamesToAsgs.get(clusterName).add(input);
}
return clusterNamesToAsgs;
} | Map<String, List<T>> clusterNamesToAsgs = new HashMap<String, List<T>>(); for (T input : inputs) { String clusterName = Names.parseName(nameProvider.extractAsgName(input)).getCluster(); if (!clusterNamesToAsgs.containsKey(clusterName)) { clusterNamesToAsgs.put(clusterName, new ArrayList<T>()); } clusterNamesToAsgs.get(clusterName).add(input); } return clusterNamesToAsgs; } | /**
* Groups a list of ASG related objects by cluster name.
*
* @param <T> Type to group
* @param inputs list of objects associated with an ASG
* @param nameProvider strategy object used to extract the ASG name of the object type of the input list
* @return map of cluster name to list of input object
*/ | Groups a list of ASG related objects by cluster name | groupByClusterName | {
"repo_name": "cmvelo/frigga",
"path": "src/main/java/com/netflix/frigga/cluster/ClusterGrouper.java",
"license": "apache-2.0",
"size": 2378
} | [
"com.netflix.frigga.Names",
"java.util.ArrayList",
"java.util.HashMap",
"java.util.List",
"java.util.Map"
] | import com.netflix.frigga.Names; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; | import com.netflix.frigga.*; import java.util.*; | [
"com.netflix.frigga",
"java.util"
] | com.netflix.frigga; java.util; | 2,036,430 |
public Comparator getComparator() {
return comparator;
}
// ---------------------------------------------------------------- override
| Comparator function() { return comparator; } | /**
* Returns comparator assigned to this collection, if such exist.
*/ | Returns comparator assigned to this collection, if such exist | getComparator | {
"repo_name": "mohanaraosv/jodd",
"path": "jodd-core/src/main/java/jodd/util/collection/SortedArrayList.java",
"license": "bsd-2-clause",
"size": 5110
} | [
"java.util.Comparator"
] | import java.util.Comparator; | import java.util.*; | [
"java.util"
] | java.util; | 1,930,421 |
public final static String getDCEString(byte[] buf, int off)
throws IndexOutOfBoundsException {
// Check if the buffer is big enough to hold the String header
if ( buf.length < off+12)
throw new IndexOutOfBoundsException();
// Get the maximum and actual string length
int maxLen = DataPacker.getIntelInt(buf,off);
int strLen = DataPacker.getIntelInt(buf,off+8);
// Read the Unicode string
return DataPacker.getUnicodeString(buf,off+12,strLen);
}
| final static String function(byte[] buf, int off) throws IndexOutOfBoundsException { if ( buf.length < off+12) throw new IndexOutOfBoundsException(); int maxLen = DataPacker.getIntelInt(buf,off); int strLen = DataPacker.getIntelInt(buf,off+8); return DataPacker.getUnicodeString(buf,off+12,strLen); } | /**
* Unpack a DCE string from the buffer
*
* @param buf byte[]
* @param off int
* @return String
* @exception java.lang.IndexOutOfBoundsException If there is not enough data in the buffer.
*/ | Unpack a DCE string from the buffer | getDCEString | {
"repo_name": "loftuxab/community-edition-old",
"path": "projects/alfresco-jlan/source/java/org/alfresco/jlan/smb/dcerpc/DCEDataPacker.java",
"license": "lgpl-3.0",
"size": 2728
} | [
"org.alfresco.jlan.util.DataPacker"
] | import org.alfresco.jlan.util.DataPacker; | import org.alfresco.jlan.util.*; | [
"org.alfresco.jlan"
] | org.alfresco.jlan; | 179,215 |
public java.util.List<fr.lip6.move.pnml.symmetricnet.terms.hlapi.UserSortHLAPI> getInput_terms_UserSortHLAPI(){
java.util.List<fr.lip6.move.pnml.symmetricnet.terms.hlapi.UserSortHLAPI> retour = new ArrayList<fr.lip6.move.pnml.symmetricnet.terms.hlapi.UserSortHLAPI>();
for (Sort elemnt : getInput()) {
if(elemnt.getClass().equals(fr.lip6.move.pnml.symmetricnet.terms.impl.UserSortImpl.class)){
retour.add(new fr.lip6.move.pnml.symmetricnet.terms.hlapi.UserSortHLAPI(
(fr.lip6.move.pnml.symmetricnet.terms.UserSort)elemnt
));
}
}
return retour;
}
//setters (including container setter if aviable)
| java.util.List<fr.lip6.move.pnml.symmetricnet.terms.hlapi.UserSortHLAPI> function(){ java.util.List<fr.lip6.move.pnml.symmetricnet.terms.hlapi.UserSortHLAPI> retour = new ArrayList<fr.lip6.move.pnml.symmetricnet.terms.hlapi.UserSortHLAPI>(); for (Sort elemnt : getInput()) { if(elemnt.getClass().equals(fr.lip6.move.pnml.symmetricnet.terms.impl.UserSortImpl.class)){ retour.add(new fr.lip6.move.pnml.symmetricnet.terms.hlapi.UserSortHLAPI( (fr.lip6.move.pnml.symmetricnet.terms.UserSort)elemnt )); } } return retour; } | /**
* This accessor return a list of encapsulated subelement, only of UserSortHLAPI kind.
* WARNING : this method can creates a lot of new object in memory.
*/ | This accessor return a list of encapsulated subelement, only of UserSortHLAPI kind. WARNING : this method can creates a lot of new object in memory | getInput_terms_UserSortHLAPI | {
"repo_name": "lhillah/pnmlframework",
"path": "pnmlFw-SNNet/src/fr/lip6/move/pnml/symmetricnet/integers/hlapi/GreaterThanHLAPI.java",
"license": "epl-1.0",
"size": 89946
} | [
"fr.lip6.move.pnml.symmetricnet.terms.Sort",
"java.util.ArrayList",
"java.util.List"
] | import fr.lip6.move.pnml.symmetricnet.terms.Sort; import java.util.ArrayList; import java.util.List; | import fr.lip6.move.pnml.symmetricnet.terms.*; import java.util.*; | [
"fr.lip6.move",
"java.util"
] | fr.lip6.move; java.util; | 61,908 |
public CallMethodBuilder withParamTypes( final String... paramTypeNames )
{
Class<?>[] paramTypes = null;
if ( paramTypeNames != null )
{
paramTypes = new Class<?>[paramTypeNames.length];
for ( int i = 0; i < paramTypeNames.length; i++ )
{
try
{
paramTypes[i] = classLoader.loadClass( paramTypeNames[i] );
}
catch ( final ClassNotFoundException e )
{
this.reportError( format( "callMethod( \"%s\" ).withParamTypes( %s )", this.methodName,
Arrays.toString( paramTypeNames ) ),
format( "class '%s' cannot be load", paramTypeNames[i] ) );
}
}
}
return withParamTypes( paramTypes );
} | CallMethodBuilder function( final String... paramTypeNames ) { Class<?>[] paramTypes = null; if ( paramTypeNames != null ) { paramTypes = new Class<?>[paramTypeNames.length]; for ( int i = 0; i < paramTypeNames.length; i++ ) { try { paramTypes[i] = classLoader.loadClass( paramTypeNames[i] ); } catch ( final ClassNotFoundException e ) { this.reportError( format( STR%s\STR, this.methodName, Arrays.toString( paramTypeNames ) ), format( STR, paramTypeNames[i] ) ); } } } return withParamTypes( paramTypes ); } | /**
* Sets the Java class names that represent the parameter types of the method arguments.
*
* If you wish to use a primitive type, specify the corresonding Java wrapper class instead,
* such as {@code java.lang.Boolean.TYPE} for a {@code boolean} parameter.
*
* @param paramTypeNames The Java classes names that represent the parameter types of the method arguments
* @return this builder instance
*/ | Sets the Java class names that represent the parameter types of the method arguments. If you wish to use a primitive type, specify the corresonding Java wrapper class instead, such as java.lang.Boolean.TYPE for a boolean parameter | withParamTypes | {
"repo_name": "apache/commons-digester",
"path": "core/src/main/java/org/apache/commons/digester3/binder/CallMethodBuilder.java",
"license": "apache-2.0",
"size": 6475
} | [
"java.lang.String",
"java.util.Arrays"
] | import java.lang.String; import java.util.Arrays; | import java.lang.*; import java.util.*; | [
"java.lang",
"java.util"
] | java.lang; java.util; | 1,443,971 |
public synchronized Result<SaveSet> deleteSaveSet(SaveSet set, String comment) throws IOException, GitAPIException {
checkInitialised();
SaveSet deleted = null;
ChangeType change = ChangeType.NONE;
delete: {
Credentials cp = getCredentials(Optional.empty());
if (cp != null) {
setBranch(set.getBranch());
change = ChangeType.SAVE;
if (automatic) {
Object[] obj = pull(cp);
cp = (Credentials) obj[0];
change = (Boolean) obj[1] ? ChangeType.PULL : change;
if (cp == null) {
break delete;
}
}
String relativePath = convertPathToString(set, FileType.SAVE_SET);
if (deleteFile(relativePath, repositoryPath)) {
deleted = set;
commit(relativePath, new MetaInfo(comment, cp.getUsername(), UNKNOWN, null, null), true);
// delete also the snapshot file
relativePath = convertPathToString(set, FileType.SNAPSHOT);
deleteFile(relativePath, repositoryPath);
commit(relativePath, new MetaInfo(comment, cp.getUsername(), null, null, null), true);
if (automatic) {
push(cp, false);
}
}
}
}
return new Result<>(deleted, change);
} | synchronized Result<SaveSet> function(SaveSet set, String comment) throws IOException, GitAPIException { checkInitialised(); SaveSet deleted = null; ChangeType change = ChangeType.NONE; delete: { Credentials cp = getCredentials(Optional.empty()); if (cp != null) { setBranch(set.getBranch()); change = ChangeType.SAVE; if (automatic) { Object[] obj = pull(cp); cp = (Credentials) obj[0]; change = (Boolean) obj[1] ? ChangeType.PULL : change; if (cp == null) { break delete; } } String relativePath = convertPathToString(set, FileType.SAVE_SET); if (deleteFile(relativePath, repositoryPath)) { deleted = set; commit(relativePath, new MetaInfo(comment, cp.getUsername(), UNKNOWN, null, null), true); relativePath = convertPathToString(set, FileType.SNAPSHOT); deleteFile(relativePath, repositoryPath); commit(relativePath, new MetaInfo(comment, cp.getUsername(), null, null, null), true); if (automatic) { push(cp, false); } } } } return new Result<>(deleted, change); } | /**
* Delete the save set from the repository. Save set and snapshot files are deleted.
*
* @param data the set to delete
* @param comment the comment why the set was deleted
* @return the result of the action
* @throws IOException in case of an error
* @throws GitAPIException in case of an error
*/ | Delete the save set from the repository. Save set and snapshot files are deleted | deleteSaveSet | {
"repo_name": "ControlSystemStudio/cs-studio",
"path": "applications/saverestore/saverestore-plugins/org.csstudio.saverestore.git/src/org/csstudio/saverestore/git/GitManager.java",
"license": "epl-1.0",
"size": 80642
} | [
"java.io.IOException",
"java.util.Optional",
"org.csstudio.saverestore.data.SaveSet",
"org.csstudio.saverestore.git.Result",
"org.csstudio.ui.fx.util.Credentials",
"org.eclipse.jgit.api.errors.GitAPIException"
] | import java.io.IOException; import java.util.Optional; import org.csstudio.saverestore.data.SaveSet; import org.csstudio.saverestore.git.Result; import org.csstudio.ui.fx.util.Credentials; import org.eclipse.jgit.api.errors.GitAPIException; | import java.io.*; import java.util.*; import org.csstudio.saverestore.data.*; import org.csstudio.saverestore.git.*; import org.csstudio.ui.fx.util.*; import org.eclipse.jgit.api.errors.*; | [
"java.io",
"java.util",
"org.csstudio.saverestore",
"org.csstudio.ui",
"org.eclipse.jgit"
] | java.io; java.util; org.csstudio.saverestore; org.csstudio.ui; org.eclipse.jgit; | 1,870,464 |
CalculationResult createResult(
CalculationTask task,
CalculationTarget target,
Map<Measure, Result<?>> results,
ScenarioFxRateProvider fxProvider,
ReferenceData refData) {
// caller expects that this method does not throw an exception
Result<?> calculated = results.get(measure);
if (calculated == null) {
calculated = Result.failure(
FailureReason.CALCULATION_FAILED,
"Measure '{}' was not calculated by the function for target type '{}'",
measure, target.getClass().getName());
}
Result<?> result = convertCurrencyIfNecessary(task, calculated, fxProvider, refData);
return CalculationResult.of(rowIndex, columnIndex, result);
} | CalculationResult createResult( CalculationTask task, CalculationTarget target, Map<Measure, Result<?>> results, ScenarioFxRateProvider fxProvider, ReferenceData refData) { Result<?> calculated = results.get(measure); if (calculated == null) { calculated = Result.failure( FailureReason.CALCULATION_FAILED, STR, measure, target.getClass().getName()); } Result<?> result = convertCurrencyIfNecessary(task, calculated, fxProvider, refData); return CalculationResult.of(rowIndex, columnIndex, result); } | /**
* Creates the result from the map of calculated measures.
* <p>
* This extracts the calculated measure and performs currency conversion if necessary.
*
* @param task the calculation task
* @param target the target of the calculation
* @param results the map of result by measure
* @param fxProvider the market data
* @param refData the reference data
* @return the calculation result
*/ | Creates the result from the map of calculated measures. This extracts the calculated measure and performs currency conversion if necessary | createResult | {
"repo_name": "ChinaQuants/Strata",
"path": "modules/calc/src/main/java/com/opengamma/strata/calc/runner/CalculationTaskCell.java",
"license": "apache-2.0",
"size": 9409
} | [
"com.opengamma.strata.basics.CalculationTarget",
"com.opengamma.strata.basics.ReferenceData",
"com.opengamma.strata.calc.Measure",
"com.opengamma.strata.collect.result.FailureReason",
"com.opengamma.strata.collect.result.Result",
"com.opengamma.strata.data.scenario.ScenarioFxRateProvider",
"java.util.Map"
] | import com.opengamma.strata.basics.CalculationTarget; import com.opengamma.strata.basics.ReferenceData; import com.opengamma.strata.calc.Measure; import com.opengamma.strata.collect.result.FailureReason; import com.opengamma.strata.collect.result.Result; import com.opengamma.strata.data.scenario.ScenarioFxRateProvider; import java.util.Map; | import com.opengamma.strata.basics.*; import com.opengamma.strata.calc.*; import com.opengamma.strata.collect.result.*; import com.opengamma.strata.data.scenario.*; import java.util.*; | [
"com.opengamma.strata",
"java.util"
] | com.opengamma.strata; java.util; | 2,896,931 |
ExecutableBranch callStandalone(Executable executable); | ExecutableBranch callStandalone(Executable executable); | /**
* Call single executable in dedicated branch
*
* @param executable an executable to call
* @return the parent branch of called executable
*/ | Call single executable in dedicated branch | callStandalone | {
"repo_name": "Panda-Programming-Language/Panda",
"path": "panda-framework/src/main/java/org/panda_lang/panda/framework/design/runtime/ExecutableBranch.java",
"license": "apache-2.0",
"size": 3250
} | [
"org.panda_lang.panda.framework.design.architecture.dynamic.Executable"
] | import org.panda_lang.panda.framework.design.architecture.dynamic.Executable; | import org.panda_lang.panda.framework.design.architecture.dynamic.*; | [
"org.panda_lang.panda"
] | org.panda_lang.panda; | 1,181,984 |
public ArrayList<LineStyle> getAllLineStyles() {
return new ArrayList<LineStyle>(lineStyles.values());
} | ArrayList<LineStyle> function() { return new ArrayList<LineStyle>(lineStyles.values()); } | /**
* Returns all the LineStyles in this MapTheme.
*
* @return
*/ | Returns all the LineStyles in this MapTheme | getAllLineStyles | {
"repo_name": "alecdhuse/Folding-Map",
"path": "FoldingMap/src/co/foldingmap/map/themes/MapTheme.java",
"license": "gpl-3.0",
"size": 13468
} | [
"java.util.ArrayList"
] | import java.util.ArrayList; | import java.util.*; | [
"java.util"
] | java.util; | 2,162,834 |
public static Object generateCustomRandomData(String[] customDataList) {
Random random = new Random();
int randomElementSelector = random.nextInt(customDataList.length);
Object result;
result = customDataList[randomElementSelector];
return result;
} | static Object function(String[] customDataList) { Random random = new Random(); int randomElementSelector = random.nextInt(customDataList.length); Object result; result = customDataList[randomElementSelector]; return result; } | /**
* Generate data with in given data list
* <p>
* Initialize Random to select random element from array
*
* @param customDataList Array of data
* @return generated data from array
*/ | Generate data with in given data list Initialize Random to select random element from array | generateCustomRandomData | {
"repo_name": "swsachith/product-bam",
"path": "modules/components/org.wso2.carbon.event.simulator.core/src/main/java/org/wso2/eventsimulator/core/simulator/randomdatafeedsimulation/util/RandomDataGenerator.java",
"license": "apache-2.0",
"size": 28763
} | [
"java.util.Random"
] | import java.util.Random; | import java.util.*; | [
"java.util"
] | java.util; | 2,546,997 |
private static<D extends DataStore<K,T>, K, T extends Persistent>
void setProperty(Properties properties, Class<D> dataStoreClass, String baseKey, String value) {
properties.setProperty(GORA+"."+org.apache.gora.util.StringUtils.getClassname(dataStoreClass)+"."+baseKey, value);
} | static<D extends DataStore<K,T>, K, T extends Persistent> void function(Properties properties, Class<D> dataStoreClass, String baseKey, String value) { properties.setProperty(GORA+"."+org.apache.gora.util.StringUtils.getClassname(dataStoreClass)+"."+baseKey, value); } | /**
* Sets a property for the datastore of the given class
*/ | Sets a property for the datastore of the given class | setProperty | {
"repo_name": "thainb/GoraDynamoDB",
"path": "gora-core/src/main/java/org/apache/gora/store/ws/impl/WSDataStoreFactory.java",
"license": "apache-2.0",
"size": 15718
} | [
"java.util.Properties",
"org.apache.gora.persistency.Persistent",
"org.apache.gora.store.DataStore"
] | import java.util.Properties; import org.apache.gora.persistency.Persistent; import org.apache.gora.store.DataStore; | import java.util.*; import org.apache.gora.persistency.*; import org.apache.gora.store.*; | [
"java.util",
"org.apache.gora"
] | java.util; org.apache.gora; | 1,976,898 |
public void buildClassifier(Instances data) throws Exception {
// can classifier handle the data?
getCapabilities().testWithFail(data);
// remove instances with missing class
data = new Instances(data);
data.deleteWithMissingClass();
m_instances = new Instances(data);
m_replaceMissing = new ReplaceMissingValues();
m_replaceMissing.setInputFormat(m_instances);
m_instances = Filter.useFilter(m_instances, m_replaceMissing);
m_nominalToBinary = new NominalToBinary();
m_nominalToBinary.setInputFormat(m_instances);
m_instances = Filter.useFilter(m_instances, m_nominalToBinary);
m_removeUseless = new RemoveUseless();
m_removeUseless.setInputFormat(m_instances);
m_instances = Filter.useFilter(m_instances, m_removeUseless);
m_instances.randomize(new Random(1));
m_ruleSet = new FastVector();
Rule2 tempRule;
if (m_generateRules) {
Instances tempInst = m_instances;
do {
tempRule = new Rule2();
tempRule.setSmoothing(!m_unsmoothedPredictions);
tempRule.setRegressionTree(m_regressionTree);
tempRule.setUnpruned(m_useUnpruned);
tempRule.setSaveInstances(false);
tempRule.setMinNumInstances(m_minNumInstances);
tempRule.buildClassifier(tempInst);
m_ruleSet.addElement(tempRule);
// System.err.println("Built rule : "+tempRule.toString());
tempInst = tempRule.notCoveredInstances();
} while (tempInst.numInstances() > 0);
} else {
// just build a single tree
tempRule = new Rule2();
tempRule.setUseTree(true);
// tempRule.setGrowFullTree(true);
tempRule.setSmoothing(!m_unsmoothedPredictions);
tempRule.setSaveInstances(m_saveInstances);
tempRule.setRegressionTree(m_regressionTree);
tempRule.setUnpruned(m_useUnpruned);
tempRule.setMinNumInstances(m_minNumInstances);
Instances temp_train;
temp_train = m_instances;
tempRule.buildClassifier(temp_train);
m_ruleSet.addElement(tempRule);
// save space
m_instances = new Instances(m_instances, 0);
// System.err.print(tempRule.m_topOfTree.treeToString(0));
}
} | void function(Instances data) throws Exception { getCapabilities().testWithFail(data); data = new Instances(data); data.deleteWithMissingClass(); m_instances = new Instances(data); m_replaceMissing = new ReplaceMissingValues(); m_replaceMissing.setInputFormat(m_instances); m_instances = Filter.useFilter(m_instances, m_replaceMissing); m_nominalToBinary = new NominalToBinary(); m_nominalToBinary.setInputFormat(m_instances); m_instances = Filter.useFilter(m_instances, m_nominalToBinary); m_removeUseless = new RemoveUseless(); m_removeUseless.setInputFormat(m_instances); m_instances = Filter.useFilter(m_instances, m_removeUseless); m_instances.randomize(new Random(1)); m_ruleSet = new FastVector(); Rule2 tempRule; if (m_generateRules) { Instances tempInst = m_instances; do { tempRule = new Rule2(); tempRule.setSmoothing(!m_unsmoothedPredictions); tempRule.setRegressionTree(m_regressionTree); tempRule.setUnpruned(m_useUnpruned); tempRule.setSaveInstances(false); tempRule.setMinNumInstances(m_minNumInstances); tempRule.buildClassifier(tempInst); m_ruleSet.addElement(tempRule); tempInst = tempRule.notCoveredInstances(); } while (tempInst.numInstances() > 0); } else { tempRule = new Rule2(); tempRule.setUseTree(true); tempRule.setSmoothing(!m_unsmoothedPredictions); tempRule.setSaveInstances(m_saveInstances); tempRule.setRegressionTree(m_regressionTree); tempRule.setUnpruned(m_useUnpruned); tempRule.setMinNumInstances(m_minNumInstances); Instances temp_train; temp_train = m_instances; tempRule.buildClassifier(temp_train); m_ruleSet.addElement(tempRule); m_instances = new Instances(m_instances, 0); } } | /**
* Generates the classifier.
*
* @param data set of instances serving as training data
* @throws Exception if the classifier has not been generated
* successfully
*/ | Generates the classifier | buildClassifier | {
"repo_name": "waikato-datamining/adams-base",
"path": "adams-weka/src/main/java/weka/classifiers/trees/m5/M5Base2.java",
"license": "gpl-3.0",
"size": 17579
} | [
"java.util.Random"
] | import java.util.Random; | import java.util.*; | [
"java.util"
] | java.util; | 2,600,479 |
public Iterator<Path> dirIterator() {
return unbounded.dirIterator();
} | Iterator<Path> function() { return unbounded.dirIterator(); } | /**
* Returns an iterator that provides all leaf-level directories in this view.
*
* @return leaf-directory iterator
*/ | Returns an iterator that provides all leaf-level directories in this view | dirIterator | {
"repo_name": "rbrush/kite",
"path": "kite-data/kite-data-core/src/main/java/org/kitesdk/data/spi/filesystem/FileSystemDataset.java",
"license": "apache-2.0",
"size": 17229
} | [
"java.util.Iterator",
"org.apache.hadoop.fs.Path"
] | import java.util.Iterator; import org.apache.hadoop.fs.Path; | import java.util.*; import org.apache.hadoop.fs.*; | [
"java.util",
"org.apache.hadoop"
] | java.util; org.apache.hadoop; | 2,069,340 |
public Record predict(String text) {
TrainingParameters trainingParameters = (TrainingParameters) knowledgeBase.getTrainingParameters();
Dataframe testDataset = new Dataframe(knowledgeBase.getConfiguration());
testDataset.add(
new Record(
new AssociativeArray(
AbstractTextExtractor.newInstance(trainingParameters.getTextExtractorParameters()).extract(StringCleaner.clear(text))
),
null
)
);
predict(testDataset);
Record r = testDataset.iterator().next();
testDataset.close();
return r;
} | Record function(String text) { TrainingParameters trainingParameters = (TrainingParameters) knowledgeBase.getTrainingParameters(); Dataframe testDataset = new Dataframe(knowledgeBase.getConfiguration()); testDataset.add( new Record( new AssociativeArray( AbstractTextExtractor.newInstance(trainingParameters.getTextExtractorParameters()).extract(StringCleaner.clear(text)) ), null ) ); predict(testDataset); Record r = testDataset.iterator().next(); testDataset.close(); return r; } | /**
* It generates a prediction for a particular string. It returns a Record
* object which contains the observation data, the predicted class and
* probabilities.
*
* @param text
* @return
*/ | It generates a prediction for a particular string. It returns a Record object which contains the observation data, the predicted class and probabilities | predict | {
"repo_name": "datumbox/datumbox-framework",
"path": "datumbox-framework-applications/src/main/java/com/datumbox/framework/applications/nlp/TextClassifier.java",
"license": "apache-2.0",
"size": 8218
} | [
"com.datumbox.framework.common.dataobjects.AssociativeArray",
"com.datumbox.framework.core.common.dataobjects.Dataframe",
"com.datumbox.framework.core.common.dataobjects.Record",
"com.datumbox.framework.core.common.text.StringCleaner",
"com.datumbox.framework.core.common.text.extractors.AbstractTextExtractor"
] | import com.datumbox.framework.common.dataobjects.AssociativeArray; import com.datumbox.framework.core.common.dataobjects.Dataframe; import com.datumbox.framework.core.common.dataobjects.Record; import com.datumbox.framework.core.common.text.StringCleaner; import com.datumbox.framework.core.common.text.extractors.AbstractTextExtractor; | import com.datumbox.framework.common.dataobjects.*; import com.datumbox.framework.core.common.dataobjects.*; import com.datumbox.framework.core.common.text.*; import com.datumbox.framework.core.common.text.extractors.*; | [
"com.datumbox.framework"
] | com.datumbox.framework; | 2,374,325 |
public void openCamera(final String cameraId) {
mCameraHandler = new Handler(mCameraThread.getLooper()); | void function(final String cameraId) { mCameraHandler = new Handler(mCameraThread.getLooper()); | /**
* Open the first back-facing camera listed by the camera manager.
* Displays a dialog if it cannot open a camera.
*/ | Open the first back-facing camera listed by the camera manager. Displays a dialog if it cannot open a camera | openCamera | {
"repo_name": "android/camera-samples",
"path": "HdrViewfinder/Application/src/main/java/com/example/android/hdrviewfinder/CameraOps.java",
"license": "apache-2.0",
"size": 9764
} | [
"android.os.Handler"
] | import android.os.Handler; | import android.os.*; | [
"android.os"
] | android.os; | 1,737,651 |
protected void fillComboBox(ComboBox combo, Class<?> clazz, String name) {
PropertyDescriptor pd = BeanUtils.getPropertyDescriptor(clazz, name);
Dao<?, Serializable> service =
persistentServiceFactory.createPersistentService(pd.getPropertyType());
// fill combo
Iterator<?> iter = service.getAll().iterator();
while(iter.hasNext())
combo.addItem(iter.next());
} | void function(ComboBox combo, Class<?> clazz, String name) { PropertyDescriptor pd = BeanUtils.getPropertyDescriptor(clazz, name); Dao<?, Serializable> service = persistentServiceFactory.createPersistentService(pd.getPropertyType()); Iterator<?> iter = service.getAll().iterator(); while(iter.hasNext()) combo.addItem(iter.next()); } | /**
* Fill the ComboBox with items from PersistentService
* @param combo ComboBox to fill
* @param clazz Class of Bean containing property name
* @param name property name
*/ | Fill the ComboBox with items from PersistentService | fillComboBox | {
"repo_name": "chelu/jdal",
"path": "vaadin/src/main/java/org/jdal/vaadin/ui/form/ComboBoxFieldBuilder.java",
"license": "apache-2.0",
"size": 3352
} | [
"com.vaadin.ui.ComboBox",
"java.beans.PropertyDescriptor",
"java.io.Serializable",
"java.util.Iterator",
"org.jdal.dao.Dao",
"org.springframework.beans.BeanUtils"
] | import com.vaadin.ui.ComboBox; import java.beans.PropertyDescriptor; import java.io.Serializable; import java.util.Iterator; import org.jdal.dao.Dao; import org.springframework.beans.BeanUtils; | import com.vaadin.ui.*; import java.beans.*; import java.io.*; import java.util.*; import org.jdal.dao.*; import org.springframework.beans.*; | [
"com.vaadin.ui",
"java.beans",
"java.io",
"java.util",
"org.jdal.dao",
"org.springframework.beans"
] | com.vaadin.ui; java.beans; java.io; java.util; org.jdal.dao; org.springframework.beans; | 1,149,048 |
public static void saveUnsavedTracks(Context context) {
track_save_attempted = true;
ArrayList<Track> unsaved_tracks = G.db.getUnsavedTrackList();
ArrayList<ItemUserAccess> items = new ArrayList<ItemUserAccess>();
for (Track item : unsaved_tracks) {
items.add(G.db.getTrack(item.stack_id));
}
if (items.size() > 0) {
GWIS_Commit g = new GWIS_Commit(items);
g.retrying = true;
g.fetch();
}
} | static void function(Context context) { track_save_attempted = true; ArrayList<Track> unsaved_tracks = G.db.getUnsavedTrackList(); ArrayList<ItemUserAccess> items = new ArrayList<ItemUserAccess>(); for (Track item : unsaved_tracks) { items.add(G.db.getTrack(item.stack_id)); } if (items.size() > 0) { GWIS_Commit g = new GWIS_Commit(items); g.retrying = true; g.fetch(); } } | /**
* This method attempts to save local tracks that have not been saved on
* the server.
* @param context
*/ | This method attempts to save local tracks that have not been saved on the server | saveUnsavedTracks | {
"repo_name": "lbouma/Cyclopath",
"path": "android/src/org/cyclopath/android/G.java",
"license": "apache-2.0",
"size": 35238
} | [
"android.content.Context",
"java.util.ArrayList",
"org.cyclopath.android.items.ItemUserAccess",
"org.cyclopath.android.items.Track"
] | import android.content.Context; import java.util.ArrayList; import org.cyclopath.android.items.ItemUserAccess; import org.cyclopath.android.items.Track; | import android.content.*; import java.util.*; import org.cyclopath.android.items.*; | [
"android.content",
"java.util",
"org.cyclopath.android"
] | android.content; java.util; org.cyclopath.android; | 1,330,873 |
@Override
public void messageArrived(String topic, MqttMessage mqttMessage)
throws Exception {
super.messageArrived(topic, mqttMessage);
Matcher matcher = pattern.matcher(topic);
if (matcher.matches()) {
String deviceid = matcher.group(1);
String payload = new String(mqttMessage.getPayload());
//Parse the payload in Json Format
JSONObject jsonObject = new JSONObject(payload);
JSONObject contObj = jsonObject.getJSONObject("d");
int count = contObj.getInt("count");
System.out.println("Receive count " + count + " from device "
+ deviceid);
//If count >=4, start a new thread to reset the count
if (count >= 4) {
new ResetCountThread(deviceid, 0).start();
}
}
}
}
private class ResetCountThread extends Thread {
private String deviceid = null;
private int count = 0;
public ResetCountThread(String deviceid, int count) {
this.deviceid = deviceid;
this.count = count;
} | void function(String topic, MqttMessage mqttMessage) throws Exception { super.messageArrived(topic, mqttMessage); Matcher matcher = pattern.matcher(topic); if (matcher.matches()) { String deviceid = matcher.group(1); String payload = new String(mqttMessage.getPayload()); JSONObject jsonObject = new JSONObject(payload); JSONObject contObj = jsonObject.getJSONObject("d"); int count = contObj.getInt("count"); System.out.println(STR + count + STR + deviceid); if (count >= 4) { new ResetCountThread(deviceid, 0).start(); } } } } private class ResetCountThread extends Thread { private String deviceid = null; private int count = 0; public ResetCountThread(String deviceid, int count) { this.deviceid = deviceid; this.count = count; } | /**
* Once a subscribed message is received
*/ | Once a subscribed message is received | messageArrived | {
"repo_name": "ksuma2109/source_iot",
"path": "src/com/ibm/bluemixmqtt/AppTest.java",
"license": "epl-1.0",
"size": 4595
} | [
"java.util.regex.Matcher",
"org.apache.commons.json.JSONObject",
"org.eclipse.paho.client.mqttv3.MqttMessage"
] | import java.util.regex.Matcher; import org.apache.commons.json.JSONObject; import org.eclipse.paho.client.mqttv3.MqttMessage; | import java.util.regex.*; import org.apache.commons.json.*; import org.eclipse.paho.client.mqttv3.*; | [
"java.util",
"org.apache.commons",
"org.eclipse.paho"
] | java.util; org.apache.commons; org.eclipse.paho; | 1,220,541 |
private String inferAlias(List<RexNode> exprList, RexNode expr) {
switch (expr.getKind()) {
case INPUT_REF:
final RexInputRef ref = (RexInputRef) expr;
return stack.peek().fields.get(ref.getIndex()).getValue().getName();
case CAST:
return inferAlias(exprList, ((RexCall) expr).getOperands().get(0));
case AS:
final RexCall call = (RexCall) expr;
for (;;) {
final int i = exprList.indexOf(expr);
if (i < 0) {
break;
}
exprList.set(i, call.getOperands().get(0));
}
return ((NlsString) ((RexLiteral) call.getOperands().get(1)).getValue())
.getValue();
default:
return null;
}
} | String function(List<RexNode> exprList, RexNode expr) { switch (expr.getKind()) { case INPUT_REF: final RexInputRef ref = (RexInputRef) expr; return stack.peek().fields.get(ref.getIndex()).getValue().getName(); case CAST: return inferAlias(exprList, ((RexCall) expr).getOperands().get(0)); case AS: final RexCall call = (RexCall) expr; for (;;) { final int i = exprList.indexOf(expr); if (i < 0) { break; } exprList.set(i, call.getOperands().get(0)); } return ((NlsString) ((RexLiteral) call.getOperands().get(1)).getValue()) .getValue(); default: return null; } } | /** Infers the alias of an expression.
*
* <p>If the expression was created by {@link #alias}, replaces the expression
* in the project list.
*/ | Infers the alias of an expression. If the expression was created by <code>#alias</code>, replaces the expression in the project list | inferAlias | {
"repo_name": "sreev/incubator-calcite",
"path": "core/src/main/java/org/apache/calcite/tools/RelBuilder.java",
"license": "apache-2.0",
"size": 64409
} | [
"java.util.List",
"org.apache.calcite.rex.RexCall",
"org.apache.calcite.rex.RexInputRef",
"org.apache.calcite.rex.RexLiteral",
"org.apache.calcite.rex.RexNode",
"org.apache.calcite.util.NlsString"
] | import java.util.List; import org.apache.calcite.rex.RexCall; import org.apache.calcite.rex.RexInputRef; import org.apache.calcite.rex.RexLiteral; import org.apache.calcite.rex.RexNode; import org.apache.calcite.util.NlsString; | import java.util.*; import org.apache.calcite.rex.*; import org.apache.calcite.util.*; | [
"java.util",
"org.apache.calcite"
] | java.util; org.apache.calcite; | 387,118 |
public OMText createLabel(Geo g1, Geo g2, float dist,
Length distanceUnits, double angleInDg) {
Geo mid;
switch (getLineType()) {
case LINETYPE_STRAIGHT:
float lat = (float) (g1.getLatitude() + g2.getLatitude()) / 2f;
float lon = (float) (g1.getLongitude() + g2.getLongitude()) / 2f;
mid = new Geo(lat, lon);
break;
case LINETYPE_RHUMB:
System.err.println("Rhumb distance calculation not implemented.");
case LINETYPE_GREATCIRCLE:
case LINETYPE_UNKNOWN:
default:
mid = g1.midPoint(g2);
}
String text = getText(dist, distanceUnits, angleInDg);
OMText omtext = new OMText((float) mid.getLatitude(),
(float) mid.getLongitude(), text, OMText.JUSTIFY_LEFT);
return omtext;
} | OMText function(Geo g1, Geo g2, float dist, Length distanceUnits, double angleInDg) { Geo mid; switch (getLineType()) { case LINETYPE_STRAIGHT: float lat = (float) (g1.getLatitude() + g2.getLatitude()) / 2f; float lon = (float) (g1.getLongitude() + g2.getLongitude()) / 2f; mid = new Geo(lat, lon); break; case LINETYPE_RHUMB: System.err.println(STR); case LINETYPE_GREATCIRCLE: case LINETYPE_UNKNOWN: default: mid = g1.midPoint(g2); } String text = getText(dist, distanceUnits, angleInDg); OMText omtext = new OMText((float) mid.getLatitude(), (float) mid.getLongitude(), text, OMText.JUSTIFY_LEFT); return omtext; } | /**
* Get an OMText label for a segments between the given lat/lon points
* @param angleInDg
*
*/ | Get an OMText label for a segments between the given lat/lon points | createLabel | {
"repo_name": "pecko/deelite",
"path": "debrieflite/src/main/java/org/mwc/debrief/lite/graphics/DebriefDistance.java",
"license": "gpl-2.0",
"size": 10151
} | [
"com.bbn.openmap.geo.Geo",
"com.bbn.openmap.omGraphics.OMText",
"com.bbn.openmap.proj.Length"
] | import com.bbn.openmap.geo.Geo; import com.bbn.openmap.omGraphics.OMText; import com.bbn.openmap.proj.Length; | import com.bbn.openmap.*; import com.bbn.openmap.geo.*; import com.bbn.openmap.proj.*; | [
"com.bbn.openmap"
] | com.bbn.openmap; | 2,296,486 |
public static ContributeActivityDTO getContributeActivityDTO(Long lessonID, SimpleActivity activity,
ILamsCoreToolService toolService) throws LamsToolServiceException {
ContributeActivityDTO dto = null;
SimpleActivityStrategy strategy = activity.getSimpleActivityStrategy();
if (strategy != null) {
dto = ContributeDTOFactory.addContributionURLS(lessonID, activity, strategy, toolService);
}
return dto;
} | static ContributeActivityDTO function(Long lessonID, SimpleActivity activity, ILamsCoreToolService toolService) throws LamsToolServiceException { ContributeActivityDTO dto = null; SimpleActivityStrategy strategy = activity.getSimpleActivityStrategy(); if (strategy != null) { dto = ContributeDTOFactory.addContributionURLS(lessonID, activity, strategy, toolService); } return dto; } | /**
* Get the Contribute DTO for this activity. As a SimpleActivity it only returns a contribute DTO if there is a
* contribution entry.
*
* @throws LamsToolServiceException
*/ | Get the Contribute DTO for this activity. As a SimpleActivity it only returns a contribute DTO if there is a contribution entry | getContributeActivityDTO | {
"repo_name": "lamsfoundation/lams",
"path": "lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/ContributeDTOFactory.java",
"license": "gpl-2.0",
"size": 7114
} | [
"org.lamsfoundation.lams.learningdesign.SimpleActivity",
"org.lamsfoundation.lams.learningdesign.strategy.SimpleActivityStrategy",
"org.lamsfoundation.lams.monitoring.dto.ContributeActivityDTO",
"org.lamsfoundation.lams.tool.exception.LamsToolServiceException",
"org.lamsfoundation.lams.tool.service.ILamsCoreToolService"
] | import org.lamsfoundation.lams.learningdesign.SimpleActivity; import org.lamsfoundation.lams.learningdesign.strategy.SimpleActivityStrategy; import org.lamsfoundation.lams.monitoring.dto.ContributeActivityDTO; import org.lamsfoundation.lams.tool.exception.LamsToolServiceException; import org.lamsfoundation.lams.tool.service.ILamsCoreToolService; | import org.lamsfoundation.lams.learningdesign.*; import org.lamsfoundation.lams.learningdesign.strategy.*; import org.lamsfoundation.lams.monitoring.dto.*; import org.lamsfoundation.lams.tool.exception.*; import org.lamsfoundation.lams.tool.service.*; | [
"org.lamsfoundation.lams"
] | org.lamsfoundation.lams; | 1,215,990 |
@Nullable public RunfilesSupport getRunfilesSupport() {
return runfilesSupport;
} | @Nullable RunfilesSupport function() { return runfilesSupport; } | /**
* Returns the {@RunfilesSupport} object associated with the target or null if it does not exist.
*/ | Returns the object associated with the target or null if it does not exist | getRunfilesSupport | {
"repo_name": "perezd/bazel",
"path": "src/main/java/com/google/devtools/build/lib/analysis/FilesToRunProvider.java",
"license": "apache-2.0",
"size": 3662
} | [
"javax.annotation.Nullable"
] | import javax.annotation.Nullable; | import javax.annotation.*; | [
"javax.annotation"
] | javax.annotation; | 2,107,131 |
private Drawable loadTintedCategoryDrawable(Category category, int categoryImageResource) {
final Drawable categoryIcon = ContextCompat
.getDrawable(mActivity, categoryImageResource).mutate();
return wrapAndTint(categoryIcon, category.getTheme().getPrimaryColor());
} | Drawable function(Category category, int categoryImageResource) { final Drawable categoryIcon = ContextCompat .getDrawable(mActivity, categoryImageResource).mutate(); return wrapAndTint(categoryIcon, category.getTheme().getPrimaryColor()); } | /**
* Loads and tints a drawable.
*
* @param category The category providing the tint color
* @param categoryImageResource The image resource to tint
* @return The tinted resource
*/ | Loads and tints a drawable | loadTintedCategoryDrawable | {
"repo_name": "johnjohndoe/android-topeka",
"path": "app/src/main/java/com/google/samples/apps/topeka/adapter/CategoryAdapter.java",
"license": "apache-2.0",
"size": 7886
} | [
"android.graphics.drawable.Drawable",
"android.support.v4.content.ContextCompat",
"com.google.samples.apps.topeka.model.Category"
] | import android.graphics.drawable.Drawable; import android.support.v4.content.ContextCompat; import com.google.samples.apps.topeka.model.Category; | import android.graphics.drawable.*; import android.support.v4.content.*; import com.google.samples.apps.topeka.model.*; | [
"android.graphics",
"android.support",
"com.google.samples"
] | android.graphics; android.support; com.google.samples; | 848,812 |
public void addRow(Component component) {
Component actualComponent = component == null ? m_newComponentFactory.get() : component;
I_CmsEditableGroupRow row = m_rowBuilder.buildRow(this, actualComponent);
m_container.addComponent(row);
updatePlaceholder();
updateButtonBars();
updateGroupValidation();
} | void function(Component component) { Component actualComponent = component == null ? m_newComponentFactory.get() : component; I_CmsEditableGroupRow row = m_rowBuilder.buildRow(this, actualComponent); m_container.addComponent(row); updatePlaceholder(); updateButtonBars(); updateGroupValidation(); } | /**
* Adds a row for the given component at the end of the group.
*
* @param component the component to wrap in the row to be added
*/ | Adds a row for the given component at the end of the group | addRow | {
"repo_name": "alkacon/opencms-core",
"path": "src/org/opencms/ui/components/editablegroup/CmsEditableGroup.java",
"license": "lgpl-2.1",
"size": 15115
} | [
"com.vaadin.ui.Component"
] | import com.vaadin.ui.Component; | import com.vaadin.ui.*; | [
"com.vaadin.ui"
] | com.vaadin.ui; | 152,695 |
public void fieldLessThanOrEqual(Field f, Date x) {
add(f, "<=", x);
} | void function(Field f, Date x) { add(f, "<=", x); } | /**
* Adds a WHERE clause of the form "f <= x".
*/ | Adds a WHERE clause of the form "f <= x" | fieldLessThanOrEqual | {
"repo_name": "pietervdvn/DAO",
"path": "src/database/tools/filter/AbstractFilter4WhereAdd.java",
"license": "gpl-2.0",
"size": 7233
} | [
"java.util.Date"
] | import java.util.Date; | import java.util.*; | [
"java.util"
] | java.util; | 522,919 |
if(message != null) {
Logger.d(message, args);
}
} | if(message != null) { Logger.d(message, args); } } | /**
* Sends a DEBUG log message
* @param message to log
*/ | Sends a DEBUG log message | d | {
"repo_name": "flyve-mdm/flyve-mdm-android-inventory-agent",
"path": "app/src/main/java/org/glpi/inventory/agent/utils/AgentLog.java",
"license": "gpl-3.0",
"size": 3043
} | [
"com.orhanobut.logger.Logger"
] | import com.orhanobut.logger.Logger; | import com.orhanobut.logger.*; | [
"com.orhanobut.logger"
] | com.orhanobut.logger; | 1,317,923 |
void removeProperties(Id.NamespacedId entityId, String... keys) throws NotFoundException; | void removeProperties(Id.NamespacedId entityId, String... keys) throws NotFoundException; | /**
* Removes the specified keys from the business metadata of the specified {@link Id.Application}, {@link Id.Program},
* {@link Id.DatasetInstance} or {@link Id.Stream}.
*
* @throws NotFoundException if the specified entity was not found
*/ | Removes the specified keys from the business metadata of the specified <code>Id.Application</code>, <code>Id.Program</code>, <code>Id.DatasetInstance</code> or <code>Id.Stream</code> | removeProperties | {
"repo_name": "anthcp/cdap",
"path": "cdap-app-fabric/src/main/java/co/cask/cdap/metadata/MetadataAdmin.java",
"license": "apache-2.0",
"size": 5401
} | [
"co.cask.cdap.common.NotFoundException",
"co.cask.cdap.proto.Id"
] | import co.cask.cdap.common.NotFoundException; import co.cask.cdap.proto.Id; | import co.cask.cdap.common.*; import co.cask.cdap.proto.*; | [
"co.cask.cdap"
] | co.cask.cdap; | 472,000 |
public Calendar validate(String value, String pattern) {
return (Calendar)parse(value, pattern, (Locale)null, (TimeZone)null);
} | Calendar function(String value, String pattern) { return (Calendar)parse(value, pattern, (Locale)null, (TimeZone)null); } | /**
* <p>Validate/convert a time using the specified <i>pattern</i> and
* default <code>TimeZone</code>.
*
* @param value The value validation is being performed on.
* @param pattern The pattern used to validate the value against.
* @return The parsed <code>Calendar</code> if valid or <code>null</code> if invalid.
*/ | Validate/convert a time using the specified pattern and default <code>TimeZone</code> | validate | {
"repo_name": "apache/commons-validator",
"path": "src/main/java/org/apache/commons/validator/routines/TimeValidator.java",
"license": "apache-2.0",
"size": 12246
} | [
"java.util.Calendar",
"java.util.Locale",
"java.util.TimeZone"
] | import java.util.Calendar; import java.util.Locale; import java.util.TimeZone; | import java.util.*; | [
"java.util"
] | java.util; | 460,024 |
public List<MediaSearchResult> search(MediaSearchOptions options) throws Exception; | List<MediaSearchResult> function(MediaSearchOptions options) throws Exception; | /**
* Search for a TV show
*
* @param options
* the options
* @return the list
* @throws Exception
* the exception
*/ | Search for a TV show | search | {
"repo_name": "tinyMediaManager/api-scraper",
"path": "src/main/java/org/tinymediamanager/scraper/mediaprovider/ITvShowMetadataProvider.java",
"license": "apache-2.0",
"size": 2038
} | [
"java.util.List",
"org.tinymediamanager.scraper.MediaSearchOptions",
"org.tinymediamanager.scraper.MediaSearchResult"
] | import java.util.List; import org.tinymediamanager.scraper.MediaSearchOptions; import org.tinymediamanager.scraper.MediaSearchResult; | import java.util.*; import org.tinymediamanager.scraper.*; | [
"java.util",
"org.tinymediamanager.scraper"
] | java.util; org.tinymediamanager.scraper; | 2,241,171 |
private static void parseColumn(final Parser parser, final PgType type) {
final PgColumn column = new PgColumn(
ParserUtils.getObjectName(parser.parseIdentifier()));
type.addColumn(column);
column.parseDefinition(parser.getExpression());
}
private CreateTypeParser() {
} | static void function(final Parser parser, final PgType type) { final PgColumn column = new PgColumn( ParserUtils.getObjectName(parser.parseIdentifier())); type.addColumn(column); column.parseDefinition(parser.getExpression()); } private CreateTypeParser() { } | /**
* Parses column definition.
*
* @param parser parser
* @param type type
*/ | Parses column definition | parseColumn | {
"repo_name": "fordfrog/apgdiff",
"path": "src/main/java/cz/startnet/utils/pgdiff/parsers/CreateTypeParser.java",
"license": "mit",
"size": 2765
} | [
"cz.startnet.utils.pgdiff.schema.PgColumn",
"cz.startnet.utils.pgdiff.schema.PgType"
] | import cz.startnet.utils.pgdiff.schema.PgColumn; import cz.startnet.utils.pgdiff.schema.PgType; | import cz.startnet.utils.pgdiff.schema.*; | [
"cz.startnet.utils"
] | cz.startnet.utils; | 1,238,054 |
public List<Tuple3<FieldsExperimentalUnit, FieldsHasExperimentalUnit, FieldsExperimentMeta>> getRelationshipIsExperimentalUnitOf(List<String> ids, List<String> fromFields, List<String> relFields, List<String> toFields) throws IOException, JsonClientException {
List<Object> args = new ArrayList<Object>();
args.add(ids);
args.add(fromFields);
args.add(relFields);
args.add(toFields);
TypeReference<List<List<Tuple3<FieldsExperimentalUnit, FieldsHasExperimentalUnit, FieldsExperimentMeta>>>> retType = new TypeReference<List<List<Tuple3<FieldsExperimentalUnit, FieldsHasExperimentalUnit, FieldsExperimentMeta>>>>() {};
List<List<Tuple3<FieldsExperimentalUnit, FieldsHasExperimentalUnit, FieldsExperimentMeta>>> res = caller.jsonrpcCall("CDMI_EntityAPI.get_relationship_IsExperimentalUnitOf", args, retType, true, false);
return res.get(0);
} | List<Tuple3<FieldsExperimentalUnit, FieldsHasExperimentalUnit, FieldsExperimentMeta>> function(List<String> ids, List<String> fromFields, List<String> relFields, List<String> toFields) throws IOException, JsonClientException { List<Object> args = new ArrayList<Object>(); args.add(ids); args.add(fromFields); args.add(relFields); args.add(toFields); TypeReference<List<List<Tuple3<FieldsExperimentalUnit, FieldsHasExperimentalUnit, FieldsExperimentMeta>>>> retType = new TypeReference<List<List<Tuple3<FieldsExperimentalUnit, FieldsHasExperimentalUnit, FieldsExperimentMeta>>>>() {}; List<List<Tuple3<FieldsExperimentalUnit, FieldsHasExperimentalUnit, FieldsExperimentMeta>>> res = caller.jsonrpcCall(STR, args, retType, true, false); return res.get(0); } | /**
* <p>Original spec-file function name: get_relationship_IsExperimentalUnitOf</p>
* <pre>
* </pre>
* @param ids instance of list of String
* @param fromFields instance of list of String
* @param relFields instance of list of String
* @param toFields instance of list of String
* @return instance of list of tuple of size 3: type {@link us.kbase.cdmientityapi.FieldsExperimentalUnit FieldsExperimentalUnit} (original type "fields_ExperimentalUnit"), type {@link us.kbase.cdmientityapi.FieldsHasExperimentalUnit FieldsHasExperimentalUnit} (original type "fields_HasExperimentalUnit"), type {@link us.kbase.cdmientityapi.FieldsExperimentMeta FieldsExperimentMeta} (original type "fields_ExperimentMeta")
* @throws IOException if an IO exception occurs
* @throws JsonClientException if a JSON RPC exception occurs
*/ | Original spec-file function name: get_relationship_IsExperimentalUnitOf <code> </code> | getRelationshipIsExperimentalUnitOf | {
"repo_name": "kbase/trees",
"path": "src/us/kbase/cdmientityapi/CDMIEntityAPIClient.java",
"license": "mit",
"size": 869221
} | [
"com.fasterxml.jackson.core.type.TypeReference",
"java.io.IOException",
"java.util.ArrayList",
"java.util.List",
"us.kbase.common.service.JsonClientException",
"us.kbase.common.service.Tuple3"
] | import com.fasterxml.jackson.core.type.TypeReference; import java.io.IOException; import java.util.ArrayList; import java.util.List; import us.kbase.common.service.JsonClientException; import us.kbase.common.service.Tuple3; | import com.fasterxml.jackson.core.type.*; import java.io.*; import java.util.*; import us.kbase.common.service.*; | [
"com.fasterxml.jackson",
"java.io",
"java.util",
"us.kbase.common"
] | com.fasterxml.jackson; java.io; java.util; us.kbase.common; | 1,967,581 |
default double lt(double value) {
return AdditionalMatchers.lt(value);
} | default double lt(double value) { return AdditionalMatchers.lt(value); } | /**
* Delegates call to {@link AdditionalMatchers#lt(double)}.
*/ | Delegates call to <code>AdditionalMatchers#lt(double)</code> | lt | {
"repo_name": "szpak/mockito-java8",
"path": "src/main/java/info/solidsoft/mockito/java8/api/WithAdditionalMatchers.java",
"license": "apache-2.0",
"size": 12875
} | [
"org.mockito.AdditionalMatchers"
] | import org.mockito.AdditionalMatchers; | import org.mockito.*; | [
"org.mockito"
] | org.mockito; | 471,881 |
@Override
public final List<MTType> getComponentTypes() {
return myComponents;
} | final List<MTType> function() { return myComponents; } | /**
* <p>This method returns a list of {@link MTType}s
* that are part of this type.</p>
*
* @return The list of {@link MTType}s in this big union type.
*/ | This method returns a list of <code>MTType</code>s that are part of this type | getComponentTypes | {
"repo_name": "mikekab/RESOLVE",
"path": "src/main/java/edu/clemson/cs/rsrg/typeandpopulate/mathtypes/MTFunctionApplication.java",
"license": "bsd-3-clause",
"size": 11560
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 212,025 |
protected void logError(ServerRequest request, HttpStatus errorStatus) {
Throwable ex = getError(request);
log(request, ex, (errorStatus.is5xxServerError() ? logger::error : logger::warn));
} | void function(ServerRequest request, HttpStatus errorStatus) { Throwable ex = getError(request); log(request, ex, (errorStatus.is5xxServerError() ? logger::error : logger::warn)); } | /**
* Log the original exception if handling it results in a Server Error or a Bad
* Request (Client Error with 400 status code) one.
* @param request the source request
* @param errorStatus the HTTP error status
*/ | Log the original exception if handling it results in a Server Error or a Bad Request (Client Error with 400 status code) one | logError | {
"repo_name": "bclozel/spring-boot",
"path": "spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/error/DefaultErrorWebExceptionHandler.java",
"license": "apache-2.0",
"size": 8873
} | [
"org.springframework.http.HttpStatus",
"org.springframework.web.reactive.function.server.ServerRequest"
] | import org.springframework.http.HttpStatus; import org.springframework.web.reactive.function.server.ServerRequest; | import org.springframework.http.*; import org.springframework.web.reactive.function.server.*; | [
"org.springframework.http",
"org.springframework.web"
] | org.springframework.http; org.springframework.web; | 1,272,015 |
public static Object getDataBasedOnDataType(String data, DataType actualDataType) {
if (null == data || CarbonCommonConstants.MEMBER_DEFAULT_VAL.equals(data)) {
return null;
}
try {
switch (actualDataType) {
case INT:
if (data.isEmpty()) {
return null;
}
return Integer.parseInt(data);
case SHORT:
if (data.isEmpty()) {
return null;
}
return Short.parseShort(data);
case DOUBLE:
if (data.isEmpty()) {
return null;
}
return Double.parseDouble(data);
case LONG:
if (data.isEmpty()) {
return null;
}
return Long.parseLong(data);
case DATE:
if (data.isEmpty()) {
return null;
}
try {
Date dateToStr = dateformatter.get().parse(data);
return dateToStr.getTime() * 1000;
} catch (ParseException e) {
LOGGER.error("Cannot convert" + data + " to Time/Long type value" + e.getMessage());
return null;
}
case TIMESTAMP:
if (data.isEmpty()) {
return null;
}
try {
Date dateToStr = timeStampformatter.get().parse(data);
return dateToStr.getTime() * 1000;
} catch (ParseException e) {
LOGGER.error("Cannot convert" + data + " to Time/Long type value" + e.getMessage());
return null;
}
case DECIMAL:
if (data.isEmpty()) {
return null;
}
java.math.BigDecimal javaDecVal = new java.math.BigDecimal(data);
return org.apache.spark.sql.types.Decimal.apply(javaDecVal);
default:
return UTF8String.fromString(data);
}
} catch (NumberFormatException ex) {
LOGGER.error("Problem while converting data type" + data);
return null;
}
} | static Object function(String data, DataType actualDataType) { if (null == data CarbonCommonConstants.MEMBER_DEFAULT_VAL.equals(data)) { return null; } try { switch (actualDataType) { case INT: if (data.isEmpty()) { return null; } return Integer.parseInt(data); case SHORT: if (data.isEmpty()) { return null; } return Short.parseShort(data); case DOUBLE: if (data.isEmpty()) { return null; } return Double.parseDouble(data); case LONG: if (data.isEmpty()) { return null; } return Long.parseLong(data); case DATE: if (data.isEmpty()) { return null; } try { Date dateToStr = dateformatter.get().parse(data); return dateToStr.getTime() * 1000; } catch (ParseException e) { LOGGER.error(STR + data + STR + e.getMessage()); return null; } case TIMESTAMP: if (data.isEmpty()) { return null; } try { Date dateToStr = timeStampformatter.get().parse(data); return dateToStr.getTime() * 1000; } catch (ParseException e) { LOGGER.error(STR + data + STR + e.getMessage()); return null; } case DECIMAL: if (data.isEmpty()) { return null; } java.math.BigDecimal javaDecVal = new java.math.BigDecimal(data); return org.apache.spark.sql.types.Decimal.apply(javaDecVal); default: return UTF8String.fromString(data); } } catch (NumberFormatException ex) { LOGGER.error(STR + data); return null; } } | /**
* Below method will be used to convert the data passed to its actual data
* type
*
* @param data data
* @param actualDataType actual data type
* @return actual data after conversion
*/ | Below method will be used to convert the data passed to its actual data type | getDataBasedOnDataType | {
"repo_name": "Sephiroth-Lin/incubator-carbondata",
"path": "core/src/main/java/org/apache/carbondata/core/util/DataTypeUtil.java",
"license": "apache-2.0",
"size": 22305
} | [
"java.math.BigDecimal",
"java.text.ParseException",
"java.util.Date",
"org.apache.carbondata.core.constants.CarbonCommonConstants",
"org.apache.carbondata.core.metadata.datatype.DataType",
"org.apache.spark.unsafe.types.UTF8String"
] | import java.math.BigDecimal; import java.text.ParseException; import java.util.Date; import org.apache.carbondata.core.constants.CarbonCommonConstants; import org.apache.carbondata.core.metadata.datatype.DataType; import org.apache.spark.unsafe.types.UTF8String; | import java.math.*; import java.text.*; import java.util.*; import org.apache.carbondata.core.constants.*; import org.apache.carbondata.core.metadata.datatype.*; import org.apache.spark.unsafe.types.*; | [
"java.math",
"java.text",
"java.util",
"org.apache.carbondata",
"org.apache.spark"
] | java.math; java.text; java.util; org.apache.carbondata; org.apache.spark; | 645,251 |
public File getExtensionsDirectory() {
return new File(getConfigDirectory(), "extensions/");
} | File function() { return new File(getConfigDirectory(), STR); } | /**
* Returns the locations of the extensions.
*
* @return
*/ | Returns the locations of the extensions | getExtensionsDirectory | {
"repo_name": "sk89q/CommandHelper",
"path": "src/main/java/com/laytonsmith/core/MethodScriptFileLocations.java",
"license": "mit",
"size": 6589
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 1,147,241 |
public boolean afterExchange(GridDhtPartitionsExchangeFuture exchFut) throws IgniteCheckedException; | boolean function(GridDhtPartitionsExchangeFuture exchFut) throws IgniteCheckedException; | /**
* Post-initializes this topology.
*
* @param exchFut Exchange future.
* @return {@code True} if mapping was changed.
* @throws IgniteCheckedException If failed.
*/ | Post-initializes this topology | afterExchange | {
"repo_name": "leveyj/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopology.java",
"license": "apache-2.0",
"size": 8671
} | [
"org.apache.ignite.IgniteCheckedException",
"org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture"
] | import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture; | import org.apache.ignite.*; import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.*; | [
"org.apache.ignite"
] | org.apache.ignite; | 928,835 |
private boolean valueEquals(Argument arg, Parameter param) throws LessException {
Node val1 = arg.value();
Node val2 = param.value();
if (!val1.equals(val2)) {
// If Node.equals() fails, try compare the rendered output.
LessContext ctx = callEnv.context();
String v0 = ctx.render(val1);
String v1 = ctx.render(val2);
if (!v0.equals(v1)) {
return false;
}
}
return true;
} | boolean function(Argument arg, Parameter param) throws LessException { Node val1 = arg.value(); Node val2 = param.value(); if (!val1.equals(val2)) { LessContext ctx = callEnv.context(); String v0 = ctx.render(val1); String v1 = ctx.render(val2); if (!v0.equals(v1)) { return false; } } return true; } | /**
* Check if the argument's value is equal to the parameter's value. It first
* tries the Node.equals() method, and if that fails it falls back to comparing
* the rendered output of each node.
*/ | Check if the argument's value is equal to the parameter's value. It first tries the Node.equals() method, and if that fails it falls back to comparing the rendered output of each node | valueEquals | {
"repo_name": "phensley/less-compiler",
"path": "less-core/src/main/java/com/squarespace/less/exec/MixinMatcher.java",
"license": "apache-2.0",
"size": 8003
} | [
"com.squarespace.less.LessContext",
"com.squarespace.less.LessException",
"com.squarespace.less.model.Argument",
"com.squarespace.less.model.Node",
"com.squarespace.less.model.Parameter"
] | import com.squarespace.less.LessContext; import com.squarespace.less.LessException; import com.squarespace.less.model.Argument; import com.squarespace.less.model.Node; import com.squarespace.less.model.Parameter; | import com.squarespace.less.*; import com.squarespace.less.model.*; | [
"com.squarespace.less"
] | com.squarespace.less; | 2,392,797 |
protected ie.ucd.srg.ivj.ejb.associations.interfaces.ManyLink getLijstpositiesLink() {
if (lijstpositiesLink == null)
lijstpositiesLink = new KieslijstenToLijstpositiesLink(this);
return lijstpositiesLink;
} | ie.ucd.srg.ivj.ejb.associations.interfaces.ManyLink function() { if (lijstpositiesLink == null) lijstpositiesLink = new KieslijstenToLijstpositiesLink(this); return lijstpositiesLink; } | /**
* This method was generated for supporting the association named lijstposities.
* It will be deleted/edited when the association is deleted/edited.
*/ | This method was generated for supporting the association named lijstposities. It will be deleted/edited when the association is deleted/edited | getLijstpositiesLink | {
"repo_name": "GaloisInc/KOA",
"path": "infrastructure/source/WebVotingSystem/src/ie/ucd/srg/koa/koaschema/KieslijstenBean.java",
"license": "gpl-2.0",
"size": 7923
} | [
"ie.ucd.srg.koa.koaschema.KieslijstenToLijstpositiesLink"
] | import ie.ucd.srg.koa.koaschema.KieslijstenToLijstpositiesLink; | import ie.ucd.srg.koa.koaschema.*; | [
"ie.ucd.srg"
] | ie.ucd.srg; | 2,019,156 |
boolean evaluate(@NotNull RuleContext ruleContext,
DOMable<T> domable); | boolean evaluate(@NotNull RuleContext ruleContext, DOMable<T> domable); | /**
* Evaluates based on the context and property to ascertain if the property
* should be considered valid for use at the point of invokation.
*
* @param ruleContext the context the rule is evaluated in
* @param domable the property this rule is bound to
* @return true if the property should be considered valid for use
*/ | Evaluates based on the context and property to ascertain if the property should be considered valid for use at the point of invokation | evaluate | {
"repo_name": "schaloner/Intellijad",
"path": "src/java/net/stevechaloner/intellijad/config/rules/RenderRule.java",
"license": "apache-2.0",
"size": 1394
} | [
"net.stevechaloner.idea.util.properties.DOMable",
"org.jetbrains.annotations.NotNull"
] | import net.stevechaloner.idea.util.properties.DOMable; import org.jetbrains.annotations.NotNull; | import net.stevechaloner.idea.util.properties.*; import org.jetbrains.annotations.*; | [
"net.stevechaloner.idea",
"org.jetbrains.annotations"
] | net.stevechaloner.idea; org.jetbrains.annotations; | 1,909,203 |
public void setAppropriationEncumbrance(KualiDecimal appropriationEncumbrance) {
this.appropriationEncumbrance = appropriationEncumbrance;
} | void function(KualiDecimal appropriationEncumbrance) { this.appropriationEncumbrance = appropriationEncumbrance; } | /**
* Sets the appropriationEncumbrance attribute.
*
* @param appropriationEncumbrance The appropriationEncumbrance to set.
*/ | Sets the appropriationEncumbrance attribute | setAppropriationEncumbrance | {
"repo_name": "ua-eas/kfs-devops-automation-fork",
"path": "kfs-core/src/main/java/org/kuali/kfs/gl/businessobject/PendingBalancesMove.java",
"license": "agpl-3.0",
"size": 5043
} | [
"org.kuali.rice.core.api.util.type.KualiDecimal"
] | import org.kuali.rice.core.api.util.type.KualiDecimal; | import org.kuali.rice.core.api.util.type.*; | [
"org.kuali.rice"
] | org.kuali.rice; | 2,809,435 |
protected List<E> getDelegate() {
return this.delegate;
} | List<E> function() { return this.delegate; } | /**
* Returns the delegate list.
*
* @return The delegate list.
*/ | Returns the delegate list | getDelegate | {
"repo_name": "pecko/debrief",
"path": "org.mwc.asset.comms/docs/restlet_src/org.restlet/org/restlet/util/WrapperList.java",
"license": "epl-1.0",
"size": 10238
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,222,667 |
public void activateEditor(Property property, Point location) {
try {
// de-activate old editor
deactivateEditor(true);
// activate editor
PropertyEditor editor = property.getEditor();
try {
if (editor.activate(this, property, location)) {
m_activeEditor = editor;
}
} catch (Throwable e) {
handleException(e);
}
// set bounds
setActiveEditorBounds();
} catch (NullPointerException e) {
if (EnvironmentUtils.IS_MAC) {
// Workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=388574
PropertyEditor editor = property.getEditor();
PropertyEditorPresentation presentation = editor.getPresentation();
if (presentation instanceof ButtonPropertyEditorPresentation) {
ButtonPropertyEditorPresentation button =
(ButtonPropertyEditorPresentation) presentation;
try {
button.click(this, property);
} catch (Exception ex) {
deactivateEditor(false);
handleException(e);
}
return;
}
}
DesignerPlugin.log(e);
} catch (Throwable e) {
DesignerPlugin.log(e);
}
} | void function(Property property, Point location) { try { deactivateEditor(true); PropertyEditor editor = property.getEditor(); try { if (editor.activate(this, property, location)) { m_activeEditor = editor; } } catch (Throwable e) { handleException(e); } setActiveEditorBounds(); } catch (NullPointerException e) { if (EnvironmentUtils.IS_MAC) { PropertyEditor editor = property.getEditor(); PropertyEditorPresentation presentation = editor.getPresentation(); if (presentation instanceof ButtonPropertyEditorPresentation) { ButtonPropertyEditorPresentation button = (ButtonPropertyEditorPresentation) presentation; try { button.click(this, property); } catch (Exception ex) { deactivateEditor(false); handleException(e); } return; } } DesignerPlugin.log(e); } catch (Throwable e) { DesignerPlugin.log(e); } } | /**
* Tries to activate editor for {@link PropertyInfo} under cursor.
*
* @param location
* the mouse location, if editor is activated using mouse click, or <code>null</code> if
* it is activated using keyboard.
*/ | Tries to activate editor for <code>PropertyInfo</code> under cursor | activateEditor | {
"repo_name": "s20121035/rk3288_android5.1_repo",
"path": "external/eclipse-windowbuilder/propertysheet/src/org/eclipse/wb/internal/core/model/property/table/PropertyTable.java",
"license": "gpl-3.0",
"size": 51611
} | [
"org.eclipse.swt.graphics.Point",
"org.eclipse.wb.internal.core.DesignerPlugin",
"org.eclipse.wb.internal.core.EnvironmentUtils",
"org.eclipse.wb.internal.core.model.property.Property",
"org.eclipse.wb.internal.core.model.property.editor.PropertyEditor",
"org.eclipse.wb.internal.core.model.property.editor.presentation.ButtonPropertyEditorPresentation",
"org.eclipse.wb.internal.core.model.property.editor.presentation.PropertyEditorPresentation"
] | import org.eclipse.swt.graphics.Point; import org.eclipse.wb.internal.core.DesignerPlugin; import org.eclipse.wb.internal.core.EnvironmentUtils; import org.eclipse.wb.internal.core.model.property.Property; import org.eclipse.wb.internal.core.model.property.editor.PropertyEditor; import org.eclipse.wb.internal.core.model.property.editor.presentation.ButtonPropertyEditorPresentation; import org.eclipse.wb.internal.core.model.property.editor.presentation.PropertyEditorPresentation; | import org.eclipse.swt.graphics.*; import org.eclipse.wb.internal.core.*; import org.eclipse.wb.internal.core.model.property.*; import org.eclipse.wb.internal.core.model.property.editor.*; import org.eclipse.wb.internal.core.model.property.editor.presentation.*; | [
"org.eclipse.swt",
"org.eclipse.wb"
] | org.eclipse.swt; org.eclipse.wb; | 2,587,830 |
private void track(MeasurementZevent event) {
MeasurementZeventSource sourceId =
(MeasurementZeventSource)event.getSourceId();
ResourceMetricTracker tracker = getResourceTrackerAddIfNecessary(sourceId);
MeasurementZeventPayload payload =
(MeasurementZeventPayload)event.getPayload();
MetricValue val = payload.getValue();
tracker.trackMetricValue(val);
if (_log.isDebugEnabled()) {
_log.debug("Tracking measurement for trigger ["+
getTriggerNameWithPartitionDesc()+
"]: "+event+", timestamp="+val.getTimestamp());
}
} | void function(MeasurementZevent event) { MeasurementZeventSource sourceId = (MeasurementZeventSource)event.getSourceId(); ResourceMetricTracker tracker = getResourceTrackerAddIfNecessary(sourceId); MeasurementZeventPayload payload = (MeasurementZeventPayload)event.getPayload(); MetricValue val = payload.getValue(); tracker.trackMetricValue(val); if (_log.isDebugEnabled()) { _log.debug(STR+ getTriggerNameWithPartitionDesc()+ STR+event+STR+val.getTimestamp()); } } | /**
* Track this measurement event.
*
* @param event The measurement event.
*/ | Track this measurement event | track | {
"repo_name": "cc14514/hq6",
"path": "hq-server/src/main/java/org/hyperic/hq/measurement/galerts/MeasurementGtrigger.java",
"license": "unlicense",
"size": 35232
} | [
"org.hyperic.hq.measurement.server.session.MeasurementZevent",
"org.hyperic.hq.product.MetricValue"
] | import org.hyperic.hq.measurement.server.session.MeasurementZevent; import org.hyperic.hq.product.MetricValue; | import org.hyperic.hq.measurement.server.session.*; import org.hyperic.hq.product.*; | [
"org.hyperic.hq"
] | org.hyperic.hq; | 236,953 |
public boolean setReplication(String src, short replication)
throws IOException {
boolean status = setReplicationInternal(src, replication);
getEditLog().logSync();
if (status && auditLog.isInfoEnabled() && isExternalInvocation()) {
logAuditEvent(UserGroupInformation.getCurrentUser(),
Server.getRemoteIp(),
"setReplication", src, null, null);
}
return status;
} | boolean function(String src, short replication) throws IOException { boolean status = setReplicationInternal(src, replication); getEditLog().logSync(); if (status && auditLog.isInfoEnabled() && isExternalInvocation()) { logAuditEvent(UserGroupInformation.getCurrentUser(), Server.getRemoteIp(), STR, src, null, null); } return status; } | /**
* Set replication for an existing file.
*
* The NameNode sets new replication and schedules either replication of
* under-replicated data blocks or removal of the eccessive block copies
* if the blocks are over-replicated.
*
* @see ClientProtocol#setReplication(String, short)
* @param src file name
* @param replication new replication
* @return true if successful;
* false if file does not exist or is a directory
*/ | Set replication for an existing file. The NameNode sets new replication and schedules either replication of under-replicated data blocks or removal of the eccessive block copies if the blocks are over-replicated | setReplication | {
"repo_name": "davidl1/hortonworks-extension",
"path": "src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java",
"license": "apache-2.0",
"size": 218585
} | [
"java.io.IOException",
"org.apache.hadoop.ipc.Server",
"org.apache.hadoop.security.UserGroupInformation"
] | import java.io.IOException; import org.apache.hadoop.ipc.Server; import org.apache.hadoop.security.UserGroupInformation; | import java.io.*; import org.apache.hadoop.ipc.*; import org.apache.hadoop.security.*; | [
"java.io",
"org.apache.hadoop"
] | java.io; org.apache.hadoop; | 1,232,225 |
@Nullable public static IgnoreDescriptor forClass(Class cls) {
Class cls0 = cls;
while (Test.class.isAssignableFrom(cls0)) {
if (cls0.isAnnotationPresent(IgniteIgnore.class)) {
IgniteIgnore ignore = (IgniteIgnore)cls0.getAnnotation(IgniteIgnore.class);
String reason = ignore.value();
if (F.isEmpty(reason))
throw new IllegalArgumentException("Reason is not set for ignored test [class=" +
cls0.getName() + ']');
return new IgnoreDescriptor(reason, ignore.forceFailure());
}
cls0 = cls0.getSuperclass();
}
return null;
} | @Nullable static IgnoreDescriptor function(Class cls) { Class cls0 = cls; while (Test.class.isAssignableFrom(cls0)) { if (cls0.isAnnotationPresent(IgniteIgnore.class)) { IgniteIgnore ignore = (IgniteIgnore)cls0.getAnnotation(IgniteIgnore.class); String reason = ignore.value(); if (F.isEmpty(reason)) throw new IllegalArgumentException(STR + cls0.getName() + ']'); return new IgnoreDescriptor(reason, ignore.forceFailure()); } cls0 = cls0.getSuperclass(); } return null; } | /**
* Get descriptor for class (if any).
*
* @param cls Class.
* @return Descriptor or {@code null}.
*/ | Get descriptor for class (if any) | forClass | {
"repo_name": "leveyj/ignite",
"path": "modules/core/src/test/java/org/apache/ignite/testframework/IgniteTestSuite.java",
"license": "apache-2.0",
"size": 12098
} | [
"junit.framework.Test",
"org.apache.ignite.internal.util.typedef.F",
"org.apache.ignite.testsuites.IgniteIgnore",
"org.jetbrains.annotations.Nullable"
] | import junit.framework.Test; import org.apache.ignite.internal.util.typedef.F; import org.apache.ignite.testsuites.IgniteIgnore; import org.jetbrains.annotations.Nullable; | import junit.framework.*; import org.apache.ignite.internal.util.typedef.*; import org.apache.ignite.testsuites.*; import org.jetbrains.annotations.*; | [
"junit.framework",
"org.apache.ignite",
"org.jetbrains.annotations"
] | junit.framework; org.apache.ignite; org.jetbrains.annotations; | 189,608 |
public java.util.Date getLastRetrievedTimestamp()
{
return lastRetrievedTimestamp;
} | java.util.Date function() { return lastRetrievedTimestamp; } | /**
* Method 'getLastRetrievedTimestamp'
*
* @return java.util.Date
*/ | Method 'getLastRetrievedTimestamp' | getLastRetrievedTimestamp | {
"repo_name": "VHAINNOVATIONS/Telepathology",
"path": "Source/Java/CoreValueObjects/storage/ArtifactInstance.java",
"license": "apache-2.0",
"size": 2382
} | [
"java.util.Date"
] | import java.util.Date; | import java.util.*; | [
"java.util"
] | java.util; | 628,915 |
@Test(groups = "Integration")
public void testRebindsWithEmptyServerPool() throws Exception {
// Set up nginx with a server pool
DynamicCluster origServerPool = origApp.createAndManageChild(EntitySpec.create(DynamicCluster.class)
.configure(DynamicCluster.MEMBER_SPEC, EntitySpec.create(JBoss7Server.class))
.configure("initialSize", 0));
NginxController origNginx = origApp.createAndManageChild(EntitySpec.create(NginxController.class)
.configure("serverPool", origServerPool)
.configure("domain", "localhost"));
// Start the app, and ensure reachable; start polling the URL
origApp.start(ImmutableList.of(localhostProvisioningLocation));
String rootUrl = origNginx.getAttribute(NginxController.ROOT_URL);
int nginxPort = origNginx.getAttribute(NginxController.PROXY_HTTP_PORT);
assertHttpStatusCodeEventuallyEquals(rootUrl, 404);
WebAppMonitor monitor = newWebAppMonitor(rootUrl, 404);
final String origConfigFile = origNginx.getConfigFile();
newApp = rebind();
final NginxController newNginx = (NginxController) Iterables.find(newApp.getChildren(), Predicates.instanceOf(NginxController.class));
assertEquals(newNginx.getConfigFile(), origConfigFile);
assertEquals(newNginx.getAttribute(NginxController.SERVICE_STATE), Lifecycle.RUNNING);
assertEquals(newNginx.getAttribute(NginxController.PROXY_HTTP_PORT), (Integer)nginxPort);
assertEquals(newNginx.getAttribute(NginxController.ROOT_URL), rootUrl);
assertEquals(newNginx.getAttribute(NginxController.PROXY_HTTP_PORT), origNginx.getAttribute(NginxController.PROXY_HTTP_PORT));
assertEquals(newNginx.getConfig(NginxController.STICKY), origNginx.getConfig(NginxController.STICKY));
assertAttributeEqualsEventually(newNginx, SoftwareProcess.SERVICE_UP, true);
assertHttpStatusCodeEventuallyEquals(rootUrl, 404);
assertEquals(monitor.getFailures(), 0);
} | @Test(groups = STR) void function() throws Exception { DynamicCluster origServerPool = origApp.createAndManageChild(EntitySpec.create(DynamicCluster.class) .configure(DynamicCluster.MEMBER_SPEC, EntitySpec.create(JBoss7Server.class)) .configure(STR, 0)); NginxController origNginx = origApp.createAndManageChild(EntitySpec.create(NginxController.class) .configure(STR, origServerPool) .configure(STR, STR)); origApp.start(ImmutableList.of(localhostProvisioningLocation)); String rootUrl = origNginx.getAttribute(NginxController.ROOT_URL); int nginxPort = origNginx.getAttribute(NginxController.PROXY_HTTP_PORT); assertHttpStatusCodeEventuallyEquals(rootUrl, 404); WebAppMonitor monitor = newWebAppMonitor(rootUrl, 404); final String origConfigFile = origNginx.getConfigFile(); newApp = rebind(); final NginxController newNginx = (NginxController) Iterables.find(newApp.getChildren(), Predicates.instanceOf(NginxController.class)); assertEquals(newNginx.getConfigFile(), origConfigFile); assertEquals(newNginx.getAttribute(NginxController.SERVICE_STATE), Lifecycle.RUNNING); assertEquals(newNginx.getAttribute(NginxController.PROXY_HTTP_PORT), (Integer)nginxPort); assertEquals(newNginx.getAttribute(NginxController.ROOT_URL), rootUrl); assertEquals(newNginx.getAttribute(NginxController.PROXY_HTTP_PORT), origNginx.getAttribute(NginxController.PROXY_HTTP_PORT)); assertEquals(newNginx.getConfig(NginxController.STICKY), origNginx.getConfig(NginxController.STICKY)); assertAttributeEqualsEventually(newNginx, SoftwareProcess.SERVICE_UP, true); assertHttpStatusCodeEventuallyEquals(rootUrl, 404); assertEquals(monitor.getFailures(), 0); } | /**
* Test can rebind to the simplest possible nginx configuration (i.e. no server pool).
*/ | Test can rebind to the simplest possible nginx configuration (i.e. no server pool) | testRebindsWithEmptyServerPool | {
"repo_name": "bmwshop/brooklyn",
"path": "software/webapp/src/test/java/brooklyn/entity/proxy/nginx/NginxRebindIntegrationTest.java",
"license": "apache-2.0",
"size": 12287
} | [
"com.google.common.base.Predicates",
"com.google.common.collect.ImmutableList",
"com.google.common.collect.Iterables",
"org.testng.Assert",
"org.testng.annotations.Test"
] | import com.google.common.base.Predicates; import com.google.common.collect.ImmutableList; import com.google.common.collect.Iterables; import org.testng.Assert; import org.testng.annotations.Test; | import com.google.common.base.*; import com.google.common.collect.*; import org.testng.*; import org.testng.annotations.*; | [
"com.google.common",
"org.testng",
"org.testng.annotations"
] | com.google.common; org.testng; org.testng.annotations; | 2,148,947 |
void add(int index, TabItem item); | void add(int index, TabItem item); | /**
* Inserts an item at the specified index.
* @param index
* @param item
*/ | Inserts an item at the specified index | add | {
"repo_name": "thekeenant/bukkit-tabbed",
"path": "core/src/main/java/com/keenant/tabbed/tablist/CustomTabList.java",
"license": "gpl-3.0",
"size": 1837
} | [
"com.keenant.tabbed.item.TabItem"
] | import com.keenant.tabbed.item.TabItem; | import com.keenant.tabbed.item.*; | [
"com.keenant.tabbed"
] | com.keenant.tabbed; | 976,661 |
public void openDriver(SurfaceHolder holder) throws IOException {
if (camera == null) {
camera = Camera.open();
if (camera == null) {
throw new IOException();
}
}
camera.setPreviewDisplay(holder);
if (!initialized) {
initialized = true;
configManager.initFromCameraParameters(camera);
}
configManager.setDesiredCameraParameters(camera);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
reverseImage = prefs.getBoolean(PreferencesActivity.KEY_REVERSE_IMAGE, false);
// if (prefs.getBoolean(PreferencesActivity.KEY_FRONT_LIGHT, false)) {
// FlashlightManager.enableFlashlight();
// }
//enableLight();
} | void function(SurfaceHolder holder) throws IOException { if (camera == null) { camera = Camera.open(); if (camera == null) { throw new IOException(); } } camera.setPreviewDisplay(holder); if (!initialized) { initialized = true; configManager.initFromCameraParameters(camera); } configManager.setDesiredCameraParameters(camera); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); reverseImage = prefs.getBoolean(PreferencesActivity.KEY_REVERSE_IMAGE, false); } | /**
* Opens the camera driver and initializes the hardware parameters.
*
* @param holder The surface object which the camera will draw preview frames into.
* @throws IOException Indicates the camera driver failed to open.
*/ | Opens the camera driver and initializes the hardware parameters | openDriver | {
"repo_name": "markusarwan/reverser",
"path": "android/src/edu/sfsu/cs/orange/ocr/camera/CameraManager.java",
"license": "apache-2.0",
"size": 11827
} | [
"android.content.SharedPreferences",
"android.hardware.Camera",
"android.preference.PreferenceManager",
"android.view.SurfaceHolder",
"edu.sfsu.cs.orange.ocr.PreferencesActivity",
"java.io.IOException"
] | import android.content.SharedPreferences; import android.hardware.Camera; import android.preference.PreferenceManager; import android.view.SurfaceHolder; import edu.sfsu.cs.orange.ocr.PreferencesActivity; import java.io.IOException; | import android.content.*; import android.hardware.*; import android.preference.*; import android.view.*; import edu.sfsu.cs.orange.ocr.*; import java.io.*; | [
"android.content",
"android.hardware",
"android.preference",
"android.view",
"edu.sfsu.cs",
"java.io"
] | android.content; android.hardware; android.preference; android.view; edu.sfsu.cs; java.io; | 1,609,323 |
private List<User> getUsers(final List<String> userUuids) throws GbException {
try {
final List<User> users = this.userDirectoryService.getUsers(userUuids);
Collections.sort(users, new LastNameComparator()); // default sort
return users;
} catch (final RuntimeException e) {
// an LDAP exception can sometimes be thrown here, catch and rethrow
throw new GbException("An error occurred getting the list of users.", e);
}
} | List<User> function(final List<String> userUuids) throws GbException { try { final List<User> users = this.userDirectoryService.getUsers(userUuids); Collections.sort(users, new LastNameComparator()); return users; } catch (final RuntimeException e) { throw new GbException(STR, e); } } | /**
* Given a list of uuids, get a list of Users
*
* @param userUuids list of user uuids
* @return
*/ | Given a list of uuids, get a list of Users | getUsers | {
"repo_name": "ktakacs/sakai",
"path": "gradebookng/tool/src/java/org/sakaiproject/gradebookng/business/GradebookNgBusinessService.java",
"license": "apache-2.0",
"size": 63461
} | [
"java.util.Collections",
"java.util.List",
"org.sakaiproject.gradebookng.business.exception.GbException",
"org.sakaiproject.user.api.User"
] | import java.util.Collections; import java.util.List; import org.sakaiproject.gradebookng.business.exception.GbException; import org.sakaiproject.user.api.User; | import java.util.*; import org.sakaiproject.gradebookng.business.exception.*; import org.sakaiproject.user.api.*; | [
"java.util",
"org.sakaiproject.gradebookng",
"org.sakaiproject.user"
] | java.util; org.sakaiproject.gradebookng; org.sakaiproject.user; | 368,723 |
@Deprecated
public String getTier() {
Tier tier = (Tier) getProperty(Tier.TierPropName);
return (tier == null) ? null : String.valueOf(tier.getValue());
} | String function() { Tier tier = (Tier) getProperty(Tier.TierPropName); return (tier == null) ? null : String.valueOf(tier.getValue()); } | /**
* This method returns the configured Tier of a node
*
* @return Configured tier
*
* @deprecated replaced by getProperty(Tier.TierPropName)
*/ | This method returns the configured Tier of a node | getTier | {
"repo_name": "xiaohanz/softcontroller",
"path": "opendaylight/switchmanager/api/src/main/java/org/opendaylight/controller/switchmanager/SwitchConfig.java",
"license": "epl-1.0",
"size": 6142
} | [
"org.opendaylight.controller.sal.core.Tier"
] | import org.opendaylight.controller.sal.core.Tier; | import org.opendaylight.controller.sal.core.*; | [
"org.opendaylight.controller"
] | org.opendaylight.controller; | 1,932,052 |
MS sendSync(@NotNull MQ message, @Nullable Long timeout) throws TransportTimeoutException, TransportSendException; | MS sendSync(@NotNull MQ message, @Nullable Long timeout) throws TransportTimeoutException, TransportSendException; | /**
* Send a request message to a device waiting for the response.
* <p>
* The timeout is optional. If {@code null} the default one defined by the implementation will be used.
*
* @param message The request message to send.
* @param timeout The timeout for the operation.
* @return The response to the request message.
* @throws TransportTimeoutException if waiting of the response goes on timeout.
* @throws TransportSendException if sending the request produces any error.
* @since 1.0.0
*/ | Send a request message to a device waiting for the response. The timeout is optional. If null the default one defined by the implementation will be used | sendSync | {
"repo_name": "LeoNerdoG/kapua",
"path": "transport/api/src/main/java/org/eclipse/kapua/transport/TransportFacade.java",
"license": "epl-1.0",
"size": 4318
} | [
"javax.annotation.Nullable",
"javax.validation.constraints.NotNull",
"org.eclipse.kapua.transport.exception.TransportSendException",
"org.eclipse.kapua.transport.exception.TransportTimeoutException"
] | import javax.annotation.Nullable; import javax.validation.constraints.NotNull; import org.eclipse.kapua.transport.exception.TransportSendException; import org.eclipse.kapua.transport.exception.TransportTimeoutException; | import javax.annotation.*; import javax.validation.constraints.*; import org.eclipse.kapua.transport.exception.*; | [
"javax.annotation",
"javax.validation",
"org.eclipse.kapua"
] | javax.annotation; javax.validation; org.eclipse.kapua; | 2,320,457 |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.