method
stringlengths
13
441k
clean_method
stringlengths
7
313k
doc
stringlengths
17
17.3k
comment
stringlengths
3
1.42k
method_name
stringlengths
1
273
extra
dict
imports
list
imports_info
stringlengths
19
34.8k
cluster_imports_info
stringlengths
15
3.66k
libraries
list
libraries_info
stringlengths
6
661
id
int64
0
2.92M
boolean cancel(int propertyConstant) { if ((mPropertyMask & propertyConstant) != 0 && mNameValuesHolder != null) { int count = mNameValuesHolder.size(); for (int i = 0; i < count; ++i) { NameValuesHolder nameValuesHolder = mNameValuesHolder.get(i); if (nameValuesHolder.mNameConstant == propertyConstant) { mNameValuesHolder.remove(i); mPropertyMask &= ~propertyConstant; return true; } } } return false; } } private HashMap<Animator, PropertyBundle> mAnimatorMap = new HashMap<Animator, PropertyBundle>(); private static class NameValuesHolder { int mNameConstant; float mFromValue; float mDeltaValue; NameValuesHolder(int nameConstant, float fromValue, float deltaValue) { mNameConstant = nameConstant; mFromValue = fromValue; mDeltaValue = deltaValue; } } ViewPropertyAnimatorPreHC(View view) { mView = new WeakReference<View>(view); mProxy = AnimatorProxy.wrap(view); }
boolean cancel(int propertyConstant) { if ((mPropertyMask & propertyConstant) != 0 && mNameValuesHolder != null) { int count = mNameValuesHolder.size(); for (int i = 0; i < count; ++i) { NameValuesHolder nameValuesHolder = mNameValuesHolder.get(i); if (nameValuesHolder.mNameConstant == propertyConstant) { mNameValuesHolder.remove(i); mPropertyMask &= ~propertyConstant; return true; } } } return false; } } private HashMap<Animator, PropertyBundle> mAnimatorMap = new HashMap<Animator, PropertyBundle>(); private static class NameValuesHolder { int mNameConstant; float mFromValue; float mDeltaValue; NameValuesHolder(int nameConstant, float fromValue, float deltaValue) { mNameConstant = nameConstant; mFromValue = fromValue; mDeltaValue = deltaValue; } } ViewPropertyAnimatorPreHC(View view) { mView = new WeakReference<View>(view); mProxy = AnimatorProxy.wrap(view); }
/** * Removes the given property from being animated as a part of this * PropertyBundle. If the property was a part of this bundle, it returns * true to indicate that it was, in fact, canceled. This is an indication * to the caller that a cancellation actually occurred. * * @param propertyConstant The property whose cancellation is requested. * @return true if the given property is a part of this bundle and if it * has therefore been canceled. */
Removes the given property from being animated as a part of this PropertyBundle. If the property was a part of this bundle, it returns true to indicate that it was, in fact, canceled. This is an indication to the caller that a cancellation actually occurred
cancel
{ "repo_name": "lioutasb/CSCartApp", "path": "app/src/main/java/gr/plushost/prototypeapp/view/ViewPropertyAnimatorPreHC.java", "license": "apache-2.0", "size": 27636 }
[ "android.animation.Animator", "android.view.View", "gr.plushost.prototypeapp.animations.AnimatorProxy", "java.lang.ref.WeakReference", "java.util.HashMap" ]
import android.animation.Animator; import android.view.View; import gr.plushost.prototypeapp.animations.AnimatorProxy; import java.lang.ref.WeakReference; import java.util.HashMap;
import android.animation.*; import android.view.*; import gr.plushost.prototypeapp.animations.*; import java.lang.ref.*; import java.util.*;
[ "android.animation", "android.view", "gr.plushost.prototypeapp", "java.lang", "java.util" ]
android.animation; android.view; gr.plushost.prototypeapp; java.lang; java.util;
2,483,298
@Override public boolean isFactoryForType(Object object) { if (object == modelPackage) { return true; } if (object instanceof EObject) { return ((EObject)object).eClass().getEPackage() == modelPackage; } return false; }
boolean function(Object object) { if (object == modelPackage) { return true; } if (object instanceof EObject) { return ((EObject)object).eClass().getEPackage() == modelPackage; } return false; }
/** * Returns whether this factory is applicable for the type of the object. * <!-- begin-user-doc --> * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model. * <!-- end-user-doc --> * @return whether this factory is applicable for the type of the object. * @generated */
Returns whether this factory is applicable for the type of the object. This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model.
isFactoryForType
{ "repo_name": "patrickneubauer/XMLIntellEdit", "path": "xmlintelledit/xmltext/src/main/java/eclassxmlschemadictionary_2_0Simplified/util/Eclassxmlschemadictionary_2_0SimplifiedAdapterFactory.java", "license": "mit", "size": 3764 }
[ "org.eclipse.emf.ecore.EObject" ]
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
724,134
public static synchronized Map<Host, Set<Site>> getSitesPerHost(CatalogType catalog_item) { final CatalogUtil.Cache cache = CatalogUtil.getCatalogCache(catalog_item); final Map<Host, Set<Site>> sites = cache.HOST_SITES;
static synchronized Map<Host, Set<Site>> function(CatalogType catalog_item) { final CatalogUtil.Cache cache = CatalogUtil.getCatalogCache(catalog_item); final Map<Host, Set<Site>> sites = cache.HOST_SITES;
/** * Get a mapping of sites for each host. We have to return the Site objects * in order to get the Partition handle that we want * * @return */
Get a mapping of sites for each host. We have to return the Site objects in order to get the Partition handle that we want
getSitesPerHost
{ "repo_name": "gxyang/hstore", "path": "src/frontend/edu/brown/catalog/CatalogUtil.java", "license": "gpl-3.0", "size": 121408 }
[ "java.util.Map", "java.util.Set", "org.voltdb.catalog.CatalogType", "org.voltdb.catalog.Host", "org.voltdb.catalog.Site" ]
import java.util.Map; import java.util.Set; import org.voltdb.catalog.CatalogType; import org.voltdb.catalog.Host; import org.voltdb.catalog.Site;
import java.util.*; import org.voltdb.catalog.*;
[ "java.util", "org.voltdb.catalog" ]
java.util; org.voltdb.catalog;
880,094
@BeforeClass public static void setRestClient() { try { imClient = new ImClient(IM_DUMMY_PROVIDER_URL, AUTH_FILE_PATH); } catch (ImClientException exception) { ImJavaApiLogger.severe(ImClientTest.class, exception.getMessage()); Assert.fail(); } }
static void function() { try { imClient = new ImClient(IM_DUMMY_PROVIDER_URL, AUTH_FILE_PATH); } catch (ImClientException exception) { ImJavaApiLogger.severe(ImClientTest.class, exception.getMessage()); Assert.fail(); } }
/** * Creates a new rest client. */
Creates a new rest client
setRestClient
{ "repo_name": "indigo-dc/im-java-api", "path": "src/test/java/es/upv/i3m/grycap/im/rest/client/ImClientTest.java", "license": "apache-2.0", "size": 2969 }
[ "es.upv.i3m.grycap.im.exceptions.ImClientException", "es.upv.i3m.grycap.logger.ImJavaApiLogger", "org.junit.Assert" ]
import es.upv.i3m.grycap.im.exceptions.ImClientException; import es.upv.i3m.grycap.logger.ImJavaApiLogger; import org.junit.Assert;
import es.upv.i3m.grycap.im.exceptions.*; import es.upv.i3m.grycap.logger.*; import org.junit.*;
[ "es.upv.i3m", "org.junit" ]
es.upv.i3m; org.junit;
2,417,691
public ChangeNotes createFromIndexedChange(Change change) { return new ChangeNotes(args, change); }
ChangeNotes function(Change change) { return new ChangeNotes(args, change); }
/** * Create change notes for a change that was loaded from index. This method should only be used * when database access is harmful and potentially stale data from the index is acceptable. * * @param change change loaded from secondary index * @return change notes */
Create change notes for a change that was loaded from index. This method should only be used when database access is harmful and potentially stale data from the index is acceptable
createFromIndexedChange
{ "repo_name": "WANdisco/gerrit", "path": "java/com/google/gerrit/server/notedb/ChangeNotes.java", "license": "apache-2.0", "size": 29718 }
[ "com.google.gerrit.reviewdb.client.Change" ]
import com.google.gerrit.reviewdb.client.Change;
import com.google.gerrit.reviewdb.client.*;
[ "com.google.gerrit" ]
com.google.gerrit;
367,570
List<Post> findFirst1ByMonthAndYearOrderByPostUpVotesDesc(String month, int year);
List<Post> findFirst1ByMonthAndYearOrderByPostUpVotesDesc(String month, int year);
/**Post findFirstByyearOrderBypostUpVotesAsc(int year); Post findFirstBydayOrderBypostUpVotesAsc(int day); Post findFirstBymonthOrderBypostUpVotesAsc(String month);**/
Post findFirstByyearOrderBypostUpVotesAsc(int year)
findFirst1ByMonthAndYearOrderByPostUpVotesDesc
{ "repo_name": "Albert017/daw", "path": "fila_de_atras/src/main/java/com/filadeatras/fila_de_atras/repositories/PostRepository.java", "license": "apache-2.0", "size": 1332 }
[ "com.filadeatras.fila_de_atras.models.Post", "java.util.List" ]
import com.filadeatras.fila_de_atras.models.Post; import java.util.List;
import com.filadeatras.fila_de_atras.models.*; import java.util.*;
[ "com.filadeatras.fila_de_atras", "java.util" ]
com.filadeatras.fila_de_atras; java.util;
2,725,017
// TODO(kak): Make this method final @CanIgnoreReturnValue public Converter<B, A> reverse() { Converter<B, A> result = reverse; return (result == null) ? reverse = new ReverseConverter<A, B>(this) : result; } private static final class ReverseConverter<A, B> extends Converter<B, A> implements Serializable { final Converter<A, B> original; ReverseConverter(Converter<A, B> original) { this.original = original; }
Converter<B, A> function() { Converter<B, A> result = reverse; return (result == null) ? reverse = new ReverseConverter<A, B>(this) : result; } private static final class ReverseConverter<A, B> extends Converter<B, A> implements Serializable { final Converter<A, B> original; ReverseConverter(Converter<A, B> original) { this.original = original; }
/** * Returns the reversed view of this converter, which converts {@code this.convert(a)} back to a * value roughly equivalent to {@code a}. * * <p>The returned converter is serializable if {@code this} converter is. */
Returns the reversed view of this converter, which converts this.convert(a) back to a value roughly equivalent to a. The returned converter is serializable if this converter is
reverse
{ "repo_name": "jakubmalek/guava", "path": "guava/src/com/google/common/base/Converter.java", "license": "apache-2.0", "size": 17556 }
[ "java.io.Serializable" ]
import java.io.Serializable;
import java.io.*;
[ "java.io" ]
java.io;
2,548,866
public void doAct(StaplerRequest req, StaplerResponse rsp) throws IOException { if(req.hasParameter("correct")) { rsp.sendRedirect(req.getContextPath()+"/pluginManager"); } }
void function(StaplerRequest req, StaplerResponse rsp) throws IOException { if(req.hasParameter(STR)) { rsp.sendRedirect(req.getContextPath()+STR); } }
/** * Depending on whether the user said "dismiss" or "correct", send him to the right place. */
Depending on whether the user said "dismiss" or "correct", send him to the right place
doAct
{ "repo_name": "oleg-nenashev/jenkins", "path": "core/src/main/java/hudson/PluginWrapper.java", "license": "mit", "size": 47783 }
[ "java.io.IOException", "org.kohsuke.stapler.StaplerRequest", "org.kohsuke.stapler.StaplerResponse" ]
import java.io.IOException; import org.kohsuke.stapler.StaplerRequest; import org.kohsuke.stapler.StaplerResponse;
import java.io.*; import org.kohsuke.stapler.*;
[ "java.io", "org.kohsuke.stapler" ]
java.io; org.kohsuke.stapler;
594,145
public static Map<String, Object> getKenyaemrInformation() { BuildProperties build = Context.getRegisteredComponents(BuildProperties.class).get(0); return map( "version", build.getVersion(), "buildDate", build.getBuildDate() ); }
static Map<String, Object> function() { BuildProperties build = Context.getRegisteredComponents(BuildProperties.class).get(0); return map( STR, build.getVersion(), STR, build.getBuildDate() ); }
/** * Gets KenyaEMR information * @return the data points */
Gets KenyaEMR information
getKenyaemrInformation
{ "repo_name": "hispindia/his-tb-emr", "path": "api/src/main/java/org/openmrs/module/kenyaemr/util/ServerInformation.java", "license": "gpl-3.0", "size": 3263 }
[ "java.util.Map", "org.openmrs.api.context.Context" ]
import java.util.Map; import org.openmrs.api.context.Context;
import java.util.*; import org.openmrs.api.context.*;
[ "java.util", "org.openmrs.api" ]
java.util; org.openmrs.api;
794,680
protected LinkedList mergeHistoryList() { LinkedList savedHistory = historyList; loadHistory(); // Go through the list in reverse, since addToHistory inserts at the start of the list ListIterator it = savedHistory.listIterator(savedHistory.size()); while (it.hasPrevious()) { addToHistory((HTMLViewerHistoryItem) it.previous()); } return historyList; }
LinkedList function() { LinkedList savedHistory = historyList; loadHistory(); ListIterator it = savedHistory.listIterator(savedHistory.size()); while (it.hasPrevious()) { addToHistory((HTMLViewerHistoryItem) it.previous()); } return historyList; }
/** * Merge the historyList with current serialized version (another instance * may have written it since we read it last). */
Merge the historyList with current serialized version (another instance may have written it since we read it last)
mergeHistoryList
{ "repo_name": "arturog8m/ocs", "path": "bundle/jsky.app.ot/src/main/java/jsky/html/HTMLViewer.java", "license": "bsd-3-clause", "size": 16162 }
[ "java.util.LinkedList", "java.util.ListIterator" ]
import java.util.LinkedList; import java.util.ListIterator;
import java.util.*;
[ "java.util" ]
java.util;
522,277
VersionControlComponentMappingEntity registerFlowWithFlowRegistry(String groupId, StartVersionControlRequestEntity requestEntity);
VersionControlComponentMappingEntity registerFlowWithFlowRegistry(String groupId, StartVersionControlRequestEntity requestEntity);
/** * Creates a snapshot of the Process Group with the given identifier, then creates a new Flow entity in the NiFi Registry * and adds the snapshot of the Process Group as the first version of that flow. * * @param groupId the UUID of the Process Group * @param requestEntity the details of the flow to create * @return a VersionControlComponentMappingEntity that contains the information needed to notify a Process Group where it is tracking to and map * component ID's to their Versioned Component ID's */
Creates a snapshot of the Process Group with the given identifier, then creates a new Flow entity in the NiFi Registry and adds the snapshot of the Process Group as the first version of that flow
registerFlowWithFlowRegistry
{ "repo_name": "jskora/nifi", "path": "nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/NiFiServiceFacade.java", "license": "apache-2.0", "size": 83710 }
[ "org.apache.nifi.web.api.entity.StartVersionControlRequestEntity", "org.apache.nifi.web.api.entity.VersionControlComponentMappingEntity" ]
import org.apache.nifi.web.api.entity.StartVersionControlRequestEntity; import org.apache.nifi.web.api.entity.VersionControlComponentMappingEntity;
import org.apache.nifi.web.api.entity.*;
[ "org.apache.nifi" ]
org.apache.nifi;
1,253,443
public Http build() throws HttpBuilderException { try { this.clientBuilder.setSSLContext(this.sslContextBuilder.build()); } catch (Exception e) { throw new HttpBuilderException("failed to set SSL context when building HTTP client: " + e.getMessage(), e); } this.clientBuilder.setDefaultRequestConfig(this.requestConfigBuilder.build()); List<Header> headers = new ArrayList<>(); this.defaultHeaders.entrySet().stream().forEach(header -> { headers.add(new BasicHeader(header.getKey(), header.getValue())); }); this.clientBuilder.setDefaultHeaders(headers); return new Http(this.clientBuilder, this.logger); }
Http function() throws HttpBuilderException { try { this.clientBuilder.setSSLContext(this.sslContextBuilder.build()); } catch (Exception e) { throw new HttpBuilderException(STR + e.getMessage(), e); } this.clientBuilder.setDefaultRequestConfig(this.requestConfigBuilder.build()); List<Header> headers = new ArrayList<>(); this.defaultHeaders.entrySet().stream().forEach(header -> { headers.add(new BasicHeader(header.getKey(), header.getValue())); }); this.clientBuilder.setDefaultHeaders(headers); return new Http(this.clientBuilder, this.logger); }
/** * Constructs a {@link Http} instance from the parameters supplied to the * {@link HttpBuilder}. * * @return * @throws HttpBuilderException */
Constructs a <code>Http</code> instance from the parameters supplied to the <code>HttpBuilder</code>
build
{ "repo_name": "elastisys/scale.commons", "path": "net/src/main/java/com/elastisys/scale/commons/net/http/HttpBuilder.java", "license": "apache-2.0", "size": 16068 }
[ "java.util.ArrayList", "java.util.List", "org.apache.http.Header", "org.apache.http.message.BasicHeader" ]
import java.util.ArrayList; import java.util.List; import org.apache.http.Header; import org.apache.http.message.BasicHeader;
import java.util.*; import org.apache.http.*; import org.apache.http.message.*;
[ "java.util", "org.apache.http" ]
java.util; org.apache.http;
617,817
public static Description createTestDescription(String className, String name, Serializable uniqueId) { return new Description(null, formatDisplayName(name, className), uniqueId); }
static Description function(String className, String name, Serializable uniqueId) { return new Description(null, formatDisplayName(name, className), uniqueId); }
/** * Create a <code>Description</code> of a single test named <code>name</code> in the class <code>clazz</code>. * Generally, this will be a leaf <code>Description</code>. * * @param name the name of the test (a method name for test annotated with {@link org.junit.Test}) * @return a <code>Description</code> named <code>name</code> */
Create a <code>Description</code> of a single test named <code>name</code> in the class <code>clazz</code>. Generally, this will be a leaf <code>Description</code>
createTestDescription
{ "repo_name": "paulduffin/junit", "path": "src/main/java/org/junit/runner/Description.java", "license": "epl-1.0", "size": 11799 }
[ "java.io.Serializable" ]
import java.io.Serializable;
import java.io.*;
[ "java.io" ]
java.io;
521,616
public void setParseConfig(TextParseConfig parseConfig) { this.parseConfig = parseConfig; }
void function(TextParseConfig parseConfig) { this.parseConfig = parseConfig; }
/** * Replaces the current parse configuration * * @param parseConfig The new parse config */
Replaces the current parse configuration
setParseConfig
{ "repo_name": "org-tigris-jsapar/jsapar", "path": "src/main/java/org/jsapar/TextParser.java", "license": "apache-2.0", "size": 4618 }
[ "org.jsapar.text.TextParseConfig" ]
import org.jsapar.text.TextParseConfig;
import org.jsapar.text.*;
[ "org.jsapar.text" ]
org.jsapar.text;
2,145,935
public Builder setLinkStaticness(LinkStaticness linkStaticness) { this.linkStaticness = linkStaticness; return this; }
Builder function(LinkStaticness linkStaticness) { this.linkStaticness = linkStaticness; return this; }
/** * Sets how static the link is supposed to be. For static target types (see {@link * LinkTargetType#staticness()}}), the {@link #build} method throws an exception if this * is not {@link LinkStaticness#FULLY_STATIC}. The default setting is {@link * LinkStaticness#FULLY_STATIC}. */
Sets how static the link is supposed to be. For static target types (see <code>LinkTargetType#staticness()</code>}), the <code>#build</code> method throws an exception if this is not <code>LinkStaticness#FULLY_STATIC</code>. The default setting is <code>LinkStaticness#FULLY_STATIC</code>
setLinkStaticness
{ "repo_name": "mrdomino/bazel", "path": "src/main/java/com/google/devtools/build/lib/rules/cpp/LinkCommandLine.java", "license": "apache-2.0", "size": 37642 }
[ "com.google.devtools.build.lib.rules.cpp.Link" ]
import com.google.devtools.build.lib.rules.cpp.Link;
import com.google.devtools.build.lib.rules.cpp.*;
[ "com.google.devtools" ]
com.google.devtools;
1,238,511
public boolean isBetterLocation(Location location, Location currentBestLocation) { if (currentBestLocation == null) { // A new location is always better than no location return true; } // Check whether the new location fix is newer or older long timeDelta = location.getTime() - currentBestLocation.getTime(); boolean isSignificantlyNewer = timeDelta > TWO_MINUTES; boolean isSignificantlyOlder = timeDelta < -TWO_MINUTES; boolean isNewer = timeDelta > 0; // If it's been more than two minutes since the current location, use // the new location // because the user has likely moved if (isSignificantlyNewer) { return true; // If the new location is more than two minutes older, it must be // worse } else if (isSignificantlyOlder) { return false; } // Check whether the new location fix is more or less accurate int accuracyDelta = (int) (location.getAccuracy() - currentBestLocation .getAccuracy()); boolean isLessAccurate = accuracyDelta > 0; boolean isMoreAccurate = accuracyDelta < 0; boolean isSignificantlyLessAccurate = accuracyDelta > 200; // Check if the old and new location are from the same provider boolean isFromSameProvider = isSameProvider(location.getProvider(), currentBestLocation.getProvider()); // Determine location quality using a combination of timeliness and // accuracy if (isMoreAccurate) { return true; } else if (isNewer && !isLessAccurate) { return true; } else if (isNewer && !isSignificantlyLessAccurate && isFromSameProvider) { return true; } return false; }
boolean function(Location location, Location currentBestLocation) { if (currentBestLocation == null) { return true; } long timeDelta = location.getTime() - currentBestLocation.getTime(); boolean isSignificantlyNewer = timeDelta > TWO_MINUTES; boolean isSignificantlyOlder = timeDelta < -TWO_MINUTES; boolean isNewer = timeDelta > 0; if (isSignificantlyNewer) { return true; } else if (isSignificantlyOlder) { return false; } int accuracyDelta = (int) (location.getAccuracy() - currentBestLocation .getAccuracy()); boolean isLessAccurate = accuracyDelta > 0; boolean isMoreAccurate = accuracyDelta < 0; boolean isSignificantlyLessAccurate = accuracyDelta > 200; boolean isFromSameProvider = isSameProvider(location.getProvider(), currentBestLocation.getProvider()); if (isMoreAccurate) { return true; } else if (isNewer && !isLessAccurate) { return true; } else if (isNewer && !isSignificantlyLessAccurate && isFromSameProvider) { return true; } return false; }
/** * Determines whether one Location reading is better than the current * Location fix * * @param location * The new Location that you want to evaluate * @param currentBestLocation * The current Location fix, to which you want to compare the new * one */
Determines whether one Location reading is better than the current Location fix
isBetterLocation
{ "repo_name": "mwalton/arrow-nav", "path": "src/com/hci/cyclenav/guidance/NavigationUtil.java", "license": "mit", "size": 6051 }
[ "android.location.Location" ]
import android.location.Location;
import android.location.*;
[ "android.location" ]
android.location;
1,773,684
public Map< String, String > getResponseCodes() { return responseCodes; }
Map< String, String > function() { return responseCodes; }
/** * Gets the response codes. * * @return the response codes */
Gets the response codes
getResponseCodes
{ "repo_name": "RampantLions/CodeTools", "path": "CodeToolsModules/CodeToolsSwagger/CodeToolsSwaggerGenerators/src/main/java/io/github/rampantlions/codetools/restbuilder/generators/models/ApiModel.java", "license": "apache-2.0", "size": 7126 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
1,311,750
public Date getEndDate() { return endDate; }
Date function() { return endDate; }
/** * Gets end date. * * @return the end date */
Gets end date
getEndDate
{ "repo_name": "thefinerthingsclub/finerleague", "path": "finerleague-data/finerleague-data-entity/src/main/java/com/everis/alicante/thefinerthingsclub/finerleague/data/entity/Season.java", "license": "gpl-3.0", "size": 2917 }
[ "java.util.Date" ]
import java.util.Date;
import java.util.*;
[ "java.util" ]
java.util;
1,846,822
private static ClassData getClassData(String className) { ClassData cData = (ClassData) classDataInfo.get(className); try { if (cData == null) { // Get the class of the given object and the // Transfer Object to be created Field[] arrFields; Class ejbTOClass = Class.forName(className); // Determine the fields that must be copied arrFields = ejbTOClass.getFields(); cData = new ClassData( ejbTOClass, arrFields, ejbTOClass.getMethods()); classDataInfo.put(className, cData); } } catch (Exception e) { // handle exceptions here... } return cData; }
static ClassData function(String className) { ClassData cData = (ClassData) classDataInfo.get(className); try { if (cData == null) { Field[] arrFields; Class ejbTOClass = Class.forName(className); arrFields = ejbTOClass.getFields(); cData = new ClassData( ejbTOClass, arrFields, ejbTOClass.getMethods()); classDataInfo.put(className, cData); } } catch (Exception e) { } return cData; }
/** * Return a ClassData object that contains the * information needed to create * a Transfer Object for the given class. This information * is only obtained from the * class using reflection once, after that it will be * obtained from the classDataInfo HashMap. */
Return a ClassData object that contains the information needed to create a Transfer Object for the given class. This information is only obtained from the class using reflection once, after that it will be obtained from the classDataInfo HashMap
getClassData
{ "repo_name": "besom/bbossgroups-mvn", "path": "bboss_util/src/main/java/com/frameworkset/util/TransferObjectFactory.java", "license": "apache-2.0", "size": 23669 }
[ "java.lang.reflect.Field" ]
import java.lang.reflect.Field;
import java.lang.reflect.*;
[ "java.lang" ]
java.lang;
2,510,355
public static final DateFormat getDateTimeInstance(int dateStyle, int timeStyle) { return get(timeStyle, dateStyle, 3, Locale.getDefault(Locale.Category.FORMAT)); }
static final DateFormat function(int dateStyle, int timeStyle) { return get(timeStyle, dateStyle, 3, Locale.getDefault(Locale.Category.FORMAT)); }
/** * Gets the date/time formatter with the given date and time * formatting styles for the default {@link java.util.Locale.Category#FORMAT FORMAT} locale. * <p>This is equivalent to calling * {@link #getDateTimeInstance(int, int, Locale) getDateTimeInstance(dateStyle, * timeStyle, Locale.getDefault(Locale.Category.FORMAT))}. * @see java.util.Locale#getDefault(java.util.Locale.Category) * @see java.util.Locale.Category#FORMAT * @param dateStyle the given date formatting style. For example, * SHORT for "M/d/yy" in the US locale. * @param timeStyle the given time formatting style. For example, * SHORT for "h:mm a" in the US locale. * @return a date/time formatter. */
Gets the date/time formatter with the given date and time formatting styles for the default <code>java.util.Locale.Category#FORMAT FORMAT</code> locale. This is equivalent to calling <code>#getDateTimeInstance(int, int, Locale) getDateTimeInstance(dateStyle, timeStyle, Locale.getDefault(Locale.Category.FORMAT))</code>
getDateTimeInstance
{ "repo_name": "md-5/jdk10", "path": "src/java.base/share/classes/java/text/DateFormat.java", "license": "gpl-2.0", "size": 42210 }
[ "java.util.Locale" ]
import java.util.Locale;
import java.util.*;
[ "java.util" ]
java.util;
1,187,884
protected Map createTranscodingHints() { Map hints = new HashMap(3); hints.put(ImageTranscoder.KEY_DEFAULT_FONT_FAMILY, defaultFontFamily); return hints; }
Map function() { Map hints = new HashMap(3); hints.put(ImageTranscoder.KEY_DEFAULT_FONT_FAMILY, defaultFontFamily); return hints; }
/** * Creates a Map that contains additional transcoding hints. */
Creates a Map that contains additional transcoding hints
createTranscodingHints
{ "repo_name": "sflyphotobooks/crp-batik", "path": "test-sources/org/apache/batik/transcoder/image/DefaultFontFamilyTest.java", "license": "apache-2.0", "size": 2692 }
[ "java.util.HashMap", "java.util.Map" ]
import java.util.HashMap; import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
1,208,338
public void adjustSetsWithChosenReplica( final Map<String, List<DatanodeStorageInfo>> rackMap, final List<DatanodeStorageInfo> moreThanOne, final List<DatanodeStorageInfo> exactlyOne, final DatanodeStorageInfo cur) { final String rack = getRack(cur.getDatanodeDescriptor()); final List<DatanodeStorageInfo> storages = rackMap.get(rack); storages.remove(cur); if (storages.isEmpty()) { rackMap.remove(rack); } if (moreThanOne.remove(cur)) { if (storages.size() == 1) { final DatanodeStorageInfo remaining = storages.get(0); moreThanOne.remove(remaining); exactlyOne.add(remaining); } } else { exactlyOne.remove(cur); } }
void function( final Map<String, List<DatanodeStorageInfo>> rackMap, final List<DatanodeStorageInfo> moreThanOne, final List<DatanodeStorageInfo> exactlyOne, final DatanodeStorageInfo cur) { final String rack = getRack(cur.getDatanodeDescriptor()); final List<DatanodeStorageInfo> storages = rackMap.get(rack); storages.remove(cur); if (storages.isEmpty()) { rackMap.remove(rack); } if (moreThanOne.remove(cur)) { if (storages.size() == 1) { final DatanodeStorageInfo remaining = storages.get(0); moreThanOne.remove(remaining); exactlyOne.add(remaining); } } else { exactlyOne.remove(cur); } }
/** * Adjust rackmap, moreThanOne, and exactlyOne after removing replica on cur. * * @param rackMap a map from rack to replica * @param moreThanOne The List of replica nodes on rack which has more than * one replica * @param exactlyOne The List of replica nodes on rack with only one replica * @param cur current replica to remove */
Adjust rackmap, moreThanOne, and exactlyOne after removing replica on cur
adjustSetsWithChosenReplica
{ "repo_name": "jonathangizmo/HadoopDistJ", "path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockPlacementPolicy.java", "license": "mit", "size": 10138 }
[ "java.util.List", "java.util.Map" ]
import java.util.List; import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
1,241,669
public static <T> T min(Collection<T> self, Comparator<T> comparator) { T answer = null; for (T value : self) { if (answer == null || comparator.compare(value, answer) < 0) { answer = value; } } return answer; }
static <T> T function(Collection<T> self, Comparator<T> comparator) { T answer = null; for (T value : self) { if (answer == null comparator.compare(value, answer) < 0) { answer = value; } } return answer; }
/** * Selects the minimum value found in the collection using the given comparator. * <pre class="groovyTestCase">assert "hi" == ["hello","hi","hey"].min( { a, b -> a.length() <=> b.length() } as Comparator )</pre> * * @param self a Collection * @param comparator a Comparator * @return the minimum value * @since 1.0 */
Selects the minimum value found in the collection using the given comparator. assert "hi" == ["hello","hi","hey"].min( { a, b -> a.length() b.length() } as Comparator )</code>
min
{ "repo_name": "xien777/yajsw", "path": "yajsw/wrapper/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java", "license": "lgpl-2.1", "size": 704150 }
[ "java.util.Collection", "java.util.Comparator" ]
import java.util.Collection; import java.util.Comparator;
import java.util.*;
[ "java.util" ]
java.util;
2,415,742
private int layoutString(List<Glyph> glyphList, char text[], int start, int limit, int layoutFlags, int advance, int style) { if(digitGlyphsReady) { for(int index = start; index < limit; index++) { if(text[index] >= '0' && text[index] <= '9') { text[index] = '0'; } } } while(start < limit) { Font font = glyphCache.lookupFont(text, start, limit, style); int next = font.canDisplayUpTo(text, start, limit); if(next == -1) { next = limit; } if(next == start) { next++; } advance = layoutFont(glyphList, text, start, next, layoutFlags, advance, font); start = next; } return advance; }
int function(List<Glyph> glyphList, char text[], int start, int limit, int layoutFlags, int advance, int style) { if(digitGlyphsReady) { for(int index = start; index < limit; index++) { if(text[index] >= '0' && text[index] <= '9') { text[index] = '0'; } } } while(start < limit) { Font font = glyphCache.lookupFont(text, start, limit, style); int next = font.canDisplayUpTo(text, start, limit); if(next == -1) { next = limit; } if(next == start) { next++; } advance = layoutFont(glyphList, text, start, next, layoutFlags, advance, font); start = next; } return advance; }
/** * Given a string that runs contiguously LTR or RTL, break it up into individual segments based on which fonts can render * which characters in the string. Calls layoutFont() for each portion of the string that can be layed out with a single * font. * * @param glyphList will hold all new Glyph objects allocated by layoutFont() * @param text the string to lay out * @param start the offset into text at which to start the layout * @param limit the (offset + length) at which to stop performing the layout * @param layoutFlags either Font.LAYOUT_RIGHT_TO_LEFT or Font.LAYOUT_LEFT_TO_RIGHT * @param advance the horizontal advance (i.e. X position) returned by previous call to layoutString() * @param style combination of Font.PLAIN, Font.BOLD, and Font.ITALIC to select a fonts with some specific style * @return the advance (horizontal distance) of this string plus the advance passed in as an argument * * @todo Correctly handling RTL font selection requires scanning the sctring from RTL as well. * @todo Use bitmap fonts as a fallback if no OpenType font could be found */
Given a string that runs contiguously LTR or RTL, break it up into individual segments based on which fonts can render which characters in the string. Calls layoutFont() for each portion of the string that can be layed out with a single font
layoutString
{ "repo_name": "fewizz/BetterFonts", "path": "src/main/java/me/isuzutsuki/betterfonts/betterfonts/StringCache.java", "license": "lgpl-2.1", "size": 53947 }
[ "java.awt.Font", "java.util.List" ]
import java.awt.Font; import java.util.List;
import java.awt.*; import java.util.*;
[ "java.awt", "java.util" ]
java.awt; java.util;
620,548
public static String getDominoIniVar(final String propertyName, final String defaultValue) { String newVal = Factory.getSession(SessionType.CURRENT).getEnvironmentString(propertyName, true); if (!"".equals(newVal)) { return newVal; } else { return defaultValue; } }
static String function(final String propertyName, final String defaultValue) { String newVal = Factory.getSession(SessionType.CURRENT).getEnvironmentString(propertyName, true); if (!"".equals(newVal)) { return newVal; } else { return defaultValue; } }
/** * Gets the domino ini var. * * @param propertyName * String property to retrieve from notes.ini * @param defaultValue * String default to use if property is not found * @return String return value from the notes.ini */
Gets the domino ini var
getDominoIniVar
{ "repo_name": "OpenNTF/org.openntf.domino", "path": "domino/core/src/main/java/org/openntf/domino/utils/DominoUtils.java", "license": "apache-2.0", "size": 35842 }
[ "org.openntf.domino.utils.Factory" ]
import org.openntf.domino.utils.Factory;
import org.openntf.domino.utils.*;
[ "org.openntf.domino" ]
org.openntf.domino;
1,571,965
AboutPage fragment = new AboutPage(); Bundle args = new Bundle(); args.putInt(ARG_SECTION_NUMBER, sectionNumber); fragment.setArguments(args); return fragment; } public AboutPage() { }
AboutPage fragment = new AboutPage(); Bundle args = new Bundle(); args.putInt(ARG_SECTION_NUMBER, sectionNumber); fragment.setArguments(args); return fragment; } public AboutPage() { }
/** * Returns a new instance of this fragment for the given section * number. */
Returns a new instance of this fragment for the given section number
newInstance
{ "repo_name": "myCodeHurts/RapidMath", "path": "app/src/main/java/com/mycodehurts/rapidmath/app/AboutPage.java", "license": "mit", "size": 5231 }
[ "android.os.Bundle" ]
import android.os.Bundle;
import android.os.*;
[ "android.os" ]
android.os;
1,413,860
synchronized ChoreService getChoreService() { if (isClosed()) { throw new IllegalStateException("connection is already closed"); } if (choreService == null) { choreService = new ChoreService("AsyncConn Chore Service"); } return choreService; }
synchronized ChoreService getChoreService() { if (isClosed()) { throw new IllegalStateException(STR); } if (choreService == null) { choreService = new ChoreService(STR); } return choreService; }
/** * If choreService has not been created yet, create the ChoreService. * @return ChoreService */
If choreService has not been created yet, create the ChoreService
getChoreService
{ "repo_name": "apurtell/hbase", "path": "hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncConnectionImpl.java", "license": "apache-2.0", "size": 16603 }
[ "org.apache.hadoop.hbase.ChoreService" ]
import org.apache.hadoop.hbase.ChoreService;
import org.apache.hadoop.hbase.*;
[ "org.apache.hadoop" ]
org.apache.hadoop;
1,470,735
public boolean unlinkBlock(ExtendedBlock block, int numLinks) throws IOException { ReplicaInfo info = getReplicaInfo(block); return info.unlinkBlock(numLinks); }
boolean function(ExtendedBlock block, int numLinks) throws IOException { ReplicaInfo info = getReplicaInfo(block); return info.unlinkBlock(numLinks); }
/** * Make a copy of the block if this block is linked to an existing * snapshot. This ensures that modifying this block does not modify * data in any existing snapshots. * @param block Block * @param numLinks Unlink if the number of links exceed this value * @throws IOException * @return - true if the specified block was unlinked or the block * is not in any snapshot. */
Make a copy of the block if this block is linked to an existing snapshot. This ensures that modifying this block does not modify data in any existing snapshots
unlinkBlock
{ "repo_name": "moreus/hadoop", "path": "hadoop-0.23.10/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/FSDataset.java", "license": "apache-2.0", "size": 92768 }
[ "java.io.IOException", "org.apache.hadoop.hdfs.protocol.ExtendedBlock" ]
import java.io.IOException; import org.apache.hadoop.hdfs.protocol.ExtendedBlock;
import java.io.*; import org.apache.hadoop.hdfs.protocol.*;
[ "java.io", "org.apache.hadoop" ]
java.io; org.apache.hadoop;
718,331
@AfterEach public void shutDown() throws Exception { deleteDir(Paths.get(zapHomeDir)); }
void function() throws Exception { deleteDir(Paths.get(zapHomeDir)); }
/** * Deletes the ZAP's home directory. * * @throws Exception if an error occurred while deleting the home directory. */
Deletes the ZAP's home directory
shutDown
{ "repo_name": "secdec/zap-extensions", "path": "testutils/src/main/java/org/zaproxy/zap/testutils/TestUtils.java", "license": "apache-2.0", "size": 23982 }
[ "java.nio.file.Paths" ]
import java.nio.file.Paths;
import java.nio.file.*;
[ "java.nio" ]
java.nio;
2,620,066
protected void createStateDefaultTransition(final TransitionableState state, final String targetState) { if (state == null) { logger.debug("Cannot add default transition of [{}] to the given state is null and cannot be found in the flow.", targetState); return; } final Transition transition = createTransition(targetState); state.getTransitionSet().add(transition); }
void function(final TransitionableState state, final String targetState) { if (state == null) { logger.debug(STR, targetState); return; } final Transition transition = createTransition(targetState); state.getTransitionSet().add(transition); }
/** * Add a default transition to a given state. * * @param state the state to include the default transition * @param targetState the id of the destination state to which the flow should transfer */
Add a default transition to a given state
createStateDefaultTransition
{ "repo_name": "yisiqi/cas", "path": "cas-server-core-webflow/src/main/java/org/apereo/cas/web/flow/AbstractCasWebflowConfigurer.java", "license": "apache-2.0", "size": 24245 }
[ "org.springframework.webflow.engine.Transition", "org.springframework.webflow.engine.TransitionableState" ]
import org.springframework.webflow.engine.Transition; import org.springframework.webflow.engine.TransitionableState;
import org.springframework.webflow.engine.*;
[ "org.springframework.webflow" ]
org.springframework.webflow;
1,744,307
public void disableThreadSynchronization() { allowMainThread = new Semaphore(1000); allowWriterThread = new Semaphore(1000); }
void function() { allowMainThread = new Semaphore(1000); allowWriterThread = new Semaphore(1000); }
/** * Used for synchronous invocation tests: grants an "infinite" number of * permits for the writer to proceed. */
Used for synchronous invocation tests: grants an "infinite" number of permits for the writer to proceed
disableThreadSynchronization
{ "repo_name": "kdgregory/log4j-aws-appenders", "path": "library/logwriters/src/test/java/com/kdgregory/logging/testhelpers/cloudwatch/TestableCloudWatchLogWriter.java", "license": "apache-2.0", "size": 2930 }
[ "java.util.concurrent.Semaphore" ]
import java.util.concurrent.Semaphore;
import java.util.concurrent.*;
[ "java.util" ]
java.util;
1,326,151
protected Map<String, Object> queryProperties(Map<String, Object> model) { Map<String, Object> result = new LinkedHashMap<String, Object>(); for (Map.Entry<String, Object> entry : model.entrySet()) { if (isEligibleProperty(entry.getKey(), entry.getValue())) { result.put(entry.getKey(), entry.getValue()); } } return result; }
Map<String, Object> function(Map<String, Object> model) { Map<String, Object> result = new LinkedHashMap<String, Object>(); for (Map.Entry<String, Object> entry : model.entrySet()) { if (isEligibleProperty(entry.getKey(), entry.getValue())) { result.put(entry.getKey(), entry.getValue()); } } return result; }
/** * Determine name-value pairs for query strings, which will be stringified, * URL-encoded and formatted by {@link #appendQueryProperties}. * <p>This implementation filters the model through checking * {@link #isEligibleProperty(String, Object)} for each element, * by default accepting Strings, primitives and primitive wrappers only. * @param model the original model Map * @return the filtered Map of eligible query properties * @see #isEligibleProperty(String, Object) */
Determine name-value pairs for query strings, which will be stringified, URL-encoded and formatted by <code>#appendQueryProperties</code>. This implementation filters the model through checking <code>#isEligibleProperty(String, Object)</code> for each element, by default accepting Strings, primitives and primitive wrappers only
queryProperties
{ "repo_name": "leogoing/spring_jeesite", "path": "spring-webmvc-4.0/org/springframework/web/servlet/view/RedirectView.java", "license": "apache-2.0", "size": 21343 }
[ "java.util.LinkedHashMap", "java.util.Map" ]
import java.util.LinkedHashMap; import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
2,417,713
public static <T> DataSet<T> sampleWithSize( DataSet<T> input, final boolean withReplacement, final int numSamples) { return sampleWithSize(input, withReplacement, numSamples, Utils.RNG.nextLong()); }
static <T> DataSet<T> function( DataSet<T> input, final boolean withReplacement, final int numSamples) { return sampleWithSize(input, withReplacement, numSamples, Utils.RNG.nextLong()); }
/** * Generate a sample of DataSet which contains fixed size elements. * * <p><strong>NOTE:</strong> Sample with fixed size is not as efficient as sample with fraction, * use sample with fraction unless you need exact precision. * * @param withReplacement Whether element can be selected more than once. * @param numSamples The expected sample size. * @return The sampled DataSet */
Generate a sample of DataSet which contains fixed size elements. use sample with fraction unless you need exact precision
sampleWithSize
{ "repo_name": "apache/flink", "path": "flink-java/src/main/java/org/apache/flink/api/java/utils/DataSetUtils.java", "license": "apache-2.0", "size": 22109 }
[ "org.apache.flink.api.java.DataSet", "org.apache.flink.api.java.Utils" ]
import org.apache.flink.api.java.DataSet; import org.apache.flink.api.java.Utils;
import org.apache.flink.api.java.*;
[ "org.apache.flink" ]
org.apache.flink;
1,798,201
private void addSitemapPageStatic(Route route, Sitemap sitemap, Collection<WebPage> pages) { // no SitemapMultiPageProvider given, and not a dynamic route. // standard case. WebPage wp = new WebPage(); if (!Sitemap.NO_PATH.equals(sitemap.path())) { // a path (name) was explicitly given wp.setName(sitemap.path().replaceFirst("^/", "")); } else { // set the path from the router wp.setName(route.getUri().replaceFirst("^/", "")); } wp.setLastMod(sitemapDetailsProvider.getLastModifiedDateForRoute(route, sitemap)); if (sitemap.priority() == Sitemap.PRIORITY_DYNAMIC) { wp.setPriority(sitemapDetailsProvider.getPriorityForRoute(route, sitemap)); } else { wp.setPriority(sitemap.priority()); } if (sitemap.changeFrequency() == Sitemap.CHANGE_FREQUENCY_DYNAMIC) { wp.setChangeFreq( changeFrequencyFromInteger(sitemapDetailsProvider.getChangeFrequencyForRoute(route, sitemap))); } else { wp.setChangeFreq(changeFrequencyFromInteger(sitemap.changeFrequency())); } // add to the list of pages for this route pages.add(wp); }
void function(Route route, Sitemap sitemap, Collection<WebPage> pages) { WebPage wp = new WebPage(); if (!Sitemap.NO_PATH.equals(sitemap.path())) { wp.setName(sitemap.path().replaceFirst("^/", STR^/STR")); } wp.setLastMod(sitemapDetailsProvider.getLastModifiedDateForRoute(route, sitemap)); if (sitemap.priority() == Sitemap.PRIORITY_DYNAMIC) { wp.setPriority(sitemapDetailsProvider.getPriorityForRoute(route, sitemap)); } else { wp.setPriority(sitemap.priority()); } if (sitemap.changeFrequency() == Sitemap.CHANGE_FREQUENCY_DYNAMIC) { wp.setChangeFreq( changeFrequencyFromInteger(sitemapDetailsProvider.getChangeFrequencyForRoute(route, sitemap))); } else { wp.setChangeFreq(changeFrequencyFromInteger(sitemap.changeFrequency())); } pages.add(wp); }
/** * Add a single entry to the collection of sitemap entries. * * @param route * the route for which to generate the sitemap entry * @param sitemap * the {@link Sitemap} annotation for the route * @param pages * the (existing, non-null) collection of all sitemap entries */
Add a single entry to the collection of sitemap entries
addSitemapPageStatic
{ "repo_name": "FendlerConsulting/ninja-sitemap", "path": "src/main/java/com/jensfendler/ninjasitemap/controller/NinjaSitemapController.java", "license": "apache-2.0", "size": 19055 }
[ "com.jensfendler.ninjasitemap.annotations.Sitemap", "cz.jiripinkas.jsitemapgenerator.WebPage", "java.util.Collection" ]
import com.jensfendler.ninjasitemap.annotations.Sitemap; import cz.jiripinkas.jsitemapgenerator.WebPage; import java.util.Collection;
import com.jensfendler.ninjasitemap.annotations.*; import cz.jiripinkas.jsitemapgenerator.*; import java.util.*;
[ "com.jensfendler.ninjasitemap", "cz.jiripinkas.jsitemapgenerator", "java.util" ]
com.jensfendler.ninjasitemap; cz.jiripinkas.jsitemapgenerator; java.util;
119,080
void actualGetFromOneDataNode(final DNAddrPair datanode, final long startInBlk, final long endInBlk, ByteBuffer buf, CorruptedBlocks corruptedBlocks) throws IOException { DFSClientFaultInjector.get().startFetchFromDatanode(); int refetchToken = 1; // only need to get a new access token once int refetchEncryptionKey = 1; // only need to get a new encryption key once final int len = (int) (endInBlk - startInBlk + 1); LocatedBlock block = datanode.block; while (true) { BlockReader reader = null; try { DFSClientFaultInjector.get().fetchFromDatanodeException(); reader = getBlockReader(block, startInBlk, len, datanode.addr, datanode.storageType, datanode.info); //Behave exactly as the readAll() call ByteBuffer tmp = buf.duplicate(); tmp.limit(tmp.position() + len); tmp = tmp.slice(); int nread = 0; int ret; while (true) { ret = reader.read(tmp); if (ret <= 0) { break; } nread += ret; } buf.position(buf.position() + nread); IOUtilsClient.updateReadStatistics(readStatistics, nread, reader); dfsClient.updateFileSystemReadStats( reader.getNetworkDistance(), nread); if (readStatistics.getBlockType() == BlockType.STRIPED) { dfsClient.updateFileSystemECReadStats(nread); } if (nread != len) { throw new IOException("truncated return from reader.read(): " + "excpected " + len + ", got " + nread); } DFSClientFaultInjector.get().readFromDatanodeDelay(); return; } catch (ChecksumException e) { String msg = "fetchBlockByteRange(). Got a checksum exception for " + src + " at " + block.getBlock() + ":" + e.getPos() + " from " + datanode.info; DFSClient.LOG.warn(msg); // we want to remember what we have tried corruptedBlocks.addCorruptedBlock(block.getBlock(), datanode.info); addToLocalDeadNodes(datanode.info); throw new IOException(msg); } catch (IOException e) { checkInterrupted(e); if (e instanceof InvalidEncryptionKeyException && refetchEncryptionKey > 0) { DFSClient.LOG.info("Will fetch a new encryption key and retry, " + "encryption key was invalid when connecting to " + datanode.addr + " : " + e); // The encryption key used is invalid. refetchEncryptionKey--; dfsClient.clearDataEncryptionKey(); } else if (refetchToken > 0 && tokenRefetchNeeded(e, datanode.addr)) { refetchToken--; try { fetchBlockAt(block.getStartOffset()); } catch (IOException fbae) { // ignore IOE, since we can retry it later in a loop } } else { String msg = "Failed to connect to " + datanode.addr + " for file " + src + " for block " + block.getBlock() + ":" + e; DFSClient.LOG.warn("Connection failure: " + msg, e); addToLocalDeadNodes(datanode.info); dfsClient.addNodeToDeadNodeDetector(this, datanode.info); throw new IOException(msg); } // Refresh the block for updated tokens in case of token failures or // encryption key failures. block = refreshLocatedBlock(block); } finally { if (reader != null) { reader.close(); } } } }
void actualGetFromOneDataNode(final DNAddrPair datanode, final long startInBlk, final long endInBlk, ByteBuffer buf, CorruptedBlocks corruptedBlocks) throws IOException { DFSClientFaultInjector.get().startFetchFromDatanode(); int refetchToken = 1; int refetchEncryptionKey = 1; final int len = (int) (endInBlk - startInBlk + 1); LocatedBlock block = datanode.block; while (true) { BlockReader reader = null; try { DFSClientFaultInjector.get().fetchFromDatanodeException(); reader = getBlockReader(block, startInBlk, len, datanode.addr, datanode.storageType, datanode.info); ByteBuffer tmp = buf.duplicate(); tmp.limit(tmp.position() + len); tmp = tmp.slice(); int nread = 0; int ret; while (true) { ret = reader.read(tmp); if (ret <= 0) { break; } nread += ret; } buf.position(buf.position() + nread); IOUtilsClient.updateReadStatistics(readStatistics, nread, reader); dfsClient.updateFileSystemReadStats( reader.getNetworkDistance(), nread); if (readStatistics.getBlockType() == BlockType.STRIPED) { dfsClient.updateFileSystemECReadStats(nread); } if (nread != len) { throw new IOException(STR + STR + len + STR + nread); } DFSClientFaultInjector.get().readFromDatanodeDelay(); return; } catch (ChecksumException e) { String msg = STR + src + STR + block.getBlock() + ":" + e.getPos() + STR + datanode.info; DFSClient.LOG.warn(msg); corruptedBlocks.addCorruptedBlock(block.getBlock(), datanode.info); addToLocalDeadNodes(datanode.info); throw new IOException(msg); } catch (IOException e) { checkInterrupted(e); if (e instanceof InvalidEncryptionKeyException && refetchEncryptionKey > 0) { DFSClient.LOG.info(STR + STR + datanode.addr + STR + e); refetchEncryptionKey--; dfsClient.clearDataEncryptionKey(); } else if (refetchToken > 0 && tokenRefetchNeeded(e, datanode.addr)) { refetchToken--; try { fetchBlockAt(block.getStartOffset()); } catch (IOException fbae) { } } else { String msg = STR + datanode.addr + STR + src + STR + block.getBlock() + ":" + e; DFSClient.LOG.warn(STR + msg, e); addToLocalDeadNodes(datanode.info); dfsClient.addNodeToDeadNodeDetector(this, datanode.info); throw new IOException(msg); } block = refreshLocatedBlock(block); } finally { if (reader != null) { reader.close(); } } } }
/** * Read data from one DataNode. * * @param datanode the datanode from which to read data * @param startInBlk the startInBlk offset of the block * @param endInBlk the endInBlk offset of the block * @param buf the given byte buffer into which the data is read * @param corruptedBlocks map recording list of datanodes with corrupted * block replica */
Read data from one DataNode
actualGetFromOneDataNode
{ "repo_name": "lukmajercak/hadoop", "path": "hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DFSInputStream.java", "license": "apache-2.0", "size": 70076 }
[ "java.io.IOException", "java.nio.ByteBuffer", "org.apache.hadoop.fs.ChecksumException", "org.apache.hadoop.hdfs.DFSUtilClient", "org.apache.hadoop.hdfs.protocol.BlockType", "org.apache.hadoop.hdfs.protocol.LocatedBlock", "org.apache.hadoop.hdfs.protocol.datatransfer.InvalidEncryptionKeyException", "or...
import java.io.IOException; import java.nio.ByteBuffer; import org.apache.hadoop.fs.ChecksumException; import org.apache.hadoop.hdfs.DFSUtilClient; import org.apache.hadoop.hdfs.protocol.BlockType; import org.apache.hadoop.hdfs.protocol.LocatedBlock; import org.apache.hadoop.hdfs.protocol.datatransfer.InvalidEncryptionKeyException; import org.apache.hadoop.hdfs.util.IOUtilsClient;
import java.io.*; import java.nio.*; import org.apache.hadoop.fs.*; import org.apache.hadoop.hdfs.*; import org.apache.hadoop.hdfs.protocol.*; import org.apache.hadoop.hdfs.protocol.datatransfer.*; import org.apache.hadoop.hdfs.util.*;
[ "java.io", "java.nio", "org.apache.hadoop" ]
java.io; java.nio; org.apache.hadoop;
1,552,504
@Nonnull Privilege insertPrivilege(@Nonnull Schema schema);
Privilege insertPrivilege(@Nonnull Schema schema);
/** * Return INSERT privilege for schema * * @param schema the schema * @return INSERT privilege */
Return INSERT privilege for schema
insertPrivilege
{ "repo_name": "alesharik/AlesharikWebServer", "path": "database/src/com/alesharik/database/user/PrivilegeManager.java", "license": "gpl-3.0", "size": 3671 }
[ "com.alesharik.database.data.Schema", "javax.annotation.Nonnull" ]
import com.alesharik.database.data.Schema; import javax.annotation.Nonnull;
import com.alesharik.database.data.*; import javax.annotation.*;
[ "com.alesharik.database", "javax.annotation" ]
com.alesharik.database; javax.annotation;
1,034,913
@Override public void checkAuthorization(Principal user, String destination) { Matcher matcher = DESTINATION_PATTERN.matcher(destination); Authentication authentication = (Authentication) user; User a4cUser = (User) authentication.getPrincipal(); if (matcher.matches()) { String deploymentId = matcher.group(1); checkDeploymentAuthorization(authentication, a4cUser, deploymentId); } else { matcher = ENV_DESTINATION_PATTERN.matcher(destination); if (matcher.matches()) { String environmentId = matcher.group(1); checkEnvironmentAuthorization(a4cUser, environmentId); } else { throw new IllegalArgumentException("Cannot handle this destination [" + destination + "]"); } } }
void function(Principal user, String destination) { Matcher matcher = DESTINATION_PATTERN.matcher(destination); Authentication authentication = (Authentication) user; User a4cUser = (User) authentication.getPrincipal(); if (matcher.matches()) { String deploymentId = matcher.group(1); checkDeploymentAuthorization(authentication, a4cUser, deploymentId); } else { matcher = ENV_DESTINATION_PATTERN.matcher(destination); if (matcher.matches()) { String environmentId = matcher.group(1); checkEnvironmentAuthorization(a4cUser, environmentId); } else { throw new IllegalArgumentException(STR + destination + "]"); } } }
/** * Check if the current user is authorized for this destination * * @param destination the destination */
Check if the current user is authorized for this destination
checkAuthorization
{ "repo_name": "alien4cloud/alien4cloud", "path": "alien4cloud-rest-api/src/main/java/alien4cloud/rest/deployment/DeploymentEventHandler.java", "license": "apache-2.0", "size": 6745 }
[ "java.security.Principal", "java.util.regex.Matcher", "org.springframework.security.core.Authentication" ]
import java.security.Principal; import java.util.regex.Matcher; import org.springframework.security.core.Authentication;
import java.security.*; import java.util.regex.*; import org.springframework.security.core.*;
[ "java.security", "java.util", "org.springframework.security" ]
java.security; java.util; org.springframework.security;
1,515,617
EReference getDataOutputType_Output();
EReference getDataOutputType_Output();
/** * Returns the meta object for the containment reference '{@link net.opengis.wps20.DataOutputType#getOutput <em>Output</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the containment reference '<em>Output</em>'. * @see net.opengis.wps20.DataOutputType#getOutput() * @see #getDataOutputType() * @generated */
Returns the meta object for the containment reference '<code>net.opengis.wps20.DataOutputType#getOutput Output</code>'.
getDataOutputType_Output
{ "repo_name": "geotools/geotools", "path": "modules/ogc/net.opengis.wps/src/net/opengis/wps20/Wps20Package.java", "license": "lgpl-2.1", "size": 228745 }
[ "org.eclipse.emf.ecore.EReference" ]
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
173,145
public WorkflowInstance convertToInstanceAndSetVariables( HistoricProcessInstance historicProcessInstance, Map<String, Object> collectedVariables) { String processInstanceId = historicProcessInstance.getId(); String id = processInstanceId; ProcessDefinition procDef = activitiUtil.getProcessDefinition(historicProcessInstance .getProcessDefinitionId()); WorkflowDefinition definition = convert(procDef); // Set process variables based on historic detail query Map<String, Object> variables = propertyConverter .getHistoricProcessVariables(processInstanceId); Date startDate = historicProcessInstance.getStartTime(); Date endDate = historicProcessInstance.getEndTime(); // Copy all variables to map, if not null if (collectedVariables != null) { collectedVariables.putAll(variables); } boolean isActive = endDate == null; return factory.createInstance(id, definition, variables, isActive, startDate, endDate); }
WorkflowInstance function( HistoricProcessInstance historicProcessInstance, Map<String, Object> collectedVariables) { String processInstanceId = historicProcessInstance.getId(); String id = processInstanceId; ProcessDefinition procDef = activitiUtil.getProcessDefinition(historicProcessInstance .getProcessDefinitionId()); WorkflowDefinition definition = convert(procDef); Map<String, Object> variables = propertyConverter .getHistoricProcessVariables(processInstanceId); Date startDate = historicProcessInstance.getStartTime(); Date endDate = historicProcessInstance.getEndTime(); if (collectedVariables != null) { collectedVariables.putAll(variables); } boolean isActive = endDate == null; return factory.createInstance(id, definition, variables, isActive, startDate, endDate); }
/** * Convert to instance and set variables. * * @param historicProcessInstance * the historic process instance * @param collectedVariables * the collected variables * @return the workflow instance */
Convert to instance and set variables
convertToInstanceAndSetVariables
{ "repo_name": "SirmaITT/conservation-space-1.7.0", "path": "docker/sep-alfresco/alfresco-emf-integration/alfresco-integration-api/src/main/java/org/alfresco/repo/workflow/activiti/ActivitiTypeConverter.java", "license": "lgpl-3.0", "size": 27423 }
[ "java.util.Date", "java.util.Map", "org.activiti.engine.history.HistoricProcessInstance", "org.activiti.engine.repository.ProcessDefinition", "org.alfresco.service.cmr.workflow.WorkflowDefinition", "org.alfresco.service.cmr.workflow.WorkflowInstance" ]
import java.util.Date; import java.util.Map; import org.activiti.engine.history.HistoricProcessInstance; import org.activiti.engine.repository.ProcessDefinition; import org.alfresco.service.cmr.workflow.WorkflowDefinition; import org.alfresco.service.cmr.workflow.WorkflowInstance;
import java.util.*; import org.activiti.engine.history.*; import org.activiti.engine.repository.*; import org.alfresco.service.cmr.workflow.*;
[ "java.util", "org.activiti.engine", "org.alfresco.service" ]
java.util; org.activiti.engine; org.alfresco.service;
351,371
@Override final GenericName createLocalName(final CharSequence name) { return nameFactory.createLocalName(namespace, name); }
final GenericName createLocalName(final CharSequence name) { return nameFactory.createLocalName(namespace, name); }
/** * Creates a local name in the {@linkplain #setNameSpace feature namespace}. */
Creates a local name in the #setNameSpace feature namespace
createLocalName
{ "repo_name": "Geomatys/sis", "path": "core/sis-feature/src/main/java/org/apache/sis/feature/builder/FeatureTypeBuilder.java", "license": "apache-2.0", "size": 46137 }
[ "org.opengis.util.GenericName" ]
import org.opengis.util.GenericName;
import org.opengis.util.*;
[ "org.opengis.util" ]
org.opengis.util;
102,538
@LargeTest @Feature({"Clipboard", "TextInput"}) @RerunWithUpdatedContainerView public void testCopyDocumentFragment() throws Throwable { final ClipboardManager clipboardManager = (ClipboardManager) getActivity().getSystemService(Context.CLIPBOARD_SERVICE); assertNotNull(clipboardManager); // Clear the clipboard to make sure we start with a clean state. clipboardManager.setPrimaryClip(ClipData.newPlainText(null, "")); assertFalse(hasPrimaryClip(clipboardManager)); ImeAdapter adapter = getContentViewCore().getImeAdapterForTest(); selectAll(adapter); copy(adapter);
@Feature({STR, STR}) void function() throws Throwable { final ClipboardManager clipboardManager = (ClipboardManager) getActivity().getSystemService(Context.CLIPBOARD_SERVICE); assertNotNull(clipboardManager); clipboardManager.setPrimaryClip(ClipData.newPlainText(null, "")); assertFalse(hasPrimaryClip(clipboardManager)); ImeAdapter adapter = getContentViewCore().getImeAdapterForTest(); selectAll(adapter); copy(adapter);
/** * Tests that copying document fragments will put at least a plain-text representation * of the contents on the clipboard. For Android JellyBean and higher, we also expect * the HTML representation of the fragment to be available. */
Tests that copying document fragments will put at least a plain-text representation of the contents on the clipboard. For Android JellyBean and higher, we also expect the HTML representation of the fragment to be available
testCopyDocumentFragment
{ "repo_name": "guorendong/iridium-browser-ubuntu", "path": "content/public/android/javatests/src/org/chromium/content/browser/ClipboardTest.java", "license": "bsd-3-clause", "size": 4445 }
[ "android.content.ClipData", "android.content.ClipboardManager", "android.content.Context", "org.chromium.base.test.util.Feature", "org.chromium.content.browser.input.ImeAdapter" ]
import android.content.ClipData; import android.content.ClipboardManager; import android.content.Context; import org.chromium.base.test.util.Feature; import org.chromium.content.browser.input.ImeAdapter;
import android.content.*; import org.chromium.base.test.util.*; import org.chromium.content.browser.input.*;
[ "android.content", "org.chromium.base", "org.chromium.content" ]
android.content; org.chromium.base; org.chromium.content;
1,281,306
public Map[] getZoneListByPublisherId(Integer id) throws XmlRpcException { return objectToArrayMaps(execute(GET_ZONE_LIST_BY_PUBLISHER_ID_METHOD, id)); }
Map[] function(Integer id) throws XmlRpcException { return objectToArrayMaps(execute(GET_ZONE_LIST_BY_PUBLISHER_ID_METHOD, id)); }
/** * Gets the zone list by publisher id. * * @param id the id * * @return the zone list by publisher id * * @throws XmlRpcException the xml rpc exception */
Gets the zone list by publisher id
getZoneListByPublisherId
{ "repo_name": "sgreiner/revive-adserver", "path": "lib/xmlrpc/java/openx-api-v2/ApacheLib3/org/openads/proxy/ZoneService.java", "license": "gpl-2.0", "size": 11223 }
[ "java.util.Map", "org.apache.xmlrpc.XmlRpcException" ]
import java.util.Map; import org.apache.xmlrpc.XmlRpcException;
import java.util.*; import org.apache.xmlrpc.*;
[ "java.util", "org.apache.xmlrpc" ]
java.util; org.apache.xmlrpc;
1,691,186
private void initializeInternalCacheNames() { FileSystemConfiguration[] igfsCfgs = ctx.grid().configuration().getFileSystemConfiguration(); if (igfsCfgs != null) { for (FileSystemConfiguration igfsCfg : igfsCfgs) { internalCaches.add(igfsCfg.getMetaCacheConfiguration().getName()); internalCaches.add(igfsCfg.getDataCacheConfiguration().getName()); } } if (IgniteComponentType.HADOOP.inClassPath()) internalCaches.add(CU.SYS_CACHE_HADOOP_MR); }
void function() { FileSystemConfiguration[] igfsCfgs = ctx.grid().configuration().getFileSystemConfiguration(); if (igfsCfgs != null) { for (FileSystemConfiguration igfsCfg : igfsCfgs) { internalCaches.add(igfsCfg.getMetaCacheConfiguration().getName()); internalCaches.add(igfsCfg.getDataCacheConfiguration().getName()); } } if (IgniteComponentType.HADOOP.inClassPath()) internalCaches.add(CU.SYS_CACHE_HADOOP_MR); }
/** * Initialize internal cache names */
Initialize internal cache names
initializeInternalCacheNames
{ "repo_name": "irudyak/ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java", "license": "apache-2.0", "size": 174729 }
[ "org.apache.ignite.configuration.FileSystemConfiguration", "org.apache.ignite.internal.IgniteComponentType" ]
import org.apache.ignite.configuration.FileSystemConfiguration; import org.apache.ignite.internal.IgniteComponentType;
import org.apache.ignite.configuration.*; import org.apache.ignite.internal.*;
[ "org.apache.ignite" ]
org.apache.ignite;
2,865,510
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller<PollResult<ExpressRouteCrossConnectionInner>, ExpressRouteCrossConnectionInner> beginCreateOrUpdate( String resourceGroupName, String crossConnectionName, ExpressRouteCrossConnectionInner parameters);
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller<PollResult<ExpressRouteCrossConnectionInner>, ExpressRouteCrossConnectionInner> beginCreateOrUpdate( String resourceGroupName, String crossConnectionName, ExpressRouteCrossConnectionInner parameters);
/** * Update the specified ExpressRouteCrossConnection. * * @param resourceGroupName The name of the resource group. * @param crossConnectionName The name of the ExpressRouteCrossConnection. * @param parameters Parameters supplied to the update express route crossConnection operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the {@link SyncPoller} for polling of expressRouteCrossConnection resource. */
Update the specified ExpressRouteCrossConnection
beginCreateOrUpdate
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/resourcemanager/azure-resourcemanager-network/src/main/java/com/azure/resourcemanager/network/fluent/ExpressRouteCrossConnectionsClient.java", "license": "mit", "size": 44449 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.management.polling.PollResult", "com.azure.core.util.polling.SyncPoller", "com.azure.resourcemanager.network.fluent.models.ExpressRouteCrossConnectionInner" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.management.polling.PollResult; import com.azure.core.util.polling.SyncPoller; import com.azure.resourcemanager.network.fluent.models.ExpressRouteCrossConnectionInner;
import com.azure.core.annotation.*; import com.azure.core.management.polling.*; import com.azure.core.util.polling.*; import com.azure.resourcemanager.network.fluent.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
1,994,166
private void reapOld(final GatewaySenderStats statistics, boolean forceEventReap) { synchronized (this.unprocessedEventsLock) { if (uncheckedCount > REAP_THRESHOLD) { // only check every X events uncheckedCount = 0; long now = System.currentTimeMillis(); if (!forceEventReap && this.unprocessedTokens.size() > REAP_THRESHOLD) { Iterator<Map.Entry<EventID, Long>> it = this.unprocessedTokens.entrySet().iterator(); int count = 0; while (it.hasNext()) { Map.Entry<EventID, Long> me = it.next(); long meValue = me.getValue().longValue(); if (meValue <= now) { // @todo log fine level message here // it has expired so remove it it.remove(); count++; } else { // all done try again break; } } if (count > 0) { // statistics.incUnprocessedTokensRemovedByTimeout(count); } } if (forceEventReap || this.unprocessedEvents.size() > REAP_THRESHOLD) { Iterator<Map.Entry<EventID, EventWrapper>> it = this.unprocessedEvents.entrySet().iterator(); int count = 0; while (it.hasNext()) { Map.Entry<EventID, EventWrapper> me = it.next(); EventWrapper ew = me.getValue(); if (ew.timeout <= now) { // @todo log fine level message here // it has expired so remove it it.remove(); ew.event.release(); count++; } else { // all done try again break; } } if (count > 0) { // statistics.incUnprocessedEventsRemovedByTimeout(count); } } } else { uncheckedCount++; } } }
void function(final GatewaySenderStats statistics, boolean forceEventReap) { synchronized (this.unprocessedEventsLock) { if (uncheckedCount > REAP_THRESHOLD) { uncheckedCount = 0; long now = System.currentTimeMillis(); if (!forceEventReap && this.unprocessedTokens.size() > REAP_THRESHOLD) { Iterator<Map.Entry<EventID, Long>> it = this.unprocessedTokens.entrySet().iterator(); int count = 0; while (it.hasNext()) { Map.Entry<EventID, Long> me = it.next(); long meValue = me.getValue().longValue(); if (meValue <= now) { it.remove(); count++; } else { break; } } if (count > 0) { } } if (forceEventReap this.unprocessedEvents.size() > REAP_THRESHOLD) { Iterator<Map.Entry<EventID, EventWrapper>> it = this.unprocessedEvents.entrySet().iterator(); int count = 0; while (it.hasNext()) { Map.Entry<EventID, EventWrapper> me = it.next(); EventWrapper ew = me.getValue(); if (ew.timeout <= now) { it.remove(); ew.event.release(); count++; } else { break; } } if (count > 0) { } } } else { uncheckedCount++; } } }
/** * Call to check if a cleanup of tokens needs to be done */
Call to check if a cleanup of tokens needs to be done
reapOld
{ "repo_name": "davinash/geode", "path": "geode-core/src/main/java/org/apache/geode/internal/cache/wan/serial/SerialGatewaySenderEventProcessor.java", "license": "apache-2.0", "size": 34934 }
[ "java.util.Iterator", "java.util.Map", "org.apache.geode.internal.cache.EventID", "org.apache.geode.internal.cache.wan.AbstractGatewaySender", "org.apache.geode.internal.cache.wan.GatewaySenderStats" ]
import java.util.Iterator; import java.util.Map; import org.apache.geode.internal.cache.EventID; import org.apache.geode.internal.cache.wan.AbstractGatewaySender; import org.apache.geode.internal.cache.wan.GatewaySenderStats;
import java.util.*; import org.apache.geode.internal.cache.*; import org.apache.geode.internal.cache.wan.*;
[ "java.util", "org.apache.geode" ]
java.util; org.apache.geode;
2,713,095
public static void removeListener(ClusterEventListener listener) { listeners.remove(listener); } /** * Triggers event indicating that this JVM is now part of a cluster. At this point the * {@link org.jivesoftware.openfire.XMPPServer#getNodeID()} holds the new nodeID value and * the old nodeID value is passed in case the listener needs it. * <p> * When joining the cluster as the senior cluster member the {@link #fireMarkedAsSeniorClusterMember()}
static void function(ClusterEventListener listener) { listeners.remove(listener); } /** * Triggers event indicating that this JVM is now part of a cluster. At this point the * {@link org.jivesoftware.openfire.XMPPServer#getNodeID()} holds the new nodeID value and * the old nodeID value is passed in case the listener needs it. * <p> * When joining the cluster as the senior cluster member the {@link #fireMarkedAsSeniorClusterMember()}
/** * Unregisters a listener to receive events. * * @param listener the listener. */
Unregisters a listener to receive events
removeListener
{ "repo_name": "speedy01/Openfire", "path": "xmppserver/src/main/java/org/jivesoftware/openfire/cluster/ClusterManager.java", "license": "apache-2.0", "size": 24082 }
[ "org.jivesoftware.openfire.XMPPServer" ]
import org.jivesoftware.openfire.XMPPServer;
import org.jivesoftware.openfire.*;
[ "org.jivesoftware.openfire" ]
org.jivesoftware.openfire;
2,855,474
@Override public void onConnectionFailed(ConnectionResult result) { updateConnectButtonState(); // Most of the time, the connection will fail with a user resolvable result. We can store // that in our mConnectionResult property ready to be used when the user clicks the // sign-in button. if (result.hasResolution()) { mConnectionResult = result; if (mAutoResolveOnFail) { // This is a local helper function that starts the resolution of the problem, // which may be showing the user an account chooser or similar. startResolution(); } } }
void function(ConnectionResult result) { updateConnectButtonState(); if (result.hasResolution()) { mConnectionResult = result; if (mAutoResolveOnFail) { startResolution(); } } }
/** * Connection failed for some reason (called by PlusClient) * Try and resolve the result. Failure here is usually not an indication of a serious error, * just that the user's input is needed. * * @see #onActivityResult(int, int, Intent) */
Connection failed for some reason (called by PlusClient) Try and resolve the result. Failure here is usually not an indication of a serious error, just that the user's input is needed
onConnectionFailed
{ "repo_name": "deanmsands3/PersonnelTracker", "path": "app/src/main/java/com/deanmsands3/mac/personneltracker/PlusBaseActivity.java", "license": "mit", "size": 9984 }
[ "com.google.android.gms.common.ConnectionResult" ]
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.*;
[ "com.google.android" ]
com.google.android;
985,340
public synchronized void addJingleSessionRequestListener(final JingleSessionRequestListener jingleSessionRequestListener) { if (jingleSessionRequestListener != null) { if (jingleSessionRequestListeners == null) { initJingleSessionRequestListeners(); } synchronized (jingleSessionRequestListeners) { jingleSessionRequestListeners.add(jingleSessionRequestListener); } } }
synchronized void function(final JingleSessionRequestListener jingleSessionRequestListener) { if (jingleSessionRequestListener != null) { if (jingleSessionRequestListeners == null) { initJingleSessionRequestListeners(); } synchronized (jingleSessionRequestListeners) { jingleSessionRequestListeners.add(jingleSessionRequestListener); } } }
/** * Add a Jingle session request listenerJingle to listen to incoming session * requests. * * @param jingleSessionRequestListener an implemented JingleSessionRequestListener * @see #removeJingleSessionRequestListener(JingleSessionRequestListener) * @see JingleListener */
Add a Jingle session request listenerJingle to listen to incoming session requests
addJingleSessionRequestListener
{ "repo_name": "igniterealtime/Smack", "path": "smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleManager.java", "license": "apache-2.0", "size": 26268 }
[ "org.jivesoftware.smackx.jingleold.listeners.JingleSessionRequestListener" ]
import org.jivesoftware.smackx.jingleold.listeners.JingleSessionRequestListener;
import org.jivesoftware.smackx.jingleold.listeners.*;
[ "org.jivesoftware.smackx" ]
org.jivesoftware.smackx;
2,025,210
protected void persistSessionId(String location, String identifier, Long ksessionId) { if (location == null) { return; } FileOutputStream fos = null; ObjectOutputStream out = null; try { fos = new FileOutputStream(location + File.separator + identifier + "-jbpmSessionId.ser"); out = new ObjectOutputStream(fos); out.writeObject(Long.valueOf(ksessionId)); out.close(); } catch (IOException ex) { // logger.warn("Error when persisting known session id", ex); } finally { if (fos != null) { try { fos.close(); } catch (IOException e) { } } if (out != null) { try { out.close(); } catch (IOException e) { } } } }
void function(String location, String identifier, Long ksessionId) { if (location == null) { return; } FileOutputStream fos = null; ObjectOutputStream out = null; try { fos = new FileOutputStream(location + File.separator + identifier + STR); out = new ObjectOutputStream(fos); out.writeObject(Long.valueOf(ksessionId)); out.close(); } catch (IOException ex) { } finally { if (fos != null) { try { fos.close(); } catch (IOException e) { } } if (out != null) { try { out.close(); } catch (IOException e) { } } } }
/** * Stores gives ksessionId in a serialized file in given location under jbpmSessionId.ser file name * @param location directory where serialized file should be stored * @param identifier of the manager owning this ksessionId * @param ksessionId value of ksessionId to be stored */
Stores gives ksessionId in a serialized file in given location under jbpmSessionId.ser file name
persistSessionId
{ "repo_name": "Salaboy/jbpm", "path": "jbpm-runtime-manager/src/main/java/org/jbpm/runtime/manager/impl/SingletonRuntimeManager.java", "license": "apache-2.0", "size": 10206 }
[ "java.io.File", "java.io.FileOutputStream", "java.io.IOException", "java.io.ObjectOutputStream" ]
import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.ObjectOutputStream;
import java.io.*;
[ "java.io" ]
java.io;
853,948
protected static File getCSVFolder(final File baseFolder) { if (!baseFolder.exists()) { log.error("Base folder does not exist. [%s]", baseFolder.getAbsolutePath()); return null; } final File csvFolder = new File(baseFolder, "csv"); if (!csvFolder.exists()) { log.info("Creating csv folder: {}", csvFolder.getAbsolutePath()); try { Files.createDirectories(csvFolder.toPath()); } catch (IOException e) { log.error("Error creating directories to CSV folder"); return null; } } return csvFolder; }
static File function(final File baseFolder) { if (!baseFolder.exists()) { log.error(STR, baseFolder.getAbsolutePath()); return null; } final File csvFolder = new File(baseFolder, "csv"); if (!csvFolder.exists()) { log.info(STR, csvFolder.getAbsolutePath()); try { Files.createDirectories(csvFolder.toPath()); } catch (IOException e) { log.error(STR); return null; } } return csvFolder; }
/** * Returns the folder for exported CSV files. * * @param baseFolder the folder which the CSV folder will be found or created. * @return the folder for exported CSV files. */
Returns the folder for exported CSV files
getCSVFolder
{ "repo_name": "trew/RankTracker", "path": "src/main/java/se/samuelandersson/rocketleague/tasks/ScanTask.java", "license": "mit", "size": 7664 }
[ "java.io.File", "java.io.IOException", "java.nio.file.Files" ]
import java.io.File; import java.io.IOException; import java.nio.file.Files;
import java.io.*; import java.nio.file.*;
[ "java.io", "java.nio" ]
java.io; java.nio;
448,917
public String getTypeAsString(Node node, boolean cftype);
String function(Node node, boolean cftype);
/** * returns the Node Type As String * @param node * @param cftype * @return */
returns the Node Type As String
getTypeAsString
{ "repo_name": "lucee/unoffical-Lucee-no-jre", "path": "source/java/loader/src/lucee/runtime/util/XMLUtil.java", "license": "lgpl-2.1", "size": 10306 }
[ "org.w3c.dom.Node" ]
import org.w3c.dom.Node;
import org.w3c.dom.*;
[ "org.w3c.dom" ]
org.w3c.dom;
405,563
private boolean moveToError(final File file){ String errorDir = settings.getDirError(); boolean ok = false; if (errorDir != null && errorDir.length() > 0) { if (FileTool.copyFile(file, new File(errorDir + File.separator + file.getName()), FileTool.REPLACE_IF_EXISTS)) { ok = file.delete(); } } return ok; }
boolean function(final File file){ String errorDir = settings.getDirError(); boolean ok = false; if (errorDir != null && errorDir.length() > 0) { if (FileTool.copyFile(file, new File(errorDir + File.separator + file.getName()), FileTool.REPLACE_IF_EXISTS)) { ok = file.delete(); } } return ok; }
/** * Datei wird ins Error Verzeichnis verschoben * * @param file * Datei, welche ins Error Verzeichnis verschoben werden soll * @return true bei Erfolg, sonst false. */
Datei wird ins Error Verzeichnis verschoben
moveToError
{ "repo_name": "DavidGutknecht/elexis-3-base", "path": "bundles/ch.elexis.laborimport.viollier.v2/src/ch/elexis/labor/viollier/v2/labimport/LabOrderImport.java", "license": "epl-1.0", "size": 38426 }
[ "ch.rgw.io.FileTool", "java.io.File" ]
import ch.rgw.io.FileTool; import java.io.File;
import ch.rgw.io.*; import java.io.*;
[ "ch.rgw.io", "java.io" ]
ch.rgw.io; java.io;
959,875
public Set<String> getParentNodeIDs() { return goTree.keySet(); }
Set<String> function() { return goTree.keySet(); }
/** * return all nodeIDs that have children * * @return */
return all nodeIDs that have children
getParentNodeIDs
{ "repo_name": "sugang/coolmap", "path": "src/coolmap/utils/bioparser/simpleobo/SimpleOBOTree.java", "license": "gpl-2.0", "size": 5080 }
[ "java.util.Set" ]
import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
208,533
List<TimerData> getAggregatedTimerData(TimerData timerData, Date fromDate, Date toDate);
List<TimerData> getAggregatedTimerData(TimerData timerData, Date fromDate, Date toDate);
/** * Returns a list of the timer data for a given template for a time frame. In this template, * only the platform id is extracted. * * @param timerData * The template containing the platform id. * @param fromDate * Date to include data from. * @param toDate * Date to include data to. * @return The list of the timer data object. */
Returns a list of the timer data for a given template for a time frame. In this template, only the platform id is extracted
getAggregatedTimerData
{ "repo_name": "MarioRose/inspectIT", "path": "CommonsCS/src/info/novatec/inspectit/cmr/service/ITimerDataAccessService.java", "license": "agpl-3.0", "size": 1145 }
[ "info.novatec.inspectit.communication.data.TimerData", "java.util.Date", "java.util.List" ]
import info.novatec.inspectit.communication.data.TimerData; import java.util.Date; import java.util.List;
import info.novatec.inspectit.communication.data.*; import java.util.*;
[ "info.novatec.inspectit", "java.util" ]
info.novatec.inspectit; java.util;
1,873,247
public void aplicarDiarioPartida() throws Exception{ if(this.getEjercicio().getEstEjercicio().getId().longValue()==EstEjercicio.ID_ABIERTO){ List<Object[]> listTotPar = BalDAOFactory.getDiarioPartidaDAO().getImportesGroupByPartidaForBalance(this); for(Object[] arrayResult: listTotPar){ Long idPartida = (Long) arrayResult[0]; Partida partida = BalanceCache.getInstance().getPartidaById(idPartida); Double importeEjeAct = NumberUtil.truncate((Double) arrayResult[1], SiatParam.DEC_IMPORTE_DB); Double importeEjeVen = NumberUtil.truncate((Double) arrayResult[2], SiatParam.DEC_IMPORTE_DB); ImpPar impPar = new ImpPar(); impPar.setBalance(this); impPar.setFecha(this.getFechaBalance()); impPar.setPartida(partida); impPar.setImporteEjeAct(importeEjeAct); impPar.setImporteEjeVen(importeEjeVen); BalDAOFactory.getImpParDAO().update(impPar); } } }
void function() throws Exception{ if(this.getEjercicio().getEstEjercicio().getId().longValue()==EstEjercicio.ID_ABIERTO){ List<Object[]> listTotPar = BalDAOFactory.getDiarioPartidaDAO().getImportesGroupByPartidaForBalance(this); for(Object[] arrayResult: listTotPar){ Long idPartida = (Long) arrayResult[0]; Partida partida = BalanceCache.getInstance().getPartidaById(idPartida); Double importeEjeAct = NumberUtil.truncate((Double) arrayResult[1], SiatParam.DEC_IMPORTE_DB); Double importeEjeVen = NumberUtil.truncate((Double) arrayResult[2], SiatParam.DEC_IMPORTE_DB); ImpPar impPar = new ImpPar(); impPar.setBalance(this); impPar.setFecha(this.getFechaBalance()); impPar.setPartida(partida); impPar.setImporteEjeAct(importeEjeAct); impPar.setImporteEjeVen(importeEjeVen); BalDAOFactory.getImpParDAO().update(impPar); } } }
/** * Aplicar los registros de DiarioPartida (imputaciones a partidas de los asentamientos) al Maestro de Rentas (ImpPar) * * <i>(paso 6.1)</i> */
Aplicar los registros de DiarioPartida (imputaciones a partidas de los asentamientos) al Maestro de Rentas (ImpPar) (paso 6.1)
aplicarDiarioPartida
{ "repo_name": "avdata99/SIAT", "path": "siat-1.0-SOURCE/src/buss/src/ar/gov/rosario/siat/bal/buss/bean/Balance.java", "license": "gpl-3.0", "size": 181568 }
[ "ar.gov.rosario.siat.bal.buss.cache.BalanceCache", "ar.gov.rosario.siat.bal.buss.dao.BalDAOFactory", "ar.gov.rosario.siat.base.iface.model.SiatParam", "coop.tecso.demoda.iface.helper.NumberUtil", "java.util.List" ]
import ar.gov.rosario.siat.bal.buss.cache.BalanceCache; import ar.gov.rosario.siat.bal.buss.dao.BalDAOFactory; import ar.gov.rosario.siat.base.iface.model.SiatParam; import coop.tecso.demoda.iface.helper.NumberUtil; import java.util.List;
import ar.gov.rosario.siat.bal.buss.cache.*; import ar.gov.rosario.siat.bal.buss.dao.*; import ar.gov.rosario.siat.base.iface.model.*; import coop.tecso.demoda.iface.helper.*; import java.util.*;
[ "ar.gov.rosario", "coop.tecso.demoda", "java.util" ]
ar.gov.rosario; coop.tecso.demoda; java.util;
1,834,553
public String buildEdgeId(Node node1, Node node2) { if (node1.getId().compareTo(node2.getId()) < 0) { return getRelationshipLabel() + "#" + node1.getId() + "#" + node2.getId(); } else { return getRelationshipLabel() + "#" + node2.getId() + "#" + node1.getId(); } }
String function(Node node1, Node node2) { if (node1.getId().compareTo(node2.getId()) < 0) { return getRelationshipLabel() + "#" + node1.getId() + "#" + node2.getId(); } else { return getRelationshipLabel() + "#" + node2.getId() + "#" + node1.getId(); } }
/** * Build a unique identifier for the undirected edge between the nodes. The edge id is build * from the Relationship label and the nodes ids in ascending order. * * @param node1 * The first node to connect. * @param node2 * The second node to connect. * @return The prepared edge id. */
Build a unique identifier for the undirected edge between the nodes. The edge id is build from the Relationship label and the nodes ids in ascending order
buildEdgeId
{ "repo_name": "kopl/SPLevo", "path": "VPMAnalyzer/org.splevo.vpm.analyzer/src/org/splevo/vpm/analyzer/AbstractVPMAnalyzer.java", "license": "epl-1.0", "size": 5513 }
[ "org.graphstream.graph.Node" ]
import org.graphstream.graph.Node;
import org.graphstream.graph.*;
[ "org.graphstream.graph" ]
org.graphstream.graph;
1,254,313
public EventuallyConsistentMap<DestinationSetNextObjectiveStoreKey, NextNeighbors> dsNextObjStore() { return dsNextObjStore; }
EventuallyConsistentMap<DestinationSetNextObjectiveStoreKey, NextNeighbors> function() { return dsNextObjStore; }
/** * Per device next objective ID store with (device id + destination set) as key. * Used to keep track on MPLS group information. * * @return next objective ID store */
Per device next objective ID store with (device id + destination set) as key. Used to keep track on MPLS group information
dsNextObjStore
{ "repo_name": "oplinkoms/onos", "path": "apps/segmentrouting/app/src/main/java/org/onosproject/segmentrouting/SegmentRoutingManager.java", "license": "apache-2.0", "size": 108504 }
[ "org.onosproject.segmentrouting.grouphandler.NextNeighbors", "org.onosproject.segmentrouting.storekey.DestinationSetNextObjectiveStoreKey", "org.onosproject.store.service.EventuallyConsistentMap" ]
import org.onosproject.segmentrouting.grouphandler.NextNeighbors; import org.onosproject.segmentrouting.storekey.DestinationSetNextObjectiveStoreKey; import org.onosproject.store.service.EventuallyConsistentMap;
import org.onosproject.segmentrouting.grouphandler.*; import org.onosproject.segmentrouting.storekey.*; import org.onosproject.store.service.*;
[ "org.onosproject.segmentrouting", "org.onosproject.store" ]
org.onosproject.segmentrouting; org.onosproject.store;
1,291,038
protected String contextKeyString(Object contextKey) { return ObjectUtils.nullSafeToString(contextKey); }
String function(Object contextKey) { return ObjectUtils.nullSafeToString(contextKey); }
/** * Subclasses can override this to return a String representation of their * context key for use in caching and logging. * @param contextKey the context key */
Subclasses can override this to return a String representation of their context key for use in caching and logging
contextKeyString
{ "repo_name": "BeamFoundry/spring-osgi", "path": "spring-dm/core/src/main/java/org/springframework/osgi/util/test/AbstractSpringContextTests.java", "license": "apache-2.0", "size": 6079 }
[ "org.springframework.util.ObjectUtils" ]
import org.springframework.util.ObjectUtils;
import org.springframework.util.*;
[ "org.springframework.util" ]
org.springframework.util;
1,961,185
public static NXmirror createNXmirror(long oid) { return new NXmirrorImpl(oid); }
static NXmirror function(long oid) { return new NXmirrorImpl(oid); }
/** * Create a new NXmirror with the given oid. */
Create a new NXmirror with the given oid
createNXmirror
{ "repo_name": "colinpalmer/dawnsci", "path": "org.eclipse.dawnsci.nexus/autogen/org/eclipse/dawnsci/nexus/NexusNodeFactory.java", "license": "epl-1.0", "size": 25082 }
[ "org.eclipse.dawnsci.nexus.impl.NXmirrorImpl" ]
import org.eclipse.dawnsci.nexus.impl.NXmirrorImpl;
import org.eclipse.dawnsci.nexus.impl.*;
[ "org.eclipse.dawnsci" ]
org.eclipse.dawnsci;
306,325
public void run() { ModelListener modelListener = controller.dm_.ml_; controller.dm_.ml_ = null; try { SwingUtilities.invokeAndWait(suspendGUI); for (int i = 0; i < controller.batches.size(); ++i) { // controller.dm_.validateFile(controller.batches.get(i) // .getDestinationFK(), controller.batches.get(i) // .getDestinationFV()); File feature_values_save_file = new File(controller.batches .get(i).getDestinationFV()); File feature_definitions_save_file = new File( controller.batches.get(i).getDestinationFK()); // Prepare stream writers controller.dm_.featureKey = new FileOutputStream( feature_values_save_file); controller.dm_.featureValue = new FileOutputStream( feature_definitions_save_file); controller.batches.get(i).execute(); updateGUI.incrementBatch(); SwingUtilities.invokeLater(updateGUI); } SwingUtilities.invokeLater(resumeGUI); } catch (Exception e) { errorGUI.e = e; SwingUtilities.invokeLater(errorGUI); SwingUtilities.invokeLater(resumeGUI); } hasRun = true; batchProgressFrame.setVisible(false); controller.dm_.ml_ = modelListener; try { SwingUtilities.invokeAndWait(restoreSettings); sleep(1000); } catch (InterruptedException e) { System.err.println("INTERNAL ERROR: " + e.getMessage()); e.printStackTrace(); } catch (InvocationTargetException e) { System.err.println("INTERNAL ERROR: " + e.getMessage()); e.printStackTrace(); } }
void function() { ModelListener modelListener = controller.dm_.ml_; controller.dm_.ml_ = null; try { SwingUtilities.invokeAndWait(suspendGUI); for (int i = 0; i < controller.batches.size(); ++i) { File feature_values_save_file = new File(controller.batches .get(i).getDestinationFV()); File feature_definitions_save_file = new File( controller.batches.get(i).getDestinationFK()); controller.dm_.featureKey = new FileOutputStream( feature_values_save_file); controller.dm_.featureValue = new FileOutputStream( feature_definitions_save_file); controller.batches.get(i).execute(); updateGUI.incrementBatch(); SwingUtilities.invokeLater(updateGUI); } SwingUtilities.invokeLater(resumeGUI); } catch (Exception e) { errorGUI.e = e; SwingUtilities.invokeLater(errorGUI); SwingUtilities.invokeLater(resumeGUI); } hasRun = true; batchProgressFrame.setVisible(false); controller.dm_.ml_ = modelListener; try { SwingUtilities.invokeAndWait(restoreSettings); sleep(1000); } catch (InterruptedException e) { System.err.println(STR + e.getMessage()); e.printStackTrace(); } catch (InvocationTargetException e) { System.err.println(STR + e.getMessage()); e.printStackTrace(); } }
/** * Executes a batch. Executes in its own thread, communicating with the * swing thread via runnable objects that are inserted into the swing * thread. Acts as a controller in a classic MVC pattern (with the batches * as model and the swing thread as view). */
Executes a batch. Executes in its own thread, communicating with the swing thread via runnable objects that are inserted into the swing thread. Acts as a controller in a classic MVC pattern (with the batches as model and the swing thread as view)
run
{ "repo_name": "dmcennis/jMir", "path": "jMIR_2_4_developer/jAudio/src/jAudioFeatureExtractor/BatchExecutionThread.java", "license": "gpl-2.0", "size": 6805 }
[ "java.io.File", "java.io.FileOutputStream", "java.lang.reflect.InvocationTargetException", "javax.swing.SwingUtilities" ]
import java.io.File; import java.io.FileOutputStream; import java.lang.reflect.InvocationTargetException; import javax.swing.SwingUtilities;
import java.io.*; import java.lang.reflect.*; import javax.swing.*;
[ "java.io", "java.lang", "javax.swing" ]
java.io; java.lang; javax.swing;
190,292
protected void assertPredicate(String languageName, String expressionText, Exchange exchange, boolean expected) { Language language = assertResolveLanguage(languageName); Predicate predicate = language.createPredicate(expressionText); assertNotNull("No Predicate could be created for text: " + expressionText + " language: " + language, predicate); assertPredicate(predicate, exchange, expected); }
void function(String languageName, String expressionText, Exchange exchange, boolean expected) { Language language = assertResolveLanguage(languageName); Predicate predicate = language.createPredicate(expressionText); assertNotNull(STR + expressionText + STR + language, predicate); assertPredicate(predicate, exchange, expected); }
/** * Asserts that the given language name and predicate expression evaluates * to the expected value on the message exchange */
Asserts that the given language name and predicate expression evaluates to the expected value on the message exchange
assertPredicate
{ "repo_name": "engagepoint/camel", "path": "components/camel-test/src/main/java/org/apache/camel/test/junit4/CamelTestSupport.java", "license": "apache-2.0", "size": 25706 }
[ "org.apache.camel.Exchange", "org.apache.camel.Predicate", "org.apache.camel.spi.Language" ]
import org.apache.camel.Exchange; import org.apache.camel.Predicate; import org.apache.camel.spi.Language;
import org.apache.camel.*; import org.apache.camel.spi.*;
[ "org.apache.camel" ]
org.apache.camel;
386,602
private void manageRoomOnActivity(final Context aContext) { final Activity currentActivity = VectorApp.getCurrentActivity();
void function(final Context aContext) { final Activity currentActivity = VectorApp.getCurrentActivity();
/** * Start the universal link management when the login process is done. * If there is no active activity, launch the home activity * @param aContext the context. */
Start the universal link management when the login process is done. If there is no active activity, launch the home activity
manageRoomOnActivity
{ "repo_name": "vt0r/vector-android", "path": "vector/src/main/java/im/vector/receiver/VectorUniversalLinkReceiver.java", "license": "apache-2.0", "size": 17448 }
[ "android.app.Activity", "android.content.Context", "im.vector.VectorApp" ]
import android.app.Activity; import android.content.Context; import im.vector.VectorApp;
import android.app.*; import android.content.*; import im.vector.*;
[ "android.app", "android.content", "im.vector" ]
android.app; android.content; im.vector;
1,238,556
CloseableIterator<SKOSConcept> listConcepts();
CloseableIterator<SKOSConcept> listConcepts();
/** * Returns a closeable iterator over the concepts of this concept scheme * @return {@code CloseableIterator<SKOSConcept>} over the concepts of this concept * scheme. If the concept scheme contains no concepts, then an empty iterator * is returned. */
Returns a closeable iterator over the concepts of this concept scheme
listConcepts
{ "repo_name": "beaufort/semantix", "path": "semantix-skos-model/src/main/java/ie/cmrc/smtx/skos/model/SKOSConceptScheme.java", "license": "apache-2.0", "size": 12665 }
[ "ie.cmrc.smtx.skos.model.util.CloseableIterator" ]
import ie.cmrc.smtx.skos.model.util.CloseableIterator;
import ie.cmrc.smtx.skos.model.util.*;
[ "ie.cmrc.smtx" ]
ie.cmrc.smtx;
2,257,328
void publish(final Exchange exchange) throws DisruptorNotStartedException { disruptorReference.publish(exchange); }
void publish(final Exchange exchange) throws DisruptorNotStartedException { disruptorReference.publish(exchange); }
/** * Called by DisruptorProducers to publish new exchanges on the RingBuffer, blocking when full */
Called by DisruptorProducers to publish new exchanges on the RingBuffer, blocking when full
publish
{ "repo_name": "curso007/camel", "path": "components/camel-disruptor/src/main/java/org/apache/camel/component/disruptor/DisruptorEndpoint.java", "license": "apache-2.0", "size": 14235 }
[ "org.apache.camel.Exchange" ]
import org.apache.camel.Exchange;
import org.apache.camel.*;
[ "org.apache.camel" ]
org.apache.camel;
1,907,819
private void recordScriptReleaseVersionFromTagResult(@Nonnull final ParsedHtmlTag parsedTag) { if (this.getScriptReleaseVersion() == ExtensionsUtils.ScriptReleaseVersion.UNKNOWN && (parsedTag.isExtensionScript() || parsedTag.isAmpRuntimeScript())) { this.scriptReleaseVersion = parsedTag.getScriptReleaseVersion(); } }
void function(@Nonnull final ParsedHtmlTag parsedTag) { if (this.getScriptReleaseVersion() == ExtensionsUtils.ScriptReleaseVersion.UNKNOWN && (parsedTag.isExtensionScript() parsedTag.isAmpRuntimeScript())) { this.scriptReleaseVersion = parsedTag.getScriptReleaseVersion(); } }
/** * Record if this document contains a tag requesting the LTS runtime engine. * * @param parsedTag */
Record if this document contains a tag requesting the LTS runtime engine
recordScriptReleaseVersionFromTagResult
{ "repo_name": "ampproject/validator-java", "path": "src/main/java/dev/amp/validator/Context.java", "license": "apache-2.0", "size": 25071 }
[ "dev.amp.validator.utils.ExtensionsUtils", "javax.annotation.Nonnull" ]
import dev.amp.validator.utils.ExtensionsUtils; import javax.annotation.Nonnull;
import dev.amp.validator.utils.*; import javax.annotation.*;
[ "dev.amp.validator", "javax.annotation" ]
dev.amp.validator; javax.annotation;
1,586,484
public RouteFilterRulePropertiesFormat withCommunities(List<String> communities) { this.communities = communities; return this; }
RouteFilterRulePropertiesFormat function(List<String> communities) { this.communities = communities; return this; }
/** * Set the communities property: The collection for bgp community values to filter on. e.g. * ['12076:5010','12076:5020']. * * @param communities the communities value to set. * @return the RouteFilterRulePropertiesFormat object itself. */
Set the communities property: The collection for bgp community values to filter on. e.g. ['12076:5010','12076:5020']
withCommunities
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/resourcemanagerhybrid/azure-resourcemanager-network/src/main/java/com/azure/resourcemanager/network/fluent/models/RouteFilterRulePropertiesFormat.java", "license": "mit", "size": 4911 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
338,175
public void onTouchMove(MotionEvent event) { makeStar(event.getX(), event.getY()); // draw stars according to the history points. for (int i = 0, n = event.getHistorySize(); i < n; i++) { makeStar(event.getHistoricalX(i), event.getHistoricalY(i)); } invalidate(); }
void function(MotionEvent event) { makeStar(event.getX(), event.getY()); for (int i = 0, n = event.getHistorySize(); i < n; i++) { makeStar(event.getHistoricalX(i), event.getHistoricalY(i)); } invalidate(); }
/** * Called when {@link android.view.MotionEvent} is ACTION_MOVE. * @param event motion event which carries touch coordinates. */
Called when <code>android.view.MotionEvent</code> is ACTION_MOVE
onTouchMove
{ "repo_name": "letanloc/AndroidGlitterView", "path": "glitterview/src/main/java/com/liangfeizc/glitterview/GlitterView.java", "license": "mit", "size": 5765 }
[ "android.view.MotionEvent" ]
import android.view.MotionEvent;
import android.view.*;
[ "android.view" ]
android.view;
2,461,235
public Element setLang (String lang) { addAttribute ("lang", lang); addAttribute ("xml:lang", lang); return this; }
Element function (String lang) { addAttribute ("lang", lang); addAttribute (STR, lang); return this; }
/** * Sets the lang="" and xml:lang="" attributes * * @param lang * the lang="" and xml:lang="" attributes */
Sets the lang="" and xml:lang="" attributes
setLang
{ "repo_name": "neuroidss/adempiere", "path": "tools/src/org/apache/ecs/xhtml/h4.java", "license": "gpl-2.0", "size": 7255 }
[ "org.apache.ecs.Element" ]
import org.apache.ecs.Element;
import org.apache.ecs.*;
[ "org.apache.ecs" ]
org.apache.ecs;
670,160
public void setAbandonedLogWriter(PrintWriter logWriter) { if (abandonedConfig == null) { abandonedConfig = new AbandonedConfig(); } abandonedConfig.setLogWriter(logWriter); }
void function(PrintWriter logWriter) { if (abandonedConfig == null) { abandonedConfig = new AbandonedConfig(); } abandonedConfig.setLogWriter(logWriter); }
/** * Sets the log writer to be used by this configuration to log * information on abandoned objects. * * @param logWriter The new log writer */
Sets the log writer to be used by this configuration to log information on abandoned objects
setAbandonedLogWriter
{ "repo_name": "wenzhucjy/tomcat_source", "path": "tomcat-8.0.9-sourcecode/java/org/apache/tomcat/dbcp/dbcp2/BasicDataSource.java", "license": "apache-2.0", "size": 84609 }
[ "java.io.PrintWriter", "org.apache.tomcat.dbcp.pool2.impl.AbandonedConfig" ]
import java.io.PrintWriter; import org.apache.tomcat.dbcp.pool2.impl.AbandonedConfig;
import java.io.*; import org.apache.tomcat.dbcp.pool2.impl.*;
[ "java.io", "org.apache.tomcat" ]
java.io; org.apache.tomcat;
984,330
private static void addColumnDimensions(Expression expression, Set<CarbonDimension> filterDimensions, Set<CarbonMeasure> filterMeasure) { if (null != expression && expression instanceof ColumnExpression) { if (((ColumnExpression) expression).isDimension()) { filterDimensions.add(((ColumnExpression) expression).getDimension()); } else { filterMeasure.add((CarbonMeasure) ((ColumnExpression) expression).getCarbonColumn()); } return; } else if (null != expression) { for (Expression child : expression.getChildren()) { addColumnDimensions(child, filterDimensions, filterMeasure); } } }
static void function(Expression expression, Set<CarbonDimension> filterDimensions, Set<CarbonMeasure> filterMeasure) { if (null != expression && expression instanceof ColumnExpression) { if (((ColumnExpression) expression).isDimension()) { filterDimensions.add(((ColumnExpression) expression).getDimension()); } else { filterMeasure.add((CarbonMeasure) ((ColumnExpression) expression).getCarbonColumn()); } return; } else if (null != expression) { for (Expression child : expression.getChildren()) { addColumnDimensions(child, filterDimensions, filterMeasure); } } }
/** * This method will check if a given expression contains a column expression * recursively and add the dimension instance to the set which holds the dimension * instances of the complex filter expressions. */
This method will check if a given expression contains a column expression recursively and add the dimension instance to the set which holds the dimension instances of the complex filter expressions
addColumnDimensions
{ "repo_name": "HuaweiBigData/carbondata", "path": "core/src/main/java/org/apache/carbondata/core/scan/executor/util/QueryUtil.java", "license": "apache-2.0", "size": 41047 }
[ "java.util.Set", "org.apache.carbondata.core.metadata.schema.table.column.CarbonDimension", "org.apache.carbondata.core.metadata.schema.table.column.CarbonMeasure", "org.apache.carbondata.core.scan.expression.ColumnExpression", "org.apache.carbondata.core.scan.expression.Expression" ]
import java.util.Set; import org.apache.carbondata.core.metadata.schema.table.column.CarbonDimension; import org.apache.carbondata.core.metadata.schema.table.column.CarbonMeasure; import org.apache.carbondata.core.scan.expression.ColumnExpression; import org.apache.carbondata.core.scan.expression.Expression;
import java.util.*; import org.apache.carbondata.core.metadata.schema.table.column.*; import org.apache.carbondata.core.scan.expression.*;
[ "java.util", "org.apache.carbondata" ]
java.util; org.apache.carbondata;
1,500,808
public static Constructor<?> findConstructor(Class<?> type, Class<?>...args) throws NoSuchMethodException { if (type.isPrimitive()) { throw new NoSuchMethodException("Primitive wrapper does not contain constructors"); } if (type.isInterface()) { throw new NoSuchMethodException("Interface does not contain constructors"); } if (Modifier.isAbstract(type.getModifiers())) { throw new NoSuchMethodException("Abstract class cannot be instantiated"); } if (!Modifier.isPublic(type.getModifiers()) || !isPackageAccessible(type)) { throw new NoSuchMethodException("Class is not accessible"); } PrimitiveWrapperMap.replacePrimitivesWithWrappers(args); Signature signature = new Signature(type, args); try { return CACHE.get(signature); } catch (SignatureException exception) { throw exception.toNoSuchMethodException("Constructor is not found"); } } private ConstructorFinder(Class<?>[] args) { super(args); }
static Constructor<?> function(Class<?> type, Class<?>...args) throws NoSuchMethodException { if (type.isPrimitive()) { throw new NoSuchMethodException(STR); } if (type.isInterface()) { throw new NoSuchMethodException(STR); } if (Modifier.isAbstract(type.getModifiers())) { throw new NoSuchMethodException(STR); } if (!Modifier.isPublic(type.getModifiers()) !isPackageAccessible(type)) { throw new NoSuchMethodException(STR); } PrimitiveWrapperMap.replacePrimitivesWithWrappers(args); Signature signature = new Signature(type, args); try { return CACHE.get(signature); } catch (SignatureException exception) { throw exception.toNoSuchMethodException(STR); } } private ConstructorFinder(Class<?>[] args) { super(args); }
/** * Finds public constructor * that is declared in public class. * * @param type the class that can have constructor * @param args parameter types that is used to find constructor * @return object that represents found constructor * @throws NoSuchMethodException if constructor could not be found * or some constructors are found */
Finds public constructor that is declared in public class
findConstructor
{ "repo_name": "rokn/Count_Words_2015", "path": "testing/openjdk2/jdk/src/share/classes/com/sun/beans/finder/ConstructorFinder.java", "license": "mit", "size": 3937 }
[ "java.lang.reflect.Constructor", "java.lang.reflect.Modifier" ]
import java.lang.reflect.Constructor; import java.lang.reflect.Modifier;
import java.lang.reflect.*;
[ "java.lang" ]
java.lang;
217,293
public boolean isAppletAvailable(String applet, String binaryPath) { try { for (String aplet : getBusyBoxApplets(binaryPath)) { if (aplet.equals(applet)) { return true; } } return false; } catch (Exception e) { RootTools.log(e.toString()); return false; } }
boolean function(String applet, String binaryPath) { try { for (String aplet : getBusyBoxApplets(binaryPath)) { if (aplet.equals(applet)) { return true; } } return false; } catch (Exception e) { RootTools.log(e.toString()); return false; } }
/** * This will let you know if an applet is available from BusyBox * <p/> * * @param applet The applet to check for. * @return <code>true</code> if applet is available, false otherwise. */
This will let you know if an applet is available from BusyBox
isAppletAvailable
{ "repo_name": "Fusion/BambooGarden", "path": "src/com/stericson/RootTools/internal/RootToolsInternalMethods.java", "license": "bsd-3-clause", "size": 55096 }
[ "com.stericson.RootTools" ]
import com.stericson.RootTools;
import com.stericson.*;
[ "com.stericson" ]
com.stericson;
1,407,508
@Generated @Selector("addressBook") public native ConstVoidPtr addressBook();
@Selector(STR) native ConstVoidPtr function();
/** * The Address Book to use. Any contact returned will be from this ABAddressBook instance. * If not set, a new ABAddressBook will be created the first time the property is accessed. */
The Address Book to use. Any contact returned will be from this ABAddressBook instance. If not set, a new ABAddressBook will be created the first time the property is accessed
addressBook
{ "repo_name": "multi-os-engine/moe-core", "path": "moe.apple/moe.platform.ios/src/main/java/apple/addressbookui/ABUnknownPersonViewController.java", "license": "apache-2.0", "size": 10459 }
[ "org.moe.natj.general.ptr.ConstVoidPtr", "org.moe.natj.objc.ann.Selector" ]
import org.moe.natj.general.ptr.ConstVoidPtr; import org.moe.natj.objc.ann.Selector;
import org.moe.natj.general.ptr.*; import org.moe.natj.objc.ann.*;
[ "org.moe.natj" ]
org.moe.natj;
680,613
public R initiateService(SessionFactoryImplementor sessionFactory, MetadataImplementor metadata, ServiceRegistryImplementor registry);
R function(SessionFactoryImplementor sessionFactory, MetadataImplementor metadata, ServiceRegistryImplementor registry);
/** * Initiates the managed service. * <p/> * Note for implementors: signature is guaranteed to change once redesign of SessionFactory building is complete * * @param sessionFactory The session factory. Note the the session factory is still in flux; care needs to be taken * in regards to what you call. * @param metadata The configuration. * @param registry The service registry. Can be used to locate services needed to fulfill initiation. * * @return The initiated service. */
Initiates the managed service. Note for implementors: signature is guaranteed to change once redesign of SessionFactory building is complete
initiateService
{ "repo_name": "kevin-chen-hw/LDAE", "path": "com.huawei.soa.ldae/src/main/java/org/hibernate/service/spi/SessionFactoryServiceInitiator.java", "license": "lgpl-2.1", "size": 2825 }
[ "org.hibernate.engine.spi.SessionFactoryImplementor", "org.hibernate.metamodel.source.MetadataImplementor" ]
import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.metamodel.source.MetadataImplementor;
import org.hibernate.engine.spi.*; import org.hibernate.metamodel.source.*;
[ "org.hibernate.engine", "org.hibernate.metamodel" ]
org.hibernate.engine; org.hibernate.metamodel;
2,049,136
return new JavacParser(options); }
return new JavacParser(options); }
/** * Return a new Parser instance with the provided Options. */
Return a new Parser instance with the provided Options
newParser
{ "repo_name": "bandcampdotcom/j2objc", "path": "translator/src/main/java/com/google/devtools/j2objc/util/Parser.java", "license": "apache-2.0", "size": 6423 }
[ "com.google.devtools.j2objc.javac.JavacParser" ]
import com.google.devtools.j2objc.javac.JavacParser;
import com.google.devtools.j2objc.javac.*;
[ "com.google.devtools" ]
com.google.devtools;
2,779,386
@Nonnull public PrintJobCollectionRequest top(final int value) { addTopOption(value); return this; }
PrintJobCollectionRequest function(final int value) { addTopOption(value); return this; }
/** * Sets the top value for the request * * @param value the max number of items to return * @return the updated request */
Sets the top value for the request
top
{ "repo_name": "microsoftgraph/msgraph-sdk-java", "path": "src/main/java/com/microsoft/graph/requests/PrintJobCollectionRequest.java", "license": "mit", "size": 5705 }
[ "com.microsoft.graph.requests.PrintJobCollectionRequest" ]
import com.microsoft.graph.requests.PrintJobCollectionRequest;
import com.microsoft.graph.requests.*;
[ "com.microsoft.graph" ]
com.microsoft.graph;
737,800
protected static boolean renderAsFragment(FacesContext context) { String fragStr = (String) ((HttpServletRequest) context.getExternalContext().getRequest()).getAttribute("sakai.fragment"); return (fragStr != null && "true".equals(fragStr)); }
static boolean function(FacesContext context) { String fragStr = (String) ((HttpServletRequest) context.getExternalContext().getRequest()).getAttribute(STR); return (fragStr != null && "true".equals(fragStr)); }
/** Looks at Sakai-specific attributes to determine if the view should * render HTML, HEAD, BODY; if the request attribute "sakai.fragment"="true", * then don't render HTML, HEAD, BODY, etc. * @param context * @return */
Looks at Sakai-specific attributes to determine if the view should render HTML, HEAD, BODY; if the request attribute "sakai.fragment"="true", then don't render HTML, HEAD, BODY, etc
renderAsFragment
{ "repo_name": "ouit0408/sakai", "path": "jsf/jsf-widgets/src/java/org/sakaiproject/jsf/renderer/ViewRenderer.java", "license": "apache-2.0", "size": 5795 }
[ "javax.faces.context.FacesContext", "javax.servlet.http.HttpServletRequest" ]
import javax.faces.context.FacesContext; import javax.servlet.http.HttpServletRequest;
import javax.faces.context.*; import javax.servlet.http.*;
[ "javax.faces", "javax.servlet" ]
javax.faces; javax.servlet;
2,719,476
public OperationDisplay display() { return this.display; }
OperationDisplay function() { return this.display; }
/** * Get the display property: The object that represents the operation. * * @return the display value. */
Get the display property: The object that represents the operation
display
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/costmanagement/azure-resourcemanager-costmanagement/src/main/java/com/azure/resourcemanager/costmanagement/fluent/models/OperationInner.java", "license": "mit", "size": 1957 }
[ "com.azure.resourcemanager.costmanagement.models.OperationDisplay" ]
import com.azure.resourcemanager.costmanagement.models.OperationDisplay;
import com.azure.resourcemanager.costmanagement.models.*;
[ "com.azure.resourcemanager" ]
com.azure.resourcemanager;
2,313,075
private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); }
void function(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); }
/** * Util method to write an attribute with the ns prefix */
Util method to write an attribute with the ns prefix
writeAttribute
{ "repo_name": "jsdjayanga/wso2-axis2", "path": "modules/adb/src/org/apache/axis2/databinding/types/soapencoding/NonPositiveInteger.java", "license": "apache-2.0", "size": 21526 }
[ "javax.xml.stream.XMLStreamWriter" ]
import javax.xml.stream.XMLStreamWriter;
import javax.xml.stream.*;
[ "javax.xml" ]
javax.xml;
34,702
public void setTgtSequence(Item tgtSequence) { items.put("_tgtSequence", tgtSequence); }
void function(Item tgtSequence) { items.put(STR, tgtSequence); }
/** * Set tgtSequence item created for this record, should not be edited in handler. * @param tgtSequence the sequence item */
Set tgtSequence item created for this record, should not be edited in handler
setTgtSequence
{ "repo_name": "justincc/intermine", "path": "bio/core/main/src/org/intermine/bio/dataconversion/GFF3RecordHandler.java", "license": "lgpl-2.1", "size": 9843 }
[ "org.intermine.xml.full.Item" ]
import org.intermine.xml.full.Item;
import org.intermine.xml.full.*;
[ "org.intermine.xml" ]
org.intermine.xml;
1,762,756
public static Resources open(InputStream resource, int dpi) throws IOException { return new Resources(resource, dpi); }
static Resources function(InputStream resource, int dpi) throws IOException { return new Resources(resource, dpi); }
/** * Creates a resource object from the given input stream * * @param resource stream from which to read the resource * @param dpi the dpi used for the loaded images * @return a resource object * @throws java.io.IOException if opening/reading the resource fails */
Creates a resource object from the given input stream
open
{ "repo_name": "shannah/CodenameOne", "path": "CodenameOne/src/com/codename1/ui/util/Resources.java", "license": "gpl-2.0", "size": 64757 }
[ "java.io.IOException", "java.io.InputStream" ]
import java.io.IOException; import java.io.InputStream;
import java.io.*;
[ "java.io" ]
java.io;
1,641,627
boolean matchesClient(Client client);
boolean matchesClient(Client client);
/** * Verifies that the subscription is established with the designated client. */
Verifies that the subscription is established with the designated client
matchesClient
{ "repo_name": "masaki-yamakawa/geode", "path": "geode-apis-compatible-with-redis/src/main/java/org/apache/geode/redis/internal/pubsub/Subscription.java", "license": "apache-2.0", "size": 2092 }
[ "org.apache.geode.redis.internal.netty.Client" ]
import org.apache.geode.redis.internal.netty.Client;
import org.apache.geode.redis.internal.netty.*;
[ "org.apache.geode" ]
org.apache.geode;
2,858,840
public String nextLine () { if (!hasNext()) { throw new NoSuchElementException("No more lines"); } String currentLine = cachedLine; cachedLine = null; return currentLine; }
String function () { if (!hasNext()) { throw new NoSuchElementException(STR); } String currentLine = cachedLine; cachedLine = null; return currentLine; }
/** Returns the next line in the wrapped <code>Reader</code>. * * @return the next line from the input * @throws NoSuchElementException if there is no line to return */
Returns the next line in the wrapped <code>Reader</code>
nextLine
{ "repo_name": "trungnt13/fasta-game", "path": "TNTEngine/src/org/tntstudio/utils/io/LineIterator.java", "license": "mit", "size": 5268 }
[ "java.util.NoSuchElementException" ]
import java.util.NoSuchElementException;
import java.util.*;
[ "java.util" ]
java.util;
2,681,309
private void doOnlySubscriptionInserts(final String gitModulesFileContent, final Branch.NameKey mergedBranch, final List<SubmoduleSubscription> extractedSubscriptions) throws Exception { doOnlySubscriptionTableOperations(gitModulesFileContent, mergedBranch, extractedSubscriptions, new ArrayList<SubmoduleSubscription>()); } /** * It calls SubmoduleOp.update method considering scenario only updating * Subscriptions table. * <p> * In this test a commit is created and considered merged to * {@code mergedBranch} branch. * </p> * <p> * The destination project the commit was merged is not considered to be a * source of another project (no subscribers found to this project). * </p> * * @param gitModulesFileContent The .gitmodules file content. * @param mergedBranch The {@code Branch.NameKey} instance representing the * project/branch the commit was merged. * @param extractedSubscriptions The subscription rows extracted from * gitmodules file. * @param previousSubscriptions The subscription rows to be considering as * existing and pointing as target to the {@code mergedBranch}
void function(final String gitModulesFileContent, final Branch.NameKey mergedBranch, final List<SubmoduleSubscription> extractedSubscriptions) throws Exception { doOnlySubscriptionTableOperations(gitModulesFileContent, mergedBranch, extractedSubscriptions, new ArrayList<SubmoduleSubscription>()); } /** * It calls SubmoduleOp.update method considering scenario only updating * Subscriptions table. * <p> * In this test a commit is created and considered merged to * {@code mergedBranch} branch. * </p> * <p> * The destination project the commit was merged is not considered to be a * source of another project (no subscribers found to this project). * </p> * * @param gitModulesFileContent The .gitmodules file content. * @param mergedBranch The {@code Branch.NameKey} instance representing the * project/branch the commit was merged. * @param extractedSubscriptions The subscription rows extracted from * gitmodules file. * @param previousSubscriptions The subscription rows to be considering as * existing and pointing as target to the {@code mergedBranch}
/** * It calls SubmoduleOp.update method considering scenario only inserting new * subscriptions. * <p> * In this test a commit is created and considered merged to * {@code mergedBranch} branch. * </p> * <p> * The destination project the commit was merged is not considered to be a * source of another project (no subscribers found to this project). * </p> * * @param gitModulesFileContent The .gitmodules file content. * @param mergedBranch The {@code Branch.NameKey} instance representing the * project/branch the commit was merged. * @param extractedSubscriptions The subscription rows extracted from * gitmodules file. * @throws Exception If an exception occurs. */
It calls SubmoduleOp.update method considering scenario only inserting new subscriptions. In this test a commit is created and considered merged to mergedBranch branch. The destination project the commit was merged is not considered to be a source of another project (no subscribers found to this project).
doOnlySubscriptionInserts
{ "repo_name": "gcoders/gerrit", "path": "gerrit-server/src/test/java/com/google/gerrit/server/git/SubmoduleOpTest.java", "license": "apache-2.0", "size": 37202 }
[ "com.google.gerrit.reviewdb.client.Branch", "com.google.gerrit.reviewdb.client.SubmoduleSubscription", "java.util.ArrayList", "java.util.List" ]
import com.google.gerrit.reviewdb.client.Branch; import com.google.gerrit.reviewdb.client.SubmoduleSubscription; import java.util.ArrayList; import java.util.List;
import com.google.gerrit.reviewdb.client.*; import java.util.*;
[ "com.google.gerrit", "java.util" ]
com.google.gerrit; java.util;
2,022,746
protected void uninstallDefaults(JSeparator s) { shadow = null; highlight = null; }
void function(JSeparator s) { shadow = null; highlight = null; }
/** * This method removes the defaults that were given * by the Basic Look and Feel. * * @param s The JSeparator that is being uninstalled. */
This method removes the defaults that were given by the Basic Look and Feel
uninstallDefaults
{ "repo_name": "shaotuanchen/sunflower_exp", "path": "tools/source/gcc-4.2.4/libjava/classpath/javax/swing/plaf/basic/BasicSeparatorUI.java", "license": "bsd-3-clause", "size": 6916 }
[ "javax.swing.JSeparator" ]
import javax.swing.JSeparator;
import javax.swing.*;
[ "javax.swing" ]
javax.swing;
1,558,809
protected void endServerConnection() throws Exception { logger.log(Level.INFO,"Ending Server Connection"); // Stop if we already disconnected from the server if(!isConnected) return; waitingForLeaveAck = true; sendMessage(new PlayerLeaveMessage(engine.localPlayer.getPlayerID()), SERVER_CONNECTOR); // Make sure that we only wait at most 5 seconds long waitTime = System.currentTimeMillis() + WAIT_TIME; // Wait until we have logged out (received an ACK that it is ok to // to disconnect). while(waitingForLeaveAck) { Thread.yield(); // Stop attempting to connect if 10 seconds has past if(System.currentTimeMillis() > waitTime) { throw new Exception("Unable to contact to server!"); } } logger.log(Level.INFO,"Disconnected from Server"); }
void function() throws Exception { logger.log(Level.INFO,STR); if(!isConnected) return; waitingForLeaveAck = true; sendMessage(new PlayerLeaveMessage(engine.localPlayer.getPlayerID()), SERVER_CONNECTOR); long waitTime = System.currentTimeMillis() + WAIT_TIME; while(waitingForLeaveAck) { Thread.yield(); if(System.currentTimeMillis() > waitTime) { throw new Exception(STR); } } logger.log(Level.INFO,STR); }
/** * Ends the connection to the server. */
Ends the connection to the server
endServerConnection
{ "repo_name": "sphereority/sphereority", "path": "client/ClientExtaSysConnection.java", "license": "mit", "size": 16459 }
[ "java.util.logging.Level" ]
import java.util.logging.Level;
import java.util.logging.*;
[ "java.util" ]
java.util;
1,914,291
@Benchmark public void singleBucketIntoSingleMutableMonmorphicInvocation(Blackhole bh) { LongKeyedBucketOrds.FromSingle ords = new LongKeyedBucketOrds.FromSingle(bigArrays); for (long i = 0; i < LIMIT; i++) { if (i % 100_000 == 0) { ords.close(); bh.consume(ords); ords = new LongKeyedBucketOrds.FromSingle(bigArrays); } ords.add(0, i % DISTINCT_VALUES); } bh.consume(ords); ords.close(); } /** * Emulates a way that we do <strong>not</strong> use {@link LongKeyedBucketOrds}
void function(Blackhole bh) { LongKeyedBucketOrds.FromSingle ords = new LongKeyedBucketOrds.FromSingle(bigArrays); for (long i = 0; i < LIMIT; i++) { if (i % 100_000 == 0) { ords.close(); bh.consume(ords); ords = new LongKeyedBucketOrds.FromSingle(bigArrays); } ords.add(0, i % DISTINCT_VALUES); } bh.consume(ords); ords.close(); } /** * Emulates a way that we do <strong>not</strong> use {@link LongKeyedBucketOrds}
/** * Emulates the way that {@link AutoDateHistogramAggregationBuilder} uses {@link LongKeyedBucketOrds}. */
Emulates the way that <code>AutoDateHistogramAggregationBuilder</code> uses <code>LongKeyedBucketOrds</code>
singleBucketIntoSingleMutableMonmorphicInvocation
{ "repo_name": "nknize/elasticsearch", "path": "benchmarks/src/main/java/org/elasticsearch/benchmark/search/aggregations/bucket/terms/LongKeyedBucketOrdsBenchmark.java", "license": "apache-2.0", "size": 6597 }
[ "org.elasticsearch.search.aggregations.bucket.terms.LongKeyedBucketOrds", "org.openjdk.jmh.infra.Blackhole" ]
import org.elasticsearch.search.aggregations.bucket.terms.LongKeyedBucketOrds; import org.openjdk.jmh.infra.Blackhole;
import org.elasticsearch.search.aggregations.bucket.terms.*; import org.openjdk.jmh.infra.*;
[ "org.elasticsearch.search", "org.openjdk.jmh" ]
org.elasticsearch.search; org.openjdk.jmh;
2,866,360
public ReportSynthesisSrfProgressTargetCases saveReportSynthesisSrfProgressTargetCases( ReportSynthesisSrfProgressTargetCases reportSynthesisSrfProgressTargetCases);
ReportSynthesisSrfProgressTargetCases function( ReportSynthesisSrfProgressTargetCases reportSynthesisSrfProgressTargetCases);
/** * This method saves the information of the given reportSynthesisSrfProgressTargetCases * * @param reportSynthesisSrfProgressTargetCases - is the reportSynthesisSrfProgressTargetCases object with the new * information to be added/updated. * @return a number greater than 0 representing the new ID assigned by the database, 0 if the * reportSynthesisSrfProgressTargetCases was * updated * or -1 is some error occurred. */
This method saves the information of the given reportSynthesisSrfProgressTargetCases
saveReportSynthesisSrfProgressTargetCases
{ "repo_name": "CCAFS/MARLO", "path": "marlo-data/src/main/java/org/cgiar/ccafs/marlo/data/manager/ReportSynthesisSrfProgressTargetCasesManager.java", "license": "gpl-3.0", "size": 3820 }
[ "org.cgiar.ccafs.marlo.data.model.ReportSynthesisSrfProgressTargetCases" ]
import org.cgiar.ccafs.marlo.data.model.ReportSynthesisSrfProgressTargetCases;
import org.cgiar.ccafs.marlo.data.model.*;
[ "org.cgiar.ccafs" ]
org.cgiar.ccafs;
864,070
public void enableAntiSamy(CmsObject cms, String policyPath, Set<String> params) { m_antiSamy = createAntiSamy(cms, policyPath); m_cleanHtml = params; }
void function(CmsObject cms, String policyPath, Set<String> params) { m_antiSamy = createAntiSamy(cms, policyPath); m_cleanHtml = params; }
/** * Enables the AntiSamy HTML cleaning for some parameters.<p> * * @param cms the current CMS context * @param policyPath the policy site path in the VFS * @param params the parameters for which HTML cleaning should be enabled */
Enables the AntiSamy HTML cleaning for some parameters
enableAntiSamy
{ "repo_name": "it-tavis/opencms-core", "path": "src/org/opencms/util/CmsParameterEscaper.java", "license": "lgpl-2.1", "size": 9014 }
[ "java.util.Set", "org.opencms.file.CmsObject" ]
import java.util.Set; import org.opencms.file.CmsObject;
import java.util.*; import org.opencms.file.*;
[ "java.util", "org.opencms.file" ]
java.util; org.opencms.file;
2,755,922
public static int getSecLevel(String level) { switch (level) { case "noAuthNoPriv": return SecurityLevel.NOAUTH_NOPRIV; case "authNoPriv": return SecurityLevel.AUTH_NOPRIV; case "authPriv": default: return SecurityLevel.AUTH_PRIV; } }
static int function(String level) { switch (level) { case STR: return SecurityLevel.NOAUTH_NOPRIV; case STR: return SecurityLevel.AUTH_NOPRIV; case STR: default: return SecurityLevel.AUTH_PRIV; } }
/** * Method to get security level from string representation of level * @param level level * @return security level as integer */
Method to get security level from string representation of level
getSecLevel
{ "repo_name": "WilliamNouet/nifi", "path": "nifi-nar-bundles/nifi-snmp-bundle/nifi-snmp-processors/src/main/java/org/apache/nifi/snmp/processors/SNMPUtils.java", "license": "apache-2.0", "size": 10665 }
[ "org.snmp4j.security.SecurityLevel" ]
import org.snmp4j.security.SecurityLevel;
import org.snmp4j.security.*;
[ "org.snmp4j.security" ]
org.snmp4j.security;
387,924
protected void handleGenericBridges(BridgeContext ctx, Element e) { for (Node n = e.getFirstChild(); n != null; n = n.getNextSibling()) { if (n instanceof Element) { Element e2 = (Element) n; Bridge b = ctx.getBridge(e2); if (b instanceof GenericBridge) { ((GenericBridge) b).handleElement(ctx, e2); } handleGenericBridges(ctx, e2); } } }
void function(BridgeContext ctx, Element e) { for (Node n = e.getFirstChild(); n != null; n = n.getNextSibling()) { if (n instanceof Element) { Element e2 = (Element) n; Bridge b = ctx.getBridge(e2); if (b instanceof GenericBridge) { ((GenericBridge) b).handleElement(ctx, e2); } handleGenericBridges(ctx, e2); } } }
/** * Handles any GenericBridge elements which are children of the * specified element. * @param ctx the bridge context * @param e the element whose child elements should be handled */
Handles any GenericBridge elements which are children of the specified element
handleGenericBridges
{ "repo_name": "Squeegee/batik", "path": "sources/org/apache/batik/bridge/GVTBuilder.java", "license": "apache-2.0", "size": 9872 }
[ "org.w3c.dom.Element", "org.w3c.dom.Node" ]
import org.w3c.dom.Element; import org.w3c.dom.Node;
import org.w3c.dom.*;
[ "org.w3c.dom" ]
org.w3c.dom;
610,005
private boolean isAvailable(SctStudent student, SctEnrollment enrollment, Map<Long, Double> limits) { for (Lecture lecture: enrollment.getLectures()) if (getEnrollment(lecture, limits) > getLimit(lecture)) return false; return true; }
boolean function(SctStudent student, SctEnrollment enrollment, Map<Long, Double> limits) { for (Lecture lecture: enrollment.getLectures()) if (getEnrollment(lecture, limits) > getLimit(lecture)) return false; return true; }
/** * Check if all classes of the given enrollment are available (the limit is not breached) */
Check if all classes of the given enrollment are available (the limit is not breached)
isAvailable
{ "repo_name": "UniTime/cpsolver", "path": "src/org/cpsolver/coursett/sectioning/SctModel.java", "license": "lgpl-3.0", "size": 33093 }
[ "java.util.Map", "org.cpsolver.coursett.model.Lecture" ]
import java.util.Map; import org.cpsolver.coursett.model.Lecture;
import java.util.*; import org.cpsolver.coursett.model.*;
[ "java.util", "org.cpsolver.coursett" ]
java.util; org.cpsolver.coursett;
2,081,103
public JobScheduleInner withRunbook(RunbookAssociationProperty runbook) { this.runbook = runbook; return this; }
JobScheduleInner function(RunbookAssociationProperty runbook) { this.runbook = runbook; return this; }
/** * Set gets or sets the runbook. * * @param runbook the runbook value to set * @return the JobScheduleInner object itself. */
Set gets or sets the runbook
withRunbook
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/automation/mgmt-v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/JobScheduleInner.java", "license": "mit", "size": 4905 }
[ "com.microsoft.azure.management.automation.v2015_10_31.RunbookAssociationProperty" ]
import com.microsoft.azure.management.automation.v2015_10_31.RunbookAssociationProperty;
import com.microsoft.azure.management.automation.v2015_10_31.*;
[ "com.microsoft.azure" ]
com.microsoft.azure;
2,267,432
public void doPost(RunData rundata, Context context) { postOrSaveDraft(rundata, context, true); } // doPost
void function(RunData rundata, Context context) { postOrSaveDraft(rundata, context, true); }
/** * Action is to use when doPost requested, corresponding to chef_announcements-revise or -preview "eventSubmit_doPost" */
Action is to use when doPost requested, corresponding to chef_announcements-revise or -preview "eventSubmit_doPost"
doPost
{ "repo_name": "ouit0408/sakai", "path": "announcement/announcement-tool/tool/src/java/org/sakaiproject/announcement/tool/AnnouncementAction.java", "license": "apache-2.0", "size": 173337 }
[ "org.sakaiproject.cheftool.Context", "org.sakaiproject.cheftool.RunData" ]
import org.sakaiproject.cheftool.Context; import org.sakaiproject.cheftool.RunData;
import org.sakaiproject.cheftool.*;
[ "org.sakaiproject.cheftool" ]
org.sakaiproject.cheftool;
1,241,877
public JCheckBox makeCheckBox(String label, Properties.Keys propKey, String prefNode, boolean defaultValue) { class checkBoxListener implements ItemListener { final JCheckBox jc_; final Properties.Keys propKey_; final String prefNode_; public checkBoxListener(JCheckBox jc, Properties.Keys propKey, String prefNode) { jc_ = jc; propKey_ = propKey; prefNode_ = prefNode; }
JCheckBox function(String label, Properties.Keys propKey, String prefNode, boolean defaultValue) { class checkBoxListener implements ItemListener { final JCheckBox jc_; final Properties.Keys propKey_; final String prefNode_; public checkBoxListener(JCheckBox jc, Properties.Keys propKey, String prefNode) { jc_ = jc; propKey_ = propKey; prefNode_ = prefNode; }
/** * Constructs JCheckBox with boolean preference store. * The boolean value is read using prefs_.getBoolean(), NOT props_.get... * Stored in the prefNode indicated, usually the panel name. * @param label the GUI label * @param propKey (needed for read/write to preferences now that preferences is based on properties) * @param prefNode * @param defaultValue * @return constructed JCheckBox */
Constructs JCheckBox with boolean preference store. The boolean value is read using prefs_.getBoolean(), NOT props_.get... Stored in the prefNode indicated, usually the panel name
makeCheckBox
{ "repo_name": "kmdouglass/Micro-Manager", "path": "plugins/ASIdiSPIM/src/org/micromanager/asidispim/Utils/PanelUtils.java", "license": "mit", "size": 36214 }
[ "java.awt.event.ItemListener", "javax.swing.JCheckBox", "org.micromanager.asidispim.Data" ]
import java.awt.event.ItemListener; import javax.swing.JCheckBox; import org.micromanager.asidispim.Data;
import java.awt.event.*; import javax.swing.*; import org.micromanager.asidispim.*;
[ "java.awt", "javax.swing", "org.micromanager.asidispim" ]
java.awt; javax.swing; org.micromanager.asidispim;
921,284
public final static Function<Double, Double> divideBy(short divisor, MathContext mathContext) { return divideBy(Short.valueOf(divisor), mathContext); }
final static Function<Double, Double> function(short divisor, MathContext mathContext) { return divideBy(Short.valueOf(divisor), mathContext); }
/** * <p> * It divides the target element by the given divisor and returns its result with the * precision and rounding mode specified by mathContext * </p> * * @param divisor the divisor * @param mathContext the {@link MathContext} to define {@link RoundingMode} and precision * @return the result of target/divisor */
It divides the target element by the given divisor and returns its result with the precision and rounding mode specified by mathContext
divideBy
{ "repo_name": "op4j/op4j", "path": "src/main/java/org/op4j/functions/FnDouble.java", "license": "apache-2.0", "size": 111187 }
[ "java.math.MathContext" ]
import java.math.MathContext;
import java.math.*;
[ "java.math" ]
java.math;
200,280
public void setOpDate(Date opDate) { this.opDate = opDate; }
void function(Date opDate) { this.opDate = opDate; }
/** * This method was generated by MyBatis Generator. * This method sets the value of the database column PTOPLOG.OP_DATE * * @param opDate the value for PTOPLOG.OP_DATE * * @mbggenerated Tue Jan 12 13:20:41 CST 2016 */
This method was generated by MyBatis Generator. This method sets the value of the database column PTOPLOG.OP_DATE
setOpDate
{ "repo_name": "rongshang/fbi-cbs2", "path": "common/main/java/skyline/repository/model/Ptoplog.java", "license": "unlicense", "size": 15406 }
[ "java.util.Date" ]
import java.util.Date;
import java.util.*;
[ "java.util" ]
java.util;
2,519,172
@Test public void testNofity_To_Decrease_provider() { RegistryDirectory registryDirectory = getRegistryDirectory(); invocation = new RpcInvocation(); List<URL> durls = new ArrayList<URL>(); durls.add(SERVICEURL.setHost("10.20.30.140")); durls.add(SERVICEURL.setHost("10.20.30.141")); registryDirectory.notify(durls); List<Invoker<?>> invokers = registryDirectory.list(invocation); Assertions.assertEquals(2, invokers.size()); durls = new ArrayList<URL>(); durls.add(SERVICEURL.setHost("10.20.30.140")); registryDirectory.notify(durls); List<Invoker<?>> invokers2 = registryDirectory.list(invocation); Assertions.assertEquals(1, invokers2.size()); Assertions.assertEquals("10.20.30.140", invokers2.get(0).getUrl().getHost()); durls = new ArrayList<URL>(); durls.add(URL.valueOf("empty://0.0.0.0?" + DISABLED_KEY + "=true&" + CATEGORY_KEY + "=" + CONFIGURATORS_CATEGORY)); registryDirectory.notify(durls); List<Invoker<?>> invokers3 = registryDirectory.list(invocation); Assertions.assertEquals(1, invokers3.size()); }
void function() { RegistryDirectory registryDirectory = getRegistryDirectory(); invocation = new RpcInvocation(); List<URL> durls = new ArrayList<URL>(); durls.add(SERVICEURL.setHost(STR)); durls.add(SERVICEURL.setHost(STR)); registryDirectory.notify(durls); List<Invoker<?>> invokers = registryDirectory.list(invocation); Assertions.assertEquals(2, invokers.size()); durls = new ArrayList<URL>(); durls.add(SERVICEURL.setHost(STR)); registryDirectory.notify(durls); List<Invoker<?>> invokers2 = registryDirectory.list(invocation); Assertions.assertEquals(1, invokers2.size()); Assertions.assertEquals(STR, invokers2.get(0).getUrl().getHost()); durls = new ArrayList<URL>(); durls.add(URL.valueOf("empty: registryDirectory.notify(durls); List<Invoker<?>> invokers3 = registryDirectory.list(invocation); Assertions.assertEquals(1, invokers3.size()); }
/** * Test override disables a specified service provider through enable=false * It is expected that a specified service provider can be disable. */
Test override disables a specified service provider through enable=false It is expected that a specified service provider can be disable
testNofity_To_Decrease_provider
{ "repo_name": "aglne/dubbo", "path": "dubbo-registry/dubbo-registry-default/src/test/java/org/apache/dubbo/registry/dubbo/RegistryDirectoryTest.java", "license": "apache-2.0", "size": 50474 }
[ "java.util.ArrayList", "java.util.List", "org.apache.dubbo.common.URL", "org.apache.dubbo.registry.integration.RegistryDirectory", "org.apache.dubbo.rpc.Invoker", "org.apache.dubbo.rpc.RpcInvocation", "org.junit.jupiter.api.Assertions" ]
import java.util.ArrayList; import java.util.List; import org.apache.dubbo.common.URL; import org.apache.dubbo.registry.integration.RegistryDirectory; import org.apache.dubbo.rpc.Invoker; import org.apache.dubbo.rpc.RpcInvocation; import org.junit.jupiter.api.Assertions;
import java.util.*; import org.apache.dubbo.common.*; import org.apache.dubbo.registry.integration.*; import org.apache.dubbo.rpc.*; import org.junit.jupiter.api.*;
[ "java.util", "org.apache.dubbo", "org.junit.jupiter" ]
java.util; org.apache.dubbo; org.junit.jupiter;
1,990,741
public void setClassLoaderWeakRef(WeakReference<ClassLoader> classLoader) { if (classLoader == null) return; appClassLoaderWeakRef = classLoader; String classLoaderString = (classLoader.get() == null) ? null : classLoader.get().toString(); appClassLoaderRecordedValue = classLoaderString; }
void function(WeakReference<ClassLoader> classLoader) { if (classLoader == null) return; appClassLoaderWeakRef = classLoader; String classLoaderString = (classLoader.get() == null) ? null : classLoader.get().toString(); appClassLoaderRecordedValue = classLoaderString; }
/** * Set a weakly referenced ClassLoader to this class * * @param classLoader * weakly referenced ClassLoader */
Set a weakly referenced ClassLoader to this class
setClassLoaderWeakRef
{ "repo_name": "OpenLiberty/open-liberty", "path": "dev/com.ibm.ws.microprofile.metrics_fat/test-applications/classloaderUtil/src/com/ibm/ws/microprofile/metrics/classloader/utility/ClassLoaderUtils.java", "license": "epl-1.0", "size": 5055 }
[ "java.lang.ref.WeakReference" ]
import java.lang.ref.WeakReference;
import java.lang.ref.*;
[ "java.lang" ]
java.lang;
757,785
public void calculatePaymentRequest(PaymentRequestDocument pr, boolean updateDiscount);
void function(PaymentRequestDocument pr, boolean updateDiscount);
/** * Recalculate the payment request. * * @param pr The payment request document to be calculated. * @param updateDiscount boolean true if we also want to calculate the discount items for the payment request. */
Recalculate the payment request
calculatePaymentRequest
{ "repo_name": "quikkian-ua-devops/will-financials", "path": "kfs-purap/src/main/java/org/kuali/kfs/module/purap/document/service/PaymentRequestService.java", "license": "agpl-3.0", "size": 19090 }
[ "org.kuali.kfs.module.purap.document.PaymentRequestDocument" ]
import org.kuali.kfs.module.purap.document.PaymentRequestDocument;
import org.kuali.kfs.module.purap.document.*;
[ "org.kuali.kfs" ]
org.kuali.kfs;
1,162,657