method
stringlengths 13
441k
| clean_method
stringlengths 7
313k
| doc
stringlengths 17
17.3k
| comment
stringlengths 3
1.42k
| method_name
stringlengths 1
273
| extra
dict | imports
sequence | imports_info
stringlengths 19
34.8k
| cluster_imports_info
stringlengths 15
3.66k
| libraries
sequence | libraries_info
stringlengths 6
661
| id
int64 0
2.92M
|
---|---|---|---|---|---|---|---|---|---|---|---|
public ApplicationBase withKnownClientApplications(List<String> knownClientApplications) {
this.knownClientApplications = knownClientApplications;
return this;
} | ApplicationBase function(List<String> knownClientApplications) { this.knownClientApplications = knownClientApplications; return this; } | /**
* Set the knownClientApplications property: Client applications that are tied to this resource application. Consent
* to any of the known client applications will result in implicit consent to the resource application through a
* combined consent dialog (showing the OAuth permission scopes required by the client and the resource).
*
* @param knownClientApplications the knownClientApplications value to set.
* @return the ApplicationBase object itself.
*/ | Set the knownClientApplications property: Client applications that are tied to this resource application. Consent to any of the known client applications will result in implicit consent to the resource application through a combined consent dialog (showing the OAuth permission scopes required by the client and the resource) | withKnownClientApplications | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/resourcemanagerhybrid/azure-resourcemanager-authorization/src/main/java/com/azure/resourcemanager/authorization/models/ApplicationBase.java",
"license": "mit",
"size": 29392
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 934,322 |
static Deferred<byte[]> rowKeyTemplateAsync(final TSDB tsdb,
final String metric,
final Map<String, String> tags) {
final short metric_width = tsdb.metrics.width();
final short tag_name_width = tsdb.tag_names.width();
final short tag_value_width = tsdb.tag_values.width();
final short num_tags = (short) tags.size();
int row_size = (metric_width + Const.TIMESTAMP_BYTES
+ tag_name_width * num_tags
+ tag_value_width * num_tags);
final byte[] row = new byte[row_size];
// Lookup or create the metric ID.
final Deferred<byte[]> metric_id;
if (tsdb.config.auto_metric()) {
metric_id = tsdb.metrics.getOrCreateIdAsync(metric);
} else {
metric_id = tsdb.metrics.getIdAsync(metric);
} | static Deferred<byte[]> rowKeyTemplateAsync(final TSDB tsdb, final String metric, final Map<String, String> tags) { final short metric_width = tsdb.metrics.width(); final short tag_name_width = tsdb.tag_names.width(); final short tag_value_width = tsdb.tag_values.width(); final short num_tags = (short) tags.size(); int row_size = (metric_width + Const.TIMESTAMP_BYTES + tag_name_width * num_tags + tag_value_width * num_tags); final byte[] row = new byte[row_size]; final Deferred<byte[]> metric_id; if (tsdb.config.auto_metric()) { metric_id = tsdb.metrics.getOrCreateIdAsync(metric); } else { metric_id = tsdb.metrics.getIdAsync(metric); } | /**
* Returns a partially initialized row key for this metric and these tags.
* The only thing left to fill in is the base timestamp.
* @since 2.0
*/ | Returns a partially initialized row key for this metric and these tags. The only thing left to fill in is the base timestamp | rowKeyTemplateAsync | {
"repo_name": "pepperdata/opentsdb",
"path": "opentsdb-core/src/main/java/net/opentsdb/core/IncomingDataPoints.java",
"license": "lgpl-2.1",
"size": 19367
} | [
"com.stumbleupon.async.Deferred",
"java.util.Map"
] | import com.stumbleupon.async.Deferred; import java.util.Map; | import com.stumbleupon.async.*; import java.util.*; | [
"com.stumbleupon.async",
"java.util"
] | com.stumbleupon.async; java.util; | 248,035 |
public void validateVarId(long arc, Object userData)
throws SnmpStatusException {
if (isVariable(arc) == false) throw noSuchNameException;
} | void function(long arc, Object userData) throws SnmpStatusException { if (isVariable(arc) == false) throw noSuchNameException; } | /**
* Checks whether the given OID arc identifies a variable (columnar
* object).
*
* @param userData A contextual object containing user-data.
* This object is allocated through the <code>
* {@link com.sun.jmx.snmp.agent.SnmpUserDataFactory}</code>
* for each incoming SNMP request.
*
* @exception If the given `arc' does not identify any variable in this
* group, throws an SnmpStatusException.
*/ | Checks whether the given OID arc identifies a variable (columnar object) | validateVarId | {
"repo_name": "rokn/Count_Words_2015",
"path": "testing/openjdk/jdk/src/share/classes/com/sun/jmx/snmp/agent/SnmpMibEntry.java",
"license": "mit",
"size": 7402
} | [
"com.sun.jmx.snmp.SnmpStatusException"
] | import com.sun.jmx.snmp.SnmpStatusException; | import com.sun.jmx.snmp.*; | [
"com.sun.jmx"
] | com.sun.jmx; | 1,592,193 |
@Nullable
FluidStack getOutput1(); | FluidStack getOutput1(); | /**
* The result of this recipe Note: this will return a COPY of the output not the original instance of the output
*
* @return The output of the recipe
*/ | The result of this recipe Note: this will return a COPY of the output not the original instance of the output | getOutput1 | {
"repo_name": "Magneticraft-Team/Magneticraft",
"path": "src/main/kotlin/com/cout970/magneticraft/api/registries/machines/refinery/IRefineryRecipe.java",
"license": "gpl-2.0",
"size": 1530
} | [
"net.minecraftforge.fluids.FluidStack"
] | import net.minecraftforge.fluids.FluidStack; | import net.minecraftforge.fluids.*; | [
"net.minecraftforge.fluids"
] | net.minecraftforge.fluids; | 1,565,129 |
public static boolean isJavaVendor(String vendor) {
String javaVendor = System.getProperty("java.vendor").toLowerCase(Locale.US);
return javaVendor.indexOf(vendor.toLowerCase(Locale.US)) > -1;
} | static boolean function(String vendor) { String javaVendor = System.getProperty(STR).toLowerCase(Locale.US); return javaVendor.indexOf(vendor.toLowerCase(Locale.US)) > -1; } | /**
* Is this Java by the given vendor.
* <p/>
* Uses <tt>java.vendor</tt> from the system properties to determine the vendor.
*
* @param vendor such as IBM
* @return <tt>true</tt> if its that vendor.
*/ | Is this Java by the given vendor. Uses java.vendor from the system properties to determine the vendor | isJavaVendor | {
"repo_name": "aaronwalker/camel",
"path": "components/camel-test/src/main/java/org/apache/camel/test/junit4/TestSupport.java",
"license": "apache-2.0",
"size": 18905
} | [
"java.util.Locale"
] | import java.util.Locale; | import java.util.*; | [
"java.util"
] | java.util; | 157,716 |
public Collection<Set<Pair<State, String>>> extendTs(TransitionSystem ts, int maxPhase2Rounds) throws
NoFiniteExtensionPossibleException, NonDeterministicException, MustLeadToSameStateException {
new Deterministic(ts).throwIfNonDeterministic();
int rounds = 0;
int phase2Ctr = 0;
Collection<Set<Pair<State, String>>> eqRel;
while (true) { // we need to exit the loop in the middle of its body :-(
debugFormat("Starting round %d", rounds++);
eqRel = findNeededArcs(ts.getNodes());
if (eqRel.isEmpty()) {
break;
}
Pair<Collection<Set<Pair<State, String>>>, Boolean> phase1Pair = completeDiamonds(ts, eqRel);
if (phase1Pair.getSecond()) {
// arcs got added, reanalyse the transition system
continue;
}
eqRel = phase1Pair.getFirst();
phase2Ctr++;
if (eqRel.isEmpty() || phase2Ctr > maxPhase2Rounds) {
break;
}
Map<State, Set<String>> uncompletableStates = checkFiniteCompletionPossible(ts);
for (Set<Pair<State, String>> arcSet : eqRel) {
for (Pair<State, String> neededArc : arcSet) {
if (uncompletableStates.containsKey(neededArc.getFirst())
&& uncompletableStates.get(neededArc.getFirst())
.contains(neededArc.getSecond()))
throw new NoFiniteExtensionPossibleException(neededArc.getFirst());
}
}
constructDiamonds(ts, eqRel);
}
return eqRel;
} | Collection<Set<Pair<State, String>>> function(TransitionSystem ts, int maxPhase2Rounds) throws NoFiniteExtensionPossibleException, NonDeterministicException, MustLeadToSameStateException { new Deterministic(ts).throwIfNonDeterministic(); int rounds = 0; int phase2Ctr = 0; Collection<Set<Pair<State, String>>> eqRel; while (true) { debugFormat(STR, rounds++); eqRel = findNeededArcs(ts.getNodes()); if (eqRel.isEmpty()) { break; } Pair<Collection<Set<Pair<State, String>>>, Boolean> phase1Pair = completeDiamonds(ts, eqRel); if (phase1Pair.getSecond()) { continue; } eqRel = phase1Pair.getFirst(); phase2Ctr++; if (eqRel.isEmpty() phase2Ctr > maxPhase2Rounds) { break; } Map<State, Set<String>> uncompletableStates = checkFiniteCompletionPossible(ts); for (Set<Pair<State, String>> arcSet : eqRel) { for (Pair<State, String> neededArc : arcSet) { if (uncompletableStates.containsKey(neededArc.getFirst()) && uncompletableStates.get(neededArc.getFirst()) .contains(neededArc.getSecond())) throw new NoFiniteExtensionPossibleException(neededArc.getFirst()); } } constructDiamonds(ts, eqRel); } return eqRel; } | /**
* Extend a transition system to a deterministic persistent transition system.
* @param ts The transition system to extend
*
* @param maxPhase2Rounds How many rounds which add new states should maximally be done?
* @return Collection of equivalence classes of needed but not added arcs (arcs are equivalent if they must lead
* to the same state). This is empty if maxPhase2Rounds is sufficently high.
* @throws NoFiniteExtensionPossibleException Thrown if the algorithm would lead to the addition of infinitely
* many states.
* @throws NonDeterministicException Thrown the given transition system is not deterministic.
* @throws MustLeadToSameStateException Thrown if a persistence diamond can't get constructed because of already
* existing arcs (i.e. the transition system or a partially extended version of it isn't fully deterministic)
*/ | Extend a transition system to a deterministic persistent transition system | extendTs | {
"repo_name": "CvO-Theory/apt",
"path": "src/module/uniol/apt/analysis/lts/extension/ExtendDeterministicPersistent.java",
"license": "gpl-2.0",
"size": 10456
} | [
"java.util.Collection",
"java.util.Map",
"java.util.Set"
] | import java.util.Collection; import java.util.Map; import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 2,042,313 |
private void stopLoading() {
mProgressBar.setVisibility(View.GONE);
} | void function() { mProgressBar.setVisibility(View.GONE); } | /**
* Stops the loader.
*/ | Stops the loader | stopLoading | {
"repo_name": "mobgen/halo-android",
"path": "sdk-samples/halo-demo/src/main/java/com/mobgen/halo/android/app/ui/storelocator/StoreLocatorActivity.java",
"license": "apache-2.0",
"size": 15088
} | [
"android.view.View"
] | import android.view.View; | import android.view.*; | [
"android.view"
] | android.view; | 2,017,623 |
public List<IPCrossCutting> getIPCrossCuttingByActivityID(int activityID); | List<IPCrossCutting> function(int activityID); | /**
* This method gets all the information of IP Cross Cutting Themes related with a given activity ID
*
* @param activityID - is the activity identifier.
* @return a List with the information of IP Cross Cutting Themes related with the activity
*/ | This method gets all the information of IP Cross Cutting Themes related with a given activity ID | getIPCrossCuttingByActivityID | {
"repo_name": "CCAFS/ccafs-ap",
"path": "impactPathways/src/main/java/org/cgiar/ccafs/ap/data/manager/IPCrossCuttingManager.java",
"license": "gpl-3.0",
"size": 3169
} | [
"java.util.List",
"org.cgiar.ccafs.ap.data.model.IPCrossCutting"
] | import java.util.List; import org.cgiar.ccafs.ap.data.model.IPCrossCutting; | import java.util.*; import org.cgiar.ccafs.ap.data.model.*; | [
"java.util",
"org.cgiar.ccafs"
] | java.util; org.cgiar.ccafs; | 439,282 |
private float calculateTranslationScore(List<Integer> sourceWidList,
List<Integer> targetWidList, TranslationModel translationModel) {
assert targetWidList.size() > 0;
float score = -(float)Math.log(1.0 / sourceWidList.size()) *
targetWidList.size();
for (Integer targetWid : targetWidList) {
float translationProbability = 0.0f;
if (targetWid != null) {
for (Integer sourceWid : sourceWidList) {
if (sourceWid != null) {
SourceData sourceData = translationModel.get(sourceWid);
translationProbability +=
sourceData.getTranslationProbability(targetWid);
}
}
}
translationProbability = Math.max(translationProbability,
MINIMUM_TRANSLATION_PROBABILITY);
score += -(float)Math.log(translationProbability);
}
return score;
}
| float function(List<Integer> sourceWidList, List<Integer> targetWidList, TranslationModel translationModel) { assert targetWidList.size() > 0; float score = -(float)Math.log(1.0 / sourceWidList.size()) * targetWidList.size(); for (Integer targetWid : targetWidList) { float translationProbability = 0.0f; if (targetWid != null) { for (Integer sourceWid : sourceWidList) { if (sourceWid != null) { SourceData sourceData = translationModel.get(sourceWid); translationProbability += sourceData.getTranslationProbability(targetWid); } } } translationProbability = Math.max(translationProbability, MINIMUM_TRANSLATION_PROBABILITY); score += -(float)Math.log(translationProbability); } return score; } | /**
* Calculates probability (converted to score equal to -ln(probability))
* of given target segments (represented as word id list) being a
* translation of given source segments according to given translation
* model.
* Cannot return probability less than constant
* {@link #MINIMUM_TRANSLATION_PROBABILITY}.
*
* @param sourceWidList
* @param targetWidList
* @param translationModel
* @return
*/ | Calculates probability (converted to score equal to -ln(probability)) of given target segments (represented as word id list) being a translation of given source segments according to given translation model. Cannot return probability less than constant <code>#MINIMUM_TRANSLATION_PROBABILITY</code> | calculateTranslationScore | {
"repo_name": "loomchild/maligna",
"path": "maligna/src/main/java/net/loomchild/maligna/calculator/content/TranslationCalculator.java",
"license": "mit",
"size": 9793
} | [
"java.util.List",
"net.loomchild.maligna.model.translation.SourceData",
"net.loomchild.maligna.model.translation.TranslationModel"
] | import java.util.List; import net.loomchild.maligna.model.translation.SourceData; import net.loomchild.maligna.model.translation.TranslationModel; | import java.util.*; import net.loomchild.maligna.model.translation.*; | [
"java.util",
"net.loomchild.maligna"
] | java.util; net.loomchild.maligna; | 670,210 |
public static void initInternetExplorerDriver() {
ReporterNGExt.logTechnical("Initialization Internet Explorer Driver");
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setPlatform(Platform.WINDOWS);
capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
capabilities.setCapability(CapabilityType.HAS_NATIVE_EVENTS, true);
capabilities.setJavascriptEnabled(true);
capabilities.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true);
capabilities.setCapability(InternetExplorerDriver.IGNORE_ZOOM_SETTING, true);
capabilities.setCapability(InternetExplorerDriver.IE_ENSURE_CLEAN_SESSION, true);
setWebDriver(new InternetExplorerDriver(capabilities));
setTimeout(TIMEOUT);
getDriver().manage().window().maximize();
}
| static void function() { ReporterNGExt.logTechnical(STR); DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setPlatform(Platform.WINDOWS); capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true); capabilities.setCapability(CapabilityType.HAS_NATIVE_EVENTS, true); capabilities.setJavascriptEnabled(true); capabilities.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true); capabilities.setCapability(InternetExplorerDriver.IGNORE_ZOOM_SETTING, true); capabilities.setCapability(InternetExplorerDriver.IE_ENSURE_CLEAN_SESSION, true); setWebDriver(new InternetExplorerDriver(capabilities)); setTimeout(TIMEOUT); getDriver().manage().window().maximize(); } | /**
* initialization InternetExplorerDriver
*/ | initialization InternetExplorerDriver | initInternetExplorerDriver | {
"repo_name": "ggasoftware/gga-selenium-framework",
"path": "gga-selenium-framework-core/src/main/java/com/ggasoftware/uitest/utils/WebDriverWrapper.java",
"license": "gpl-3.0",
"size": 40067
} | [
"org.openqa.selenium.ie.InternetExplorerDriver",
"org.openqa.selenium.remote.CapabilityType",
"org.openqa.selenium.remote.DesiredCapabilities"
] | import org.openqa.selenium.ie.InternetExplorerDriver; import org.openqa.selenium.remote.CapabilityType; import org.openqa.selenium.remote.DesiredCapabilities; | import org.openqa.selenium.ie.*; import org.openqa.selenium.remote.*; | [
"org.openqa.selenium"
] | org.openqa.selenium; | 2,173,756 |
public static java.util.List extractElectrotherapyPneumaticList(ims.domain.ILightweightDomainFactory domainFactory, ims.therapies.vo.ElectrotherapyPneumaticVoCollection voCollection)
{
return extractElectrotherapyPneumaticList(domainFactory, voCollection, null, new HashMap());
}
| static java.util.List function(ims.domain.ILightweightDomainFactory domainFactory, ims.therapies.vo.ElectrotherapyPneumaticVoCollection voCollection) { return extractElectrotherapyPneumaticList(domainFactory, voCollection, null, new HashMap()); } | /**
* Create the ims.therapies.treatment.domain.objects.ElectrotherapyPneumatic list from the value object collection.
* @param domainFactory - used to create existing (persistent) domain objects.
* @param voCollection - the collection of value objects
*/ | Create the ims.therapies.treatment.domain.objects.ElectrotherapyPneumatic list from the value object collection | extractElectrotherapyPneumaticList | {
"repo_name": "FreudianNM/openMAXIMS",
"path": "Source Library/openmaxims_workspace/ValueObjects/src/ims/therapies/vo/domain/ElectrotherapyPneumaticVoAssembler.java",
"license": "agpl-3.0",
"size": 22080
} | [
"java.util.HashMap"
] | import java.util.HashMap; | import java.util.*; | [
"java.util"
] | java.util; | 1,699,927 |
public String getInfoUrl(String name)
{
return getPageUrl(NameHelper.globaliseName(name, localSpace),
WikiPageAction.INFO_ACTION.getName());
} | String function(String name) { return getPageUrl(NameHelper.globaliseName(name, localSpace), WikiPageAction.INFO_ACTION.getName()); } | /**
* Returns a string representation of an url to view information about the
* passed in page
*
* @param name
* possibly non-globalised name
* @return url as string
*/ | Returns a string representation of an url to view information about the passed in page | getInfoUrl | {
"repo_name": "eemirtekin/Sakai-10.6-TR",
"path": "rwiki/rwiki-tool/tool/src/java/uk/ac/cam/caret/sakai/rwiki/tool/bean/ViewBean.java",
"license": "apache-2.0",
"size": 15443
} | [
"uk.ac.cam.caret.sakai.rwiki.tool.util.WikiPageAction",
"uk.ac.cam.caret.sakai.rwiki.utils.NameHelper"
] | import uk.ac.cam.caret.sakai.rwiki.tool.util.WikiPageAction; import uk.ac.cam.caret.sakai.rwiki.utils.NameHelper; | import uk.ac.cam.caret.sakai.rwiki.tool.util.*; import uk.ac.cam.caret.sakai.rwiki.utils.*; | [
"uk.ac.cam"
] | uk.ac.cam; | 1,133,292 |
@FormUrlEncoded
@POST("/forums/addModerator.json")
Response<Moderator> addModerator(@Field("user") long user, @Query("forum") String forum)
throws ApiException; | @POST(STR) Response<Moderator> addModerator(@Field("user") long user, @Query("forum") String forum) throws ApiException; | /**
* Adds a moderator to a forum
*
* @param user The user id of the moderator
* @param forum The forum short name
* @return The moderator id
* @throws ApiException any error inccured
* @see <a href="https://disqus.com/api/docs/forums/addModerator/">Documentation</a>
*/ | Adds a moderator to a forum | addModerator | {
"repo_name": "jjhesk/DisqusSDK-Android",
"path": "disqus/src/main/java/com/hkm/disqus/api/resources/Forums.java",
"license": "mit",
"size": 15523
} | [
"com.hkm.disqus.api.exception.ApiException",
"com.hkm.disqus.api.model.Response",
"com.hkm.disqus.api.model.forums.Moderator"
] | import com.hkm.disqus.api.exception.ApiException; import com.hkm.disqus.api.model.Response; import com.hkm.disqus.api.model.forums.Moderator; | import com.hkm.disqus.api.exception.*; import com.hkm.disqus.api.model.*; import com.hkm.disqus.api.model.forums.*; | [
"com.hkm.disqus"
] | com.hkm.disqus; | 2,028,043 |
Preconditions.checkArgument(newRecordsPerBatch > 0);
Preconditions.checkState(!updatedRecordsPerBatch); // Only allow updating once
Preconditions.checkState(processingOuter); // We can only update the records per batch when probing.
recordsPerBatch = newRecordsPerBatch;
} | Preconditions.checkArgument(newRecordsPerBatch > 0); Preconditions.checkState(!updatedRecordsPerBatch); Preconditions.checkState(processingOuter); recordsPerBatch = newRecordsPerBatch; } | /**
* Configure a different temporary batch size when spilling probe batches.
* @param newRecordsPerBatch The new temporary batch size to use.
*/ | Configure a different temporary batch size when spilling probe batches | updateProbeRecordsPerBatch | {
"repo_name": "kkhatua/drill",
"path": "exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/common/HashPartition.java",
"license": "apache-2.0",
"size": 22545
} | [
"org.apache.drill.shaded.guava.com.google.common.base.Preconditions"
] | import org.apache.drill.shaded.guava.com.google.common.base.Preconditions; | import org.apache.drill.shaded.guava.com.google.common.base.*; | [
"org.apache.drill"
] | org.apache.drill; | 1,549,212 |
public Map<String,String[]> getParameterMap() {
return this.request.getParameterMap();
}
| Map<String,String[]> function() { return this.request.getParameterMap(); } | /**
* The default behavior of this method is to return getParameterMap()
* on the wrapped request object.
*/ | The default behavior of this method is to return getParameterMap() on the wrapped request object | getParameterMap | {
"repo_name": "plumer/codana",
"path": "tomcat_files/7.0.0/ServletRequestWrapper.java",
"license": "mit",
"size": 12295
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 1,605,061 |
public CollectionFuture<Boolean> asyncLopCreate(String key,
ElementValueType type, CollectionAttributes attributes); | CollectionFuture<Boolean> function(String key, ElementValueType type, CollectionAttributes attributes); | /**
* Create an empty list
*
* @param key
* key of a list
* @param type
* element data type of the list
* @param attributes
* attributes of the list
* @return a future indicating success, false if there was a key
*/ | Create an empty list | asyncLopCreate | {
"repo_name": "jam2in/arcus-java-client",
"path": "src/main/java/net/spy/memcached/ArcusClientIF.java",
"license": "apache-2.0",
"size": 66899
} | [
"net.spy.memcached.collection.CollectionAttributes",
"net.spy.memcached.collection.ElementValueType",
"net.spy.memcached.internal.CollectionFuture"
] | import net.spy.memcached.collection.CollectionAttributes; import net.spy.memcached.collection.ElementValueType; import net.spy.memcached.internal.CollectionFuture; | import net.spy.memcached.collection.*; import net.spy.memcached.internal.*; | [
"net.spy.memcached"
] | net.spy.memcached; | 2,774,805 |
public void register(CopyOption option) {
registerInternal(option, null);
} | void function(CopyOption option) { registerInternal(option, null); } | /**
* Register this internal option as a CopyOption.
*/ | Register this internal option as a CopyOption | register | {
"repo_name": "md-5/jdk10",
"path": "src/java.base/share/classes/sun/nio/fs/ExtendedOptions.java",
"license": "gpl-2.0",
"size": 4918
} | [
"java.nio.file.CopyOption"
] | import java.nio.file.CopyOption; | import java.nio.file.*; | [
"java.nio"
] | java.nio; | 923,251 |
public int getSpawnFuzz(WorldServer world, net.minecraft.server.MinecraftServer server)
{
return this.world.getSpawnFuzz(world, server);
} | int function(WorldServer world, net.minecraft.server.MinecraftServer server) { return this.world.getSpawnFuzz(world, server); } | /**
* Gets the spawn fuzz for players who join the world.
* Useful for void world types.
* @return Fuzz for entity initial spawn in blocks.
*/ | Gets the spawn fuzz for players who join the world. Useful for void world types | getSpawnFuzz | {
"repo_name": "ForgeEssentials/ForgeEssentials",
"path": "src/main/java/com/forgeessentials/multiworld/gen/WorldTypeMultiworld.java",
"license": "gpl-3.0",
"size": 3810
} | [
"net.minecraft.world.WorldServer"
] | import net.minecraft.world.WorldServer; | import net.minecraft.world.*; | [
"net.minecraft.world"
] | net.minecraft.world; | 2,168,321 |
public void setSystemTime(String time) {
try {
SimpleDateFormat df = new SimpleDateFormat("yyyy/MM/dd hh:mm:ss");
Date temp = df.parse(time);
Calendar cal = Calendar.getInstance();
cal.setTime(temp);
SystemClock.setCurrentTimeMillis(cal.getTimeInMillis());
} catch (ParseException e) {
e.printStackTrace();
}
} | void function(String time) { try { SimpleDateFormat df = new SimpleDateFormat(STR); Date temp = df.parse(time); Calendar cal = Calendar.getInstance(); cal.setTime(temp); SystemClock.setCurrentTimeMillis(cal.getTimeInMillis()); } catch (ParseException e) { e.printStackTrace(); } } | /**
* set system time
*
* @param time
* , format "yyyy/MM/dd hh:mm:ss", e.g. "2011/11/25 17:30:00"
*/ | set system time | setSystemTime | {
"repo_name": "BaiduQA/Cafe",
"path": "testservice/src/com/baidu/cafe/remote/SystemLib.java",
"license": "apache-2.0",
"size": 87756
} | [
"android.os.SystemClock",
"java.text.ParseException",
"java.text.SimpleDateFormat",
"java.util.Calendar",
"java.util.Date"
] | import android.os.SystemClock; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; | import android.os.*; import java.text.*; import java.util.*; | [
"android.os",
"java.text",
"java.util"
] | android.os; java.text; java.util; | 2,232,058 |
public void fatal(String message, @Nullable Object source, @Nullable ParseState parseState)
{Thread.dumpStack();
fatal(message, source, parseState, null);
} | void function(String message, @Nullable Object source, @Nullable ParseState parseState) {Thread.dumpStack(); fatal(message, source, parseState, null); } | /**
* Raise a fatal error.
*/ | Raise a fatal error | fatal | {
"repo_name": "emacslisp/Java",
"path": "SpringFrameworkReading/src/org/springframework/beans/factory/parsing/ReaderContext.java",
"license": "mit",
"size": 6376
} | [
"org.springframework.lang.Nullable"
] | import org.springframework.lang.Nullable; | import org.springframework.lang.*; | [
"org.springframework.lang"
] | org.springframework.lang; | 1,882,333 |
public int find(String what, int start) {
try {
ByteBuffer src = ByteBuffer.wrap(this.bytes, 0, this.length);
ByteBuffer tgt = encode(what);
byte b = tgt.get();
src.position(start);
while (src.hasRemaining()) {
if (b == src.get()) { // matching first byte
src.mark(); // save position in loop
tgt.mark(); // save position in target
boolean found = true;
int pos = src.position()-1;
while (tgt.hasRemaining()) {
if (!src.hasRemaining()) { // src expired first
tgt.reset();
src.reset();
found = false;
break;
}
if (!(tgt.get() == src.get())) {
tgt.reset();
src.reset();
found = false;
break; // no match
}
}
if (found) return pos;
}
}
return -1; // not found
} catch (CharacterCodingException e) {
throw new RuntimeException("Should not have happened", e);
}
} | int function(String what, int start) { try { ByteBuffer src = ByteBuffer.wrap(this.bytes, 0, this.length); ByteBuffer tgt = encode(what); byte b = tgt.get(); src.position(start); while (src.hasRemaining()) { if (b == src.get()) { src.mark(); tgt.mark(); boolean found = true; int pos = src.position()-1; while (tgt.hasRemaining()) { if (!src.hasRemaining()) { tgt.reset(); src.reset(); found = false; break; } if (!(tgt.get() == src.get())) { tgt.reset(); src.reset(); found = false; break; } } if (found) return pos; } } return -1; } catch (CharacterCodingException e) { throw new RuntimeException(STR, e); } } | /**
* Finds any occurrence of <code>what</code> in the backing
* buffer, starting as position <code>start</code>. The starting
* position is measured in bytes and the return value is in
* terms of byte position in the buffer. The backing buffer is
* not converted to a string for this operation.
* @return byte position of the first occurrence of the search
* string in the UTF-8 buffer or -1 if not found
*/ | Finds any occurrence of <code>what</code> in the backing buffer, starting as position <code>start</code>. The starting position is measured in bytes and the return value is in terms of byte position in the buffer. The backing buffer is not converted to a string for this operation | find | {
"repo_name": "plusplusjiajia/hadoop",
"path": "hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/Text.java",
"license": "apache-2.0",
"size": 22035
} | [
"java.nio.ByteBuffer",
"java.nio.charset.CharacterCodingException"
] | import java.nio.ByteBuffer; import java.nio.charset.CharacterCodingException; | import java.nio.*; import java.nio.charset.*; | [
"java.nio"
] | java.nio; | 2,311,287 |
private void highConfidenceMayLaunchUrl(CustomTabsSessionToken session, int uid, String url,
Bundle extras, List<Bundle> otherLikelyBundles) {
ThreadUtils.assertOnUiThread();
if (TextUtils.isEmpty(url)) {
cancelSpeculation(session);
return;
}
if (maySpeculate(session)) {
// Hidden tabs are created always with regular profile, so we need to block hidden tab
// creation in incognito mode not to have inconsistent modes between tab model and
// hidden tab. (crbug.com/1190971)
boolean canUseHiddenTab = mClientManager.getCanUseHiddenTab(session)
&& !IntentHandler.hasAnyIncognitoExtra(extras);
startSpeculation(session, url, canUseHiddenTab, extras, uid);
}
preconnectUrls(otherLikelyBundles);
} | void function(CustomTabsSessionToken session, int uid, String url, Bundle extras, List<Bundle> otherLikelyBundles) { ThreadUtils.assertOnUiThread(); if (TextUtils.isEmpty(url)) { cancelSpeculation(session); return; } if (maySpeculate(session)) { boolean canUseHiddenTab = mClientManager.getCanUseHiddenTab(session) && !IntentHandler.hasAnyIncognitoExtra(extras); startSpeculation(session, url, canUseHiddenTab, extras, uid); } preconnectUrls(otherLikelyBundles); } | /**
* High confidence mayLaunchUrl() call, that is:
* - Tries to speculate if possible.
* - An empty URL cancels the current prerender if any.
* - Start a spare renderer if necessary.
*/ | High confidence mayLaunchUrl() call, that is: - Tries to speculate if possible. - An empty URL cancels the current prerender if any. - Start a spare renderer if necessary | highConfidenceMayLaunchUrl | {
"repo_name": "scheib/chromium",
"path": "chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabsConnection.java",
"license": "bsd-3-clause",
"size": 70775
} | [
"android.os.Bundle",
"android.text.TextUtils",
"androidx.browser.customtabs.CustomTabsSessionToken",
"java.util.List",
"org.chromium.base.ThreadUtils",
"org.chromium.chrome.browser.IntentHandler"
] | import android.os.Bundle; import android.text.TextUtils; import androidx.browser.customtabs.CustomTabsSessionToken; import java.util.List; import org.chromium.base.ThreadUtils; import org.chromium.chrome.browser.IntentHandler; | import android.os.*; import android.text.*; import androidx.browser.customtabs.*; import java.util.*; import org.chromium.base.*; import org.chromium.chrome.browser.*; | [
"android.os",
"android.text",
"androidx.browser",
"java.util",
"org.chromium.base",
"org.chromium.chrome"
] | android.os; android.text; androidx.browser; java.util; org.chromium.base; org.chromium.chrome; | 828,266 |
protected boolean validateNewAdvanceDeposit(AdvanceDepositDetail advanceDeposit) {
GlobalVariables.getMessageMap().addToErrorPath(KFSPropertyConstants.NEW_ADVANCE_DEPOSIT);
boolean isValid = AdvanceDepositDocumentRuleUtil.validateAdvanceDeposit(advanceDeposit);
GlobalVariables.getMessageMap().removeFromErrorPath(KFSPropertyConstants.NEW_ADVANCE_DEPOSIT);
return isValid;
} | boolean function(AdvanceDepositDetail advanceDeposit) { GlobalVariables.getMessageMap().addToErrorPath(KFSPropertyConstants.NEW_ADVANCE_DEPOSIT); boolean isValid = AdvanceDepositDocumentRuleUtil.validateAdvanceDeposit(advanceDeposit); GlobalVariables.getMessageMap().removeFromErrorPath(KFSPropertyConstants.NEW_ADVANCE_DEPOSIT); return isValid; } | /**
* This method validates a new advance deposit detail record.
*
* @param advanceDeposit
* @return boolean
*/ | This method validates a new advance deposit detail record | validateNewAdvanceDeposit | {
"repo_name": "ua-eas/kfs-devops-automation-fork",
"path": "kfs-core/src/main/java/org/kuali/kfs/fp/document/web/struts/AdvanceDepositAction.java",
"license": "agpl-3.0",
"size": 7580
} | [
"org.kuali.kfs.fp.businessobject.AdvanceDepositDetail",
"org.kuali.kfs.fp.document.validation.impl.AdvanceDepositDocumentRuleUtil",
"org.kuali.kfs.sys.KFSPropertyConstants",
"org.kuali.rice.krad.util.GlobalVariables"
] | import org.kuali.kfs.fp.businessobject.AdvanceDepositDetail; import org.kuali.kfs.fp.document.validation.impl.AdvanceDepositDocumentRuleUtil; import org.kuali.kfs.sys.KFSPropertyConstants; import org.kuali.rice.krad.util.GlobalVariables; | import org.kuali.kfs.fp.businessobject.*; import org.kuali.kfs.fp.document.validation.impl.*; import org.kuali.kfs.sys.*; import org.kuali.rice.krad.util.*; | [
"org.kuali.kfs",
"org.kuali.rice"
] | org.kuali.kfs; org.kuali.rice; | 103,898 |
public Builder fromEnvironment(Configuration globalConfiguration) {
flinkBinPath = getObligatoryFileFromEnvironment(ENV_FLINK_BIN_DIR);
flinkConfPath = getObligatoryFileFromEnvironment(ENV_FLINK_CONF_DIR);
flinkLibPath = getObligatoryFileFromEnvironment(ENV_FLINK_LIB_DIR);
flinkPluginsPath = PluginConfig.getPluginsDir().orElse(null);
return this;
} | Builder function(Configuration globalConfiguration) { flinkBinPath = getObligatoryFileFromEnvironment(ENV_FLINK_BIN_DIR); flinkConfPath = getObligatoryFileFromEnvironment(ENV_FLINK_CONF_DIR); flinkLibPath = getObligatoryFileFromEnvironment(ENV_FLINK_LIB_DIR); flinkPluginsPath = PluginConfig.getPluginsDir().orElse(null); return this; } | /**
* Configures the overlay using the current environment.
*
* <p>Locates Flink using FLINK_???_DIR environment variables as provided to all Flink processes by config.sh.
*
* @param globalConfiguration the current configuration.
*/ | Configures the overlay using the current environment. Locates Flink using FLINK_???_DIR environment variables as provided to all Flink processes by config.sh | fromEnvironment | {
"repo_name": "jinglining/flink",
"path": "flink-runtime/src/main/java/org/apache/flink/runtime/clusterframework/overlays/FlinkDistributionOverlay.java",
"license": "apache-2.0",
"size": 4538
} | [
"org.apache.flink.configuration.Configuration",
"org.apache.flink.core.plugin.PluginConfig"
] | import org.apache.flink.configuration.Configuration; import org.apache.flink.core.plugin.PluginConfig; | import org.apache.flink.configuration.*; import org.apache.flink.core.plugin.*; | [
"org.apache.flink"
] | org.apache.flink; | 2,835,600 |
public static QueryPlan getOptimizedQueryPlan(PreparedStatement stmt) throws SQLException {
checkNotNull(stmt);
QueryPlan plan = stmt.unwrap(PhoenixPreparedStatement.class).optimizeQuery();
return plan;
} | static QueryPlan function(PreparedStatement stmt) throws SQLException { checkNotNull(stmt); QueryPlan plan = stmt.unwrap(PhoenixPreparedStatement.class).optimizeQuery(); return plan; } | /**
* Returns the opitmized query plan used by phoenix for executing the sql.
* @param stmt to return the plan for
* @throws SQLException
*/ | Returns the opitmized query plan used by phoenix for executing the sql | getOptimizedQueryPlan | {
"repo_name": "shehzaadn/phoenix",
"path": "phoenix-core/src/main/java/org/apache/phoenix/util/PhoenixRuntime.java",
"license": "apache-2.0",
"size": 71130
} | [
"com.google.common.base.Preconditions",
"java.sql.PreparedStatement",
"java.sql.SQLException",
"org.apache.phoenix.compile.QueryPlan",
"org.apache.phoenix.jdbc.PhoenixPreparedStatement"
] | import com.google.common.base.Preconditions; import java.sql.PreparedStatement; import java.sql.SQLException; import org.apache.phoenix.compile.QueryPlan; import org.apache.phoenix.jdbc.PhoenixPreparedStatement; | import com.google.common.base.*; import java.sql.*; import org.apache.phoenix.compile.*; import org.apache.phoenix.jdbc.*; | [
"com.google.common",
"java.sql",
"org.apache.phoenix"
] | com.google.common; java.sql; org.apache.phoenix; | 1,660,377 |
protected void autoSelectDisplayListField(final SearchFieldConfig sfc, final boolean wasAdded)
{
//List<DisplayFieldConfig> displayItems = displayList.getItems();
int index = 0;
for (DisplayFieldConfig dfc : displayList.getItems())
{
if (dfc.getFieldInfo() == sfc.getFieldInfo())
{
JToggleButton tb = displayList.getButtons().get(index);
tb.setSelected(wasAdded);
if (wasAdded)
{
tb.setEnabled(!wasAdded);
} else
{
tb.setEnabled(true);
}
dfc.setInUse(wasAdded);
return;
}
index++;
}
} | void function(final SearchFieldConfig sfc, final boolean wasAdded) { int index = 0; for (DisplayFieldConfig dfc : displayList.getItems()) { if (dfc.getFieldInfo() == sfc.getFieldInfo()) { JToggleButton tb = displayList.getButtons().get(index); tb.setSelected(wasAdded); if (wasAdded) { tb.setEnabled(!wasAdded); } else { tb.setEnabled(true); } dfc.setInUse(wasAdded); return; } index++; } } | /**
* Automatically selects/deselects the display field when the searchable field is choosen or unchoosen/
* @param sfc the choosen search field
* @param wasAdded whether it was added or removed.
*/ | Automatically selects/deselects the display field when the searchable field is choosen or unchoosen | autoSelectDisplayListField | {
"repo_name": "specify/specify6",
"path": "src/edu/ku/brc/af/core/expresssearch/ExpressSearchConfigDlg.java",
"license": "gpl-2.0",
"size": 36683
} | [
"javax.swing.JToggleButton"
] | import javax.swing.JToggleButton; | import javax.swing.*; | [
"javax.swing"
] | javax.swing; | 2,533,918 |
@Nullable
private static DruidJsonFilter computeFilter(@Nullable Filter filterRel,
DruidQuery druidQuery) {
if (filterRel == null) {
return null;
}
final RexNode filter = filterRel.getCondition();
final RelDataType inputRowType = filterRel.getInput().getRowType();
if (filter != null) {
return DruidJsonFilter.toDruidFilters(filter, inputRowType, druidQuery);
}
return null;
} | static DruidJsonFilter function(@Nullable Filter filterRel, DruidQuery druidQuery) { if (filterRel == null) { return null; } final RexNode filter = filterRel.getCondition(); final RelDataType inputRowType = filterRel.getInput().getRowType(); if (filter != null) { return DruidJsonFilter.toDruidFilters(filter, inputRowType, druidQuery); } return null; } | /**
* Translates Filter rel to Druid Filter Json object if possible.
* Currently Filter rel input has to be Druid Table scan
*
* @param filterRel input filter rel
* @param druidQuery Druid query
*
* @return DruidJson Filter or null if can not translate one of filters
*/ | Translates Filter rel to Druid Filter Json object if possible. Currently Filter rel input has to be Druid Table scan | computeFilter | {
"repo_name": "googleinterns/calcite",
"path": "druid/src/main/java/org/apache/calcite/adapter/druid/DruidQuery.java",
"license": "apache-2.0",
"size": 71262
} | [
"javax.annotation.Nullable",
"org.apache.calcite.rel.core.Filter",
"org.apache.calcite.rel.type.RelDataType",
"org.apache.calcite.rex.RexNode"
] | import javax.annotation.Nullable; import org.apache.calcite.rel.core.Filter; import org.apache.calcite.rel.type.RelDataType; import org.apache.calcite.rex.RexNode; | import javax.annotation.*; import org.apache.calcite.rel.core.*; import org.apache.calcite.rel.type.*; import org.apache.calcite.rex.*; | [
"javax.annotation",
"org.apache.calcite"
] | javax.annotation; org.apache.calcite; | 2,690,698 |
static MPrintPaper create (String name, boolean landscape)
{
MPrintPaper pp = new MPrintPaper (Env.getCtx(), 0, null);
pp.setName(name);
pp.setIsLandscape(landscape);
pp.saveEx();
return pp;
} // create
private static CLogger s_log = CLogger.getCLogger(MPrintPaper.class);
static private CCache<Integer,MPrintPaper> s_papers
= new CCache<Integer,MPrintPaper>("AD_PrintPaper", 5);
public MPrintPaper(Properties ctx, int AD_PrintPaper_ID, String trxName)
{
super(ctx, AD_PrintPaper_ID, trxName);
if (AD_PrintPaper_ID == 0)
{
setIsDefault (false);
setIsLandscape (true);
setCode ("iso-a4");
setMarginTop (36);
setMarginBottom (36);
setMarginLeft (36);
setMarginRight (36);
}
} // MPrintPaper
public MPrintPaper (Properties ctx, ResultSet rs, String trxName)
{
super (ctx, rs, trxName);
} // MPrintPaper
private MediaSize m_mediaSize = null;
| static MPrintPaper create (String name, boolean landscape) { MPrintPaper pp = new MPrintPaper (Env.getCtx(), 0, null); pp.setName(name); pp.setIsLandscape(landscape); pp.saveEx(); return pp; } private static CLogger s_log = CLogger.getCLogger(MPrintPaper.class); static private CCache<Integer,MPrintPaper> s_papers = new CCache<Integer,MPrintPaper>(STR, 5); public MPrintPaper(Properties ctx, int AD_PrintPaper_ID, String trxName) { super(ctx, AD_PrintPaper_ID, trxName); if (AD_PrintPaper_ID == 0) { setIsDefault (false); setIsLandscape (true); setCode (STR); setMarginTop (36); setMarginBottom (36); setMarginLeft (36); setMarginRight (36); } } public MPrintPaper (Properties ctx, ResultSet rs, String trxName) { super (ctx, rs, trxName); } private MediaSize m_mediaSize = null; | /**
* Create Paper and save
* @param name name
* @param landscape landscape
* @return Paper
*/ | Create Paper and save | create | {
"repo_name": "armenrz/adempiere",
"path": "base/src/org/compiere/print/MPrintPaper.java",
"license": "gpl-2.0",
"size": 8521
} | [
"java.sql.ResultSet",
"java.util.Properties",
"javax.print.attribute.standard.MediaSize",
"org.compiere.util.CCache",
"org.compiere.util.CLogger",
"org.compiere.util.Env"
] | import java.sql.ResultSet; import java.util.Properties; import javax.print.attribute.standard.MediaSize; import org.compiere.util.CCache; import org.compiere.util.CLogger; import org.compiere.util.Env; | import java.sql.*; import java.util.*; import javax.print.attribute.standard.*; import org.compiere.util.*; | [
"java.sql",
"java.util",
"javax.print",
"org.compiere.util"
] | java.sql; java.util; javax.print; org.compiere.util; | 127,968 |
void reposition(final DBBroker broker, final NodeHandle node, final boolean reportAttributes) throws IOException; | void reposition(final DBBroker broker, final NodeHandle node, final boolean reportAttributes) throws IOException; | /**
* Reposition the stream reader to another start node.
*
* NOTE: This maybe in a different document!
*
* @param broker the database broker.
* @param node the new start node.
* @param reportAttributes if set to true, attributes will be reported as top-level events.
*
* @throws java.io.IOException if an error occurs whilst repositioning the stream
*/ | Reposition the stream reader to another start node | reposition | {
"repo_name": "windauer/exist",
"path": "exist-core/src/main/java/org/exist/stax/IEmbeddedXMLStreamReader.java",
"license": "lgpl-2.1",
"size": 3184
} | [
"java.io.IOException",
"org.exist.dom.persistent.NodeHandle",
"org.exist.storage.DBBroker"
] | import java.io.IOException; import org.exist.dom.persistent.NodeHandle; import org.exist.storage.DBBroker; | import java.io.*; import org.exist.dom.persistent.*; import org.exist.storage.*; | [
"java.io",
"org.exist.dom",
"org.exist.storage"
] | java.io; org.exist.dom; org.exist.storage; | 398,248 |
public OutputStream getOutputStream() throws IOException {
lock.lock();
try { | OutputStream function() throws IOException { lock.lock(); try { | /**
* Return the {@link ServletOutputStream} associated with the request (and
* stash a copy).
*
* @throws IOException
* @throws IllegalStateException
* per the servlet API if the writer has been requested already.
*/ | Return the <code>ServletOutputStream</code> associated with the request (and stash a copy) | getOutputStream | {
"repo_name": "smalyshev/blazegraph",
"path": "bigdata-sails/src/java/com/bigdata/rdf/sail/webapp/AbstractRestApiTask.java",
"license": "gpl-2.0",
"size": 10188
} | [
"java.io.IOException",
"java.io.OutputStream"
] | import java.io.IOException; import java.io.OutputStream; | import java.io.*; | [
"java.io"
] | java.io; | 1,261,946 |
public static ImmutableList<SourcePath> loadFromFile(
AbsPath root,
CellPathResolver cellPathResolver,
ImmutableList<Path> classUsageFilePaths,
ImmutableMap<Path, SourcePath> jarPathToSourcePath) {
ImmutableList.Builder<SourcePath> builder = ImmutableList.builder();
for (Map.Entry<String, ImmutableMap<String, Integer>> jarUsedClassesEntry :
getClassUsageEntries(classUsageFilePaths).entrySet()) {
AbsPath jarAbsolutePath =
convertRecordedJarPathToAbsolute(root, cellPathResolver, jarUsedClassesEntry.getKey());
SourcePath sourcePath = jarPathToSourcePath.get(jarAbsolutePath.getPath());
if (sourcePath == null) {
// This indicates a dependency that wasn't among the deps of the rule; i.e.,
// it came from the build environment (JDK, Android SDK, etc.)
continue;
}
for (String classAbsolutePath : jarUsedClassesEntry.getValue().keySet()) {
builder.add(ArchiveMemberSourcePath.of(sourcePath, Paths.get(classAbsolutePath)));
}
}
return builder.build();
} | static ImmutableList<SourcePath> function( AbsPath root, CellPathResolver cellPathResolver, ImmutableList<Path> classUsageFilePaths, ImmutableMap<Path, SourcePath> jarPathToSourcePath) { ImmutableList.Builder<SourcePath> builder = ImmutableList.builder(); for (Map.Entry<String, ImmutableMap<String, Integer>> jarUsedClassesEntry : getClassUsageEntries(classUsageFilePaths).entrySet()) { AbsPath jarAbsolutePath = convertRecordedJarPathToAbsolute(root, cellPathResolver, jarUsedClassesEntry.getKey()); SourcePath sourcePath = jarPathToSourcePath.get(jarAbsolutePath.getPath()); if (sourcePath == null) { continue; } for (String classAbsolutePath : jarUsedClassesEntry.getValue().keySet()) { builder.add(ArchiveMemberSourcePath.of(sourcePath, Paths.get(classAbsolutePath))); } } return builder.build(); } | /**
* This method loads a class usage file that maps JARs to the list of files within those jars that
* were used. Given our rule's deps, we determine which of these JARS in the class usage file are
* actually among the deps of our rule.
*/ | This method loads a class usage file that maps JARs to the list of files within those jars that were used. Given our rule's deps, we determine which of these JARS in the class usage file are actually among the deps of our rule | loadFromFile | {
"repo_name": "JoelMarcey/buck",
"path": "src/com/facebook/buck/jvm/java/DefaultClassUsageFileReader.java",
"license": "apache-2.0",
"size": 8201
} | [
"com.facebook.buck.core.cell.CellPathResolver",
"com.facebook.buck.core.filesystems.AbsPath",
"com.facebook.buck.core.sourcepath.ArchiveMemberSourcePath",
"com.facebook.buck.core.sourcepath.SourcePath",
"com.google.common.collect.ImmutableList",
"com.google.common.collect.ImmutableMap",
"java.nio.file.Path",
"java.nio.file.Paths",
"java.util.Map"
] | import com.facebook.buck.core.cell.CellPathResolver; import com.facebook.buck.core.filesystems.AbsPath; import com.facebook.buck.core.sourcepath.ArchiveMemberSourcePath; import com.facebook.buck.core.sourcepath.SourcePath; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import java.nio.file.Path; import java.nio.file.Paths; import java.util.Map; | import com.facebook.buck.core.cell.*; import com.facebook.buck.core.filesystems.*; import com.facebook.buck.core.sourcepath.*; import com.google.common.collect.*; import java.nio.file.*; import java.util.*; | [
"com.facebook.buck",
"com.google.common",
"java.nio",
"java.util"
] | com.facebook.buck; com.google.common; java.nio; java.util; | 2,914,856 |
@Nullable()
public String getStartupID()
{
return startupID;
} | @Nullable() String function() { return startupID; } | /**
* Retrieves the Directory Server startup ID for this error log message.
*
* @return The Directory Server startup ID for this error log message, or
* {@code null} if it is not included in the log message.
*/ | Retrieves the Directory Server startup ID for this error log message | getStartupID | {
"repo_name": "UnboundID/ldapsdk",
"path": "src/com/unboundid/ldap/sdk/unboundidds/logs/ErrorLogMessage.java",
"license": "gpl-2.0",
"size": 8240
} | [
"com.unboundid.util.Nullable"
] | import com.unboundid.util.Nullable; | import com.unboundid.util.*; | [
"com.unboundid.util"
] | com.unboundid.util; | 890,649 |
public void slickError(Exception e) {
VSLog.logger.log(Level.SEVERE, "Error initializing Slick2D", e);
allowResize = true;
this.setResizable(true);
this.setMinimumSize(new Dimension(600, 600));
this.setMaximumSize(null);
useOpenGLCheckBox.setSelected(false);
JOptionPane.showMessageDialog(this, "Could not use OpenGL for Rendering, forcing J2D\nPlease retry.");
} | void function(Exception e) { VSLog.logger.log(Level.SEVERE, STR, e); allowResize = true; this.setResizable(true); this.setMinimumSize(new Dimension(600, 600)); this.setMaximumSize(null); useOpenGLCheckBox.setSelected(false); JOptionPane.showMessageDialog(this, STR); } | /**
* If the OpenGL Ui could not get initilaized this Method will Force J2f Rendering
*
* @param e The Exception that Caused the Error
*/ | If the OpenGL Ui could not get initilaized this Method will Force J2f Rendering | slickError | {
"repo_name": "HALive/VisualSort",
"path": "application/src/main/java/halive/visualsort/gui/VisualSortUI.java",
"license": "apache-2.0",
"size": 35975
} | [
"java.awt.Dimension",
"java.util.logging.Level",
"javax.swing.JOptionPane"
] | import java.awt.Dimension; import java.util.logging.Level; import javax.swing.JOptionPane; | import java.awt.*; import java.util.logging.*; import javax.swing.*; | [
"java.awt",
"java.util",
"javax.swing"
] | java.awt; java.util; javax.swing; | 2,081,227 |
@SuppressWarnings("deprecation")
public void setBehindWidth(int i) {
int width;
Display display = ((WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE))
.getDefaultDisplay();
try {
Class<?> cls = Display.class;
Class<?>[] parameterTypes = {Point.class};
Point parameter = new Point();
Method method = cls.getMethod("getSize", parameterTypes);
method.invoke(display, parameter);
width = parameter.x;
} catch (Exception e) {
width = display.getWidth();
}
setBehindOffset(width-i);
} | @SuppressWarnings(STR) void function(int i) { int width; Display display = ((WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE)) .getDefaultDisplay(); try { Class<?> cls = Display.class; Class<?>[] parameterTypes = {Point.class}; Point parameter = new Point(); Method method = cls.getMethod(STR, parameterTypes); method.invoke(display, parameter); width = parameter.x; } catch (Exception e) { width = display.getWidth(); } setBehindOffset(width-i); } | /**
* Sets the behind width.
*
* @param i The width the Sliding Menu will open to, in pixels
*/ | Sets the behind width | setBehindWidth | {
"repo_name": "qmc000/NewMessage",
"path": "message/src/main/java/com/jeremyfeinstein/slidingmenu/lib/SlidingMenu.java",
"license": "apache-2.0",
"size": 28211
} | [
"android.content.Context",
"android.graphics.Point",
"android.view.Display",
"android.view.WindowManager",
"java.lang.reflect.Method"
] | import android.content.Context; import android.graphics.Point; import android.view.Display; import android.view.WindowManager; import java.lang.reflect.Method; | import android.content.*; import android.graphics.*; import android.view.*; import java.lang.reflect.*; | [
"android.content",
"android.graphics",
"android.view",
"java.lang"
] | android.content; android.graphics; android.view; java.lang; | 219,020 |
public OffsetDateTime getCreatedDateTime() {
return this.createdDateTime;
} | OffsetDateTime function() { return this.createdDateTime; } | /**
* Get the createdDateTime property: The date that the operation was created.
*
* @return the createdDateTime value.
*/ | Get the createdDateTime property: The date that the operation was created | getCreatedDateTime | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/PhoneNumberRawOperation.java",
"license": "mit",
"size": 5332
} | [
"java.time.OffsetDateTime"
] | import java.time.OffsetDateTime; | import java.time.*; | [
"java.time"
] | java.time; | 1,798,304 |
public OffsetCriteria withOffsetAsPeriod(String periodString) {
Preconditions.checkNotNull(periodString, "Must provide period string eg. 10d, 4h30m etc");
_offsetCriteria.setOffsetType(OffsetType.PERIOD);
_offsetCriteria.setOffsetString(periodString);
return _offsetCriteria;
} | OffsetCriteria function(String periodString) { Preconditions.checkNotNull(periodString, STR); _offsetCriteria.setOffsetType(OffsetType.PERIOD); _offsetCriteria.setOffsetString(periodString); return _offsetCriteria; } | /**
* Builds an {@link OffsetCriteria} with {@link OffsetType} PERIOD
* @param periodString
* @return
*/ | Builds an <code>OffsetCriteria</code> with <code>OffsetType</code> PERIOD | withOffsetAsPeriod | {
"repo_name": "linkedin/pinot",
"path": "pinot-spi/src/main/java/org/apache/pinot/spi/stream/OffsetCriteria.java",
"license": "apache-2.0",
"size": 6409
} | [
"com.google.common.base.Preconditions"
] | import com.google.common.base.Preconditions; | import com.google.common.base.*; | [
"com.google.common"
] | com.google.common; | 16,992 |
public void rebuild() throws Exception
{
Preconditions.checkState(state.get() == State.STARTED, "Not started");
internalRebuild();
reset();
} | void function() throws Exception { Preconditions.checkState(state.get() == State.STARTED, STR); internalRebuild(); reset(); } | /**
* NOTE: this is a BLOCKING method. Completely rebuild the internal cache by querying
* for all needed data WITHOUT generating any events to send to listeners.
*
* @throws Exception errors
*/ | for all needed data WITHOUT generating any events to send to listeners | rebuild | {
"repo_name": "jludvice/fabric8",
"path": "fabric/fabric-zookeeper/src/main/java/org/apache/curator/framework/recipes/cache/NodeCacheExtended.java",
"license": "apache-2.0",
"size": 10616
} | [
"com.google.common.base.Preconditions"
] | import com.google.common.base.Preconditions; | import com.google.common.base.*; | [
"com.google.common"
] | com.google.common; | 1,164,097 |
public void testCertificateFactory01() throws CertificateException {
if (!X509Support) {
fail(NotSupportMsg);
return;
}
for (int i = 0; i < validValues.length; i++) {
CertificateFactory certF = CertificateFactory
.getInstance(validValues[i]);
assertEquals("Incorrect type: ", validValues[i], certF.getType());
}
} | void function() throws CertificateException { if (!X509Support) { fail(NotSupportMsg); return; } for (int i = 0; i < validValues.length; i++) { CertificateFactory certF = CertificateFactory .getInstance(validValues[i]); assertEquals(STR, validValues[i], certF.getType()); } } | /**
* Test for <code>getInstance(String type)</code> method
* Assertion: returns CertificateFactory if type is X.509
*/ | Test for <code>getInstance(String type)</code> method Assertion: returns CertificateFactory if type is X.509 | testCertificateFactory01 | {
"repo_name": "s20121035/rk3288_android5.1_repo",
"path": "external/apache-harmony/security/src/test/api/java/org/apache/harmony/security/tests/java/security/cert/CertificateFactory1Test.java",
"license": "gpl-3.0",
"size": 26047
} | [
"java.security.cert.CertificateException",
"java.security.cert.CertificateFactory"
] | import java.security.cert.CertificateException; import java.security.cert.CertificateFactory; | import java.security.cert.*; | [
"java.security"
] | java.security; | 1,569,495 |
@Override
public JavaClassBuilderAt at(TypeReferenceLocation... locations)
{
if (locations != null)
this.locations = Arrays.asList(locations);
return this;
} | JavaClassBuilderAt function(TypeReferenceLocation... locations) { if (locations != null) this.locations = Arrays.asList(locations); return this; } | /**
* Only match if the TypeReference is at the specified location within the file.
*/ | Only match if the TypeReference is at the specified location within the file | at | {
"repo_name": "bradsdavis/windup",
"path": "rules-java/src/main/java/org/jboss/windup/rules/apps/java/condition/JavaClass.java",
"license": "epl-1.0",
"size": 12527
} | [
"java.util.Arrays",
"org.jboss.windup.rules.apps.java.scan.ast.TypeReferenceLocation"
] | import java.util.Arrays; import org.jboss.windup.rules.apps.java.scan.ast.TypeReferenceLocation; | import java.util.*; import org.jboss.windup.rules.apps.java.scan.ast.*; | [
"java.util",
"org.jboss.windup"
] | java.util; org.jboss.windup; | 1,808,013 |
@Override
protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
super.collectNewChildDescriptors(newChildDescriptors, object);
newChildDescriptors.add
(createChildParameter
(EsbPackage.Literals.SWITCH_DEFAULT_CONTAINER__MEDIATOR_FLOW,
EsbFactory.eINSTANCE.createMediatorFlow()));
} | void function(Collection<Object> newChildDescriptors, Object object) { super.collectNewChildDescriptors(newChildDescriptors, object); newChildDescriptors.add (createChildParameter (EsbPackage.Literals.SWITCH_DEFAULT_CONTAINER__MEDIATOR_FLOW, EsbFactory.eINSTANCE.createMediatorFlow())); } | /**
* This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
* that can be created under this object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | This adds <code>org.eclipse.emf.edit.command.CommandParameter</code>s describing the children that can be created under this object. | collectNewChildDescriptors | {
"repo_name": "prabushi/devstudio-tooling-esb",
"path": "plugins/org.wso2.developerstudio.eclipse.gmf.esb.edit/src/org/wso2/developerstudio/eclipse/gmf/esb/provider/SwitchDefaultContainerItemProvider.java",
"license": "apache-2.0",
"size": 5020
} | [
"java.util.Collection",
"org.wso2.developerstudio.eclipse.gmf.esb.EsbFactory",
"org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage"
] | import java.util.Collection; import org.wso2.developerstudio.eclipse.gmf.esb.EsbFactory; import org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage; | import java.util.*; import org.wso2.developerstudio.eclipse.gmf.esb.*; | [
"java.util",
"org.wso2.developerstudio"
] | java.util; org.wso2.developerstudio; | 2,745,156 |
public RSGroupInfo getRSGroupOfServer(Address hostPort) throws IOException {
GetRSGroupInfoOfServerRequest request =
GetRSGroupInfoOfServerRequest.newBuilder().setServer(HBaseProtos.ServerName.newBuilder()
.setHostName(hostPort.getHostname()).setPort(hostPort.getPort()).build()).build();
try {
GetRSGroupInfoOfServerResponse resp = stub.getRSGroupInfoOfServer(null, request);
if (resp.hasRSGroupInfo()) {
return ProtobufUtil.toGroupInfo(resp.getRSGroupInfo());
}
return null;
} catch (ServiceException e) {
throw ProtobufUtil.handleRemoteException(e);
}
} | RSGroupInfo function(Address hostPort) throws IOException { GetRSGroupInfoOfServerRequest request = GetRSGroupInfoOfServerRequest.newBuilder().setServer(HBaseProtos.ServerName.newBuilder() .setHostName(hostPort.getHostname()).setPort(hostPort.getPort()).build()).build(); try { GetRSGroupInfoOfServerResponse resp = stub.getRSGroupInfoOfServer(null, request); if (resp.hasRSGroupInfo()) { return ProtobufUtil.toGroupInfo(resp.getRSGroupInfo()); } return null; } catch (ServiceException e) { throw ProtobufUtil.handleRemoteException(e); } } | /**
* Retrieve the RSGroupInfo a server is affiliated to
* @param hostPort HostPort to get RSGroupInfo for
*/ | Retrieve the RSGroupInfo a server is affiliated to | getRSGroupOfServer | {
"repo_name": "apurtell/hbase",
"path": "hbase-server/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupAdminClient.java",
"license": "apache-2.0",
"size": 10899
} | [
"java.io.IOException",
"org.apache.hadoop.hbase.net.Address",
"org.apache.hadoop.hbase.shaded.protobuf.ProtobufUtil",
"org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos",
"org.apache.hadoop.hbase.shaded.protobuf.generated.RSGroupAdminProtos",
"org.apache.hbase.thirdparty.com.google.protobuf.ServiceException"
] | import java.io.IOException; import org.apache.hadoop.hbase.net.Address; import org.apache.hadoop.hbase.shaded.protobuf.ProtobufUtil; import org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos; import org.apache.hadoop.hbase.shaded.protobuf.generated.RSGroupAdminProtos; import org.apache.hbase.thirdparty.com.google.protobuf.ServiceException; | import java.io.*; import org.apache.hadoop.hbase.net.*; import org.apache.hadoop.hbase.shaded.protobuf.*; import org.apache.hadoop.hbase.shaded.protobuf.generated.*; import org.apache.hbase.thirdparty.com.google.protobuf.*; | [
"java.io",
"org.apache.hadoop",
"org.apache.hbase"
] | java.io; org.apache.hadoop; org.apache.hbase; | 2,246,502 |
public HttpListener addListener(String address)
throws IOException
{
return addListener(new InetAddrPort(address));
} | HttpListener function(String address) throws IOException { return addListener(new InetAddrPort(address)); } | /** Create and add a SocketListener.
* Conveniance method.
* @param address
* @return the HttpListener.
* @exception IOException
*/ | Create and add a SocketListener. Conveniance method | addListener | {
"repo_name": "dineshkummarc/Gitak_r982",
"path": "server/selenium-remote-control-1.0.3/selenium-server/org/openqa/jetty/http/HttpServer.java",
"license": "apache-2.0",
"size": 49919
} | [
"java.io.IOException",
"org.openqa.jetty.util.InetAddrPort"
] | import java.io.IOException; import org.openqa.jetty.util.InetAddrPort; | import java.io.*; import org.openqa.jetty.util.*; | [
"java.io",
"org.openqa.jetty"
] | java.io; org.openqa.jetty; | 2,307,989 |
@Override
protected TestEnvironment createTestEnvironment(TestParameters tParam,
PrintWriter log) throws Exception {
XMultiServiceFactory xMSF = tParam.getMSF();
XInterface xInt = (XInterface)xMSF.createInstance(
"com.sun.star.bridge.Bridge");
TestEnvironment tEnv = new TestEnvironment(xInt);
// creating arguments for XInitialization
// first, creating a connection
// connection string
String cncstr = (String) tParam.get("CONNECTION_STRING") ;
int idx = cncstr.indexOf("host=") + 5 ;
// select the port
log.println("Choose Port nr: " + curPort);
connectString = "socket,host=" +
cncstr.substring(idx, cncstr.indexOf(",", idx)) +
",port=" + curPort;
// create acceptor
XInterface oAcctr = (XInterface)xMSF.createInstance(
"com.sun.star.connection.Acceptor") ;
xAcctr = UnoRuntime.queryInterface(
XAcceptor.class, oAcctr);
// create connector
XInterface oCntr = (XInterface)xMSF.createInstance(
"com.sun.star.connection.Connector") ;
xCntr = UnoRuntime.queryInterface(
XConnector.class, oCntr);
// create bridge factory
XInterface oBrdg = (XInterface)xMSF.createInstance(
"com.sun.star.bridge.BridgeFactory") ;
xBrdgFctr = UnoRuntime.queryInterface(XBridgeFactory.class, oBrdg);
// create own implementation of XInstanceProvider
new MyInstanceProvider(xMSF);
// create waiting acceptor thread
accThread = new AcceptorThread(xAcctr);
accThread.start();
// let the thread sleep
util.utils.pause(500);
// establish the connection
XConnection xConnection = xCntr.connect(connectString);
String protocol = "urp";
String bridgeName = protocol + ":" + connectString;
tEnv.addObjRelation("XInitialization.args", new Object[] {
bridgeName, protocol, xConnection, null});
bridge = tEnv.getTestObject();
return tEnv;
} | TestEnvironment function(TestParameters tParam, PrintWriter log) throws Exception { XMultiServiceFactory xMSF = tParam.getMSF(); XInterface xInt = (XInterface)xMSF.createInstance( STR); TestEnvironment tEnv = new TestEnvironment(xInt); String cncstr = (String) tParam.get(STR) ; int idx = cncstr.indexOf("host=") + 5 ; log.println(STR + curPort); connectString = STR + cncstr.substring(idx, cncstr.indexOf(",", idx)) + STR + curPort; XInterface oAcctr = (XInterface)xMSF.createInstance( STR) ; xAcctr = UnoRuntime.queryInterface( XAcceptor.class, oAcctr); XInterface oCntr = (XInterface)xMSF.createInstance( STR) ; xCntr = UnoRuntime.queryInterface( XConnector.class, oCntr); XInterface oBrdg = (XInterface)xMSF.createInstance( STR) ; xBrdgFctr = UnoRuntime.queryInterface(XBridgeFactory.class, oBrdg); new MyInstanceProvider(xMSF); accThread = new AcceptorThread(xAcctr); accThread.start(); util.utils.pause(500); XConnection xConnection = xCntr.connect(connectString); String protocol = "urp"; String bridgeName = protocol + ":" + connectString; tEnv.addObjRelation(STR, new Object[] { bridgeName, protocol, xConnection, null}); bridge = tEnv.getTestObject(); return tEnv; } | /**
* Creating a TestEnvironment for the interfaces to be tested.
* Creates an instance of the service
* <code>com.sun.star.bridge.Bridge</code>.
* Object relations created :
* <ul>
* <li> <code>'XInitialization.args'</code> for
* {@link ifc.lang._XInitialization} and
* {@link ifc.bridge._XBridge} : contains arguments
* for <code>initialize()</code> method test.</li>
* </ul>
*/ | Creating a TestEnvironment for the interfaces to be tested. Creates an instance of the service <code>com.sun.star.bridge.Bridge</code>. Object relations created : <code>'XInitialization.args'</code> for <code>ifc.lang._XInitialization</code> and <code>ifc.bridge._XBridge</code> : contains arguments for <code>initialize()</code> method test. | createTestEnvironment | {
"repo_name": "beppec56/core",
"path": "qadevOOo/tests/java/mod/_remotebridge/various.java",
"license": "gpl-3.0",
"size": 8344
} | [
"com.sun.star.bridge.XBridgeFactory",
"com.sun.star.connection.XAcceptor",
"com.sun.star.connection.XConnection",
"com.sun.star.connection.XConnector",
"com.sun.star.lang.XMultiServiceFactory",
"com.sun.star.uno.UnoRuntime",
"com.sun.star.uno.XInterface",
"java.io.PrintWriter"
] | import com.sun.star.bridge.XBridgeFactory; import com.sun.star.connection.XAcceptor; import com.sun.star.connection.XConnection; import com.sun.star.connection.XConnector; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.XInterface; import java.io.PrintWriter; | import com.sun.star.bridge.*; import com.sun.star.connection.*; import com.sun.star.lang.*; import com.sun.star.uno.*; import java.io.*; | [
"com.sun.star",
"java.io"
] | com.sun.star; java.io; | 1,761,385 |
public static ZError ofExceptionPath(
final Exception e,
final Path p)
{
return ZError.of(
e.getMessage(),
LexicalPosition.of(0, 0, Optional.of(p)),
Optional.of(e));
} | static ZError function( final Exception e, final Path p) { return ZError.of( e.getMessage(), LexicalPosition.of(0, 0, Optional.of(p)), Optional.of(e)); } | /**
* Construct an error from the given exception.
*
* @param e The exception
* @param p The associated path
*
* @return An error
*/ | Construct an error from the given exception | ofExceptionPath | {
"repo_name": "io7m/zeptoblog",
"path": "com.io7m.zeptoblog.core/src/main/java/com/io7m/zeptoblog/core/ZErrors.java",
"license": "isc",
"size": 2444
} | [
"com.io7m.jlexing.core.LexicalPosition",
"java.nio.file.Path",
"java.util.Optional"
] | import com.io7m.jlexing.core.LexicalPosition; import java.nio.file.Path; import java.util.Optional; | import com.io7m.jlexing.core.*; import java.nio.file.*; import java.util.*; | [
"com.io7m.jlexing",
"java.nio",
"java.util"
] | com.io7m.jlexing; java.nio; java.util; | 2,606,815 |
public synchronized boolean disconnect ( boolean hard ) throws IOException {
return disconnect(hard, true);
} | synchronized boolean function ( boolean hard ) throws IOException { return disconnect(hard, true); } | /**
* Disconnect the transport
*
* @param hard
* @return whether conenction was in use
* @throws IOException
*/ | Disconnect the transport | disconnect | {
"repo_name": "codelibs/jcifs",
"path": "src/main/java/jcifs/util/transport/Transport.java",
"license": "lgpl-2.1",
"size": 24646
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 444,832 |
public int write(byte[] data) {
try {
return sService.write(data);
} catch (RemoteException e) {
onError("writing data");
return -1;
}
} | int function(byte[] data) { try { return sService.write(data); } catch (RemoteException e) { onError(STR); return -1; } } | /**
* Writes {@code data} to the persistent partition. Previously written data
* will be overwritten. This data will persist across factory resets.
*
* Returns the number of bytes written or -1 on error. If the block is too big
* to fit on the partition, returns -MAX_BLOCK_SIZE.
*
* @param data the data to write
*/ | Writes data to the persistent partition. Previously written data will be overwritten. This data will persist across factory resets. Returns the number of bytes written or -1 on error. If the block is too big to fit on the partition, returns -MAX_BLOCK_SIZE | write | {
"repo_name": "syslover33/ctank",
"path": "java/android-sdk-linux_r24.4.1_src/sources/android-23/android/service/persistentdata/PersistentDataBlockManager.java",
"license": "gpl-3.0",
"size": 4394
} | [
"android.os.RemoteException"
] | import android.os.RemoteException; | import android.os.*; | [
"android.os"
] | android.os; | 1,688,160 |
Chunk chunk = cm.getChunk(chunkX, chunkZ);
if(chunk == null) return MapType.CHESS.renderer.renderToBitmap(cm, bm, dimension, chunkX, chunkZ, bX, bZ, eX, eZ, pX, pY, pW, pL);
Version cVersion = chunk.getVersion();
if(cVersion == Version.ERROR) return MapType.ERROR.renderer.renderToBitmap(cm, bm, dimension, chunkX, chunkZ, bX, bZ, eX, eZ, pX, pY, pW, pL);
//the bottom sub-chunk is sufficient to get heightmap data.
TerrainChunkData data = chunk.getTerrain((byte) 0);
if(data == null || !data.load2DData()) return MapType.CHESS.renderer.renderToBitmap(cm, bm, dimension, chunkX, chunkZ, bX, bZ, eX, eZ, pX, pY, pW, pL);
boolean west = true, north = true;
TerrainChunkData dataW = null, dataN = null;
Chunk dataWC = cm.getChunk(chunkX - 1, chunkZ);
if(dataWC != null)
dataW = dataWC.getTerrain((byte) 0);
else
west = false;
Chunk dataNC = cm.getChunk(chunkX, chunkZ-1);
if(dataNC != null)
dataN = dataNC.getTerrain((byte) 0);
else
north = false;
west &= dataW != null && dataW.load2DData();
north &= dataN != null && dataN.load2DData();
int x, y, z, color, i, j, tX, tY;
int yW, yN;
int r, g, b;
float yNorm, yNorm2, heightShading;
for (z = bZ, tY = pY ; z < eZ; z++, tY += pL) {
for (x = bX, tX = pX; x < eX; x++, tX += pW) {
//smooth step function: 6x^5 - 15x^4 + 10x^3
y = data.getHeightMapValue(x, z);
yNorm = (float) y / (float) dimension.chunkH;
yNorm2 = yNorm*yNorm;
yNorm = ((6f*yNorm2) - (15f*yNorm) + 10f)*yNorm2*yNorm;
yW = (x == 0) ? (west ? dataW.getHeightMapValue(dimension.chunkW - 1, z) : y)//chunk edge
: data.getHeightMapValue(x - 1, z);//within chunk
yN = (z == 0) ? (north ? dataN.getHeightMapValue(x, dimension.chunkL - 1) : y)//chunk edge
: data.getHeightMapValue(x, z - 1);//within chunk
heightShading = SatelliteRenderer.getHeightShading(y, yW, yN);
r = (int) (yNorm*heightShading*256f);
g = (int) (70f*heightShading);
b = (int) (256f*(1f-yNorm)/(yNorm + 1f));
r = r < 0 ? 0 : r > 255 ? 255 : r;
g = g < 0 ? 0 : g > 255 ? 255 : g;
b = b < 0 ? 0 : b > 255 ? 255 : b;
color = (r << 16) | (g << 8) | b | 0xff000000;
for(i = 0; i < pL; i++){
for(j = 0; j < pW; j++){
bm.setRGB(tX + j, tY + i, color);
}
}
}
}
return bm;
} | Chunk chunk = cm.getChunk(chunkX, chunkZ); if(chunk == null) return MapType.CHESS.renderer.renderToBitmap(cm, bm, dimension, chunkX, chunkZ, bX, bZ, eX, eZ, pX, pY, pW, pL); Version cVersion = chunk.getVersion(); if(cVersion == Version.ERROR) return MapType.ERROR.renderer.renderToBitmap(cm, bm, dimension, chunkX, chunkZ, bX, bZ, eX, eZ, pX, pY, pW, pL); TerrainChunkData data = chunk.getTerrain((byte) 0); if(data == null !data.load2DData()) return MapType.CHESS.renderer.renderToBitmap(cm, bm, dimension, chunkX, chunkZ, bX, bZ, eX, eZ, pX, pY, pW, pL); boolean west = true, north = true; TerrainChunkData dataW = null, dataN = null; Chunk dataWC = cm.getChunk(chunkX - 1, chunkZ); if(dataWC != null) dataW = dataWC.getTerrain((byte) 0); else west = false; Chunk dataNC = cm.getChunk(chunkX, chunkZ-1); if(dataNC != null) dataN = dataNC.getTerrain((byte) 0); else north = false; west &= dataW != null && dataW.load2DData(); north &= dataN != null && dataN.load2DData(); int x, y, z, color, i, j, tX, tY; int yW, yN; int r, g, b; float yNorm, yNorm2, heightShading; for (z = bZ, tY = pY ; z < eZ; z++, tY += pL) { for (x = bX, tX = pX; x < eX; x++, tX += pW) { y = data.getHeightMapValue(x, z); yNorm = (float) y / (float) dimension.chunkH; yNorm2 = yNorm*yNorm; yNorm = ((6f*yNorm2) - (15f*yNorm) + 10f)*yNorm2*yNorm; yW = (x == 0) ? (west ? dataW.getHeightMapValue(dimension.chunkW - 1, z) : y) : data.getHeightMapValue(x - 1, z); yN = (z == 0) ? (north ? dataN.getHeightMapValue(x, dimension.chunkL - 1) : y) : data.getHeightMapValue(x, z - 1); heightShading = SatelliteRenderer.getHeightShading(y, yW, yN); r = (int) (yNorm*heightShading*256f); g = (int) (70f*heightShading); b = (int) (256f*(1f-yNorm)/(yNorm + 1f)); r = r < 0 ? 0 : r > 255 ? 255 : r; g = g < 0 ? 0 : g > 255 ? 255 : g; b = b < 0 ? 0 : b > 255 ? 255 : b; color = (r << 16) (g << 8) b 0xff000000; for(i = 0; i < pL; i++){ for(j = 0; j < pW; j++){ bm.setRGB(tX + j, tY + i, color); } } } } return bm; } | /**
* Render a single chunk to provided bitmap (bm)
* @param cm ChunkManager, provides chunks, which provide chunk-data
* @param bm Bitmap to render to
* @param dimension Mapped dimension
* @param chunkX X chunk coordinate (x-block coord / Chunk.WIDTH)
* @param chunkZ Z chunk coordinate (z-block coord / Chunk.LENGTH)
* @param bX begin block X coordinate, relative to chunk edge
* @param bZ begin block Z coordinate, relative to chunk edge
* @param eX end block X coordinate, relative to chunk edge
* @param eZ end block Z coordinate, relative to chunk edge
* @param pX texture X pixel coord to start rendering to
* @param pY texture Y pixel coord to start rendering to
* @param pW width (X) of one block in pixels
* @param pL length (Z) of one block in pixels
* @return bm is returned back
*
* @throws Version.VersionException when the version of the chunk is unsupported.
*/ | Render a single chunk to provided bitmap (bm) | renderToBitmap | {
"repo_name": "jocopa3/blocktopograph-library",
"path": "src/com/protolambda/blocktopograph/map/renderer/HeightmapRenderer.java",
"license": "agpl-3.0",
"size": 4486
} | [
"com.protolambda.blocktopograph.chunk.Chunk",
"com.protolambda.blocktopograph.chunk.Version",
"com.protolambda.blocktopograph.chunk.terrain.TerrainChunkData"
] | import com.protolambda.blocktopograph.chunk.Chunk; import com.protolambda.blocktopograph.chunk.Version; import com.protolambda.blocktopograph.chunk.terrain.TerrainChunkData; | import com.protolambda.blocktopograph.chunk.*; import com.protolambda.blocktopograph.chunk.terrain.*; | [
"com.protolambda.blocktopograph"
] | com.protolambda.blocktopograph; | 992,176 |
public List<ResolveInfo> getActivitiesThatCanRespondToIntentWithMetaData(Intent intent) {
return PackageManagerUtils.queryIntentActivities(intent, PackageManager.GET_META_DATA);
} | List<ResolveInfo> function(Intent intent) { return PackageManagerUtils.queryIntentActivities(intent, PackageManager.GET_META_DATA); } | /**
* Retrieves the list of activities that can respond to the given intent. And returns the
* activites' meta data in ResolveInfo.
*
* @param intent The intent to query.
* @return The list of activities that can respond to the intent.
*/ | Retrieves the list of activities that can respond to the given intent. And returns the activites' meta data in ResolveInfo | getActivitiesThatCanRespondToIntentWithMetaData | {
"repo_name": "scheib/chromium",
"path": "components/payments/content/android/java/src/org/chromium/components/payments/PackageManagerDelegate.java",
"license": "bsd-3-clause",
"size": 5931
} | [
"android.content.Intent",
"android.content.pm.PackageManager",
"android.content.pm.ResolveInfo",
"java.util.List",
"org.chromium.base.PackageManagerUtils"
] | import android.content.Intent; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import java.util.List; import org.chromium.base.PackageManagerUtils; | import android.content.*; import android.content.pm.*; import java.util.*; import org.chromium.base.*; | [
"android.content",
"java.util",
"org.chromium.base"
] | android.content; java.util; org.chromium.base; | 484,288 |
NetworkInfo getNetworkInfo(); | NetworkInfo getNetworkInfo(); | /**
* Returns the socket network information object.
* @return the socket network information object.
*/ | Returns the socket network information object | getNetworkInfo | {
"repo_name": "aaruff/LabManager",
"path": "src/main/java/edu/nyu/cess/remote/common/message/MessageSocket.java",
"license": "gpl-3.0",
"size": 1448
} | [
"edu.nyu.cess.remote.common.net.NetworkInfo"
] | import edu.nyu.cess.remote.common.net.NetworkInfo; | import edu.nyu.cess.remote.common.net.*; | [
"edu.nyu.cess"
] | edu.nyu.cess; | 1,147,929 |
private QueryRequest createQueryRequest(String[] elements) {
QueryRequest request = QueryRequest.create();
for (String element : elements) {
String[] parts = StringUtils.split(element, ":", 2);
parts[0] = parts[0].replace("\\", "\\\\");
parts[1] = parts[1].replace("\\", "\\\\");
request.addParameter(parts[0], parts[1].substring(1, parts[1].length() - 1));
}
return request;
} | QueryRequest function(String[] elements) { QueryRequest request = QueryRequest.create(); for (String element : elements) { String[] parts = StringUtils.split(element, ":", 2); parts[0] = parts[0].replace("\\", "\\\\"); parts[1] = parts[1].replace("\\", "\\\\"); request.addParameter(parts[0], parts[1].substring(1, parts[1].length() - 1)); } return request; } | /**
* Parses the previously split query string into a query request and fills the parameters of the object
* with the data.
*/ | Parses the previously split query string into a query request and fills the parameters of the object with the data | createQueryRequest | {
"repo_name": "openengsb/openengsb",
"path": "components/ekb/persistence-query-edb/src/main/java/org/openengsb/core/ekb/persistence/query/edb/internal/DefaultQueryParser.java",
"license": "apache-2.0",
"size": 3996
} | [
"org.apache.commons.lang.StringUtils",
"org.openengsb.core.api.model.QueryRequest"
] | import org.apache.commons.lang.StringUtils; import org.openengsb.core.api.model.QueryRequest; | import org.apache.commons.lang.*; import org.openengsb.core.api.model.*; | [
"org.apache.commons",
"org.openengsb.core"
] | org.apache.commons; org.openengsb.core; | 1,109,362 |
public T recycle(View root)
{
this.root = root;
this.view = root;
reset();
this.context = null;
return self();
} | T function(View root) { this.root = root; this.view = root; reset(); this.context = null; return self(); } | /**
* Recycle this AQuery object.
* <p/>
* The method is designed to avoid recreating an AQuery object repeatedly, such as when in list adapter getView method.
*
* @param root The new root of the recycled AQuery.
* @return self
*/ | Recycle this AQuery object. The method is designed to avoid recreating an AQuery object repeatedly, such as when in list adapter getView method | recycle | {
"repo_name": "libit/lr_dialer",
"path": "app/src/main/java/com/androidquery/AbstractAQuery.java",
"license": "gpl-3.0",
"size": 62801
} | [
"android.view.View"
] | import android.view.View; | import android.view.*; | [
"android.view"
] | android.view; | 1,507,039 |
public static final SourceModel.Expr optimizerHelper_alt_getPositionArguments(SourceModel.Expr altObject, SourceModel.Expr index) {
return
SourceModel.Expr.Application.make(
new SourceModel.Expr[] {SourceModel.Expr.Var.make(Functions.optimizerHelper_alt_getPositionArguments), altObject, index});
}
| static final SourceModel.Expr function(SourceModel.Expr altObject, SourceModel.Expr index) { return SourceModel.Expr.Application.make( new SourceModel.Expr[] {SourceModel.Expr.Var.make(Functions.optimizerHelper_alt_getPositionArguments), altObject, index}); } | /**
* Helper binding method for function: optimizerHelper_alt_getPositionArguments.
* @param altObject
* @param index
* @return the SourceModule.expr representing an application of optimizerHelper_alt_getPositionArguments
*/ | Helper binding method for function: optimizerHelper_alt_getPositionArguments | optimizerHelper_alt_getPositionArguments | {
"repo_name": "levans/Open-Quark",
"path": "src/CAL_Platform/src/org/openquark/cal/internal/module/Cal/Internal/CAL_Optimizer_Expression_internal.java",
"license": "bsd-3-clause",
"size": 265925
} | [
"org.openquark.cal.compiler.SourceModel"
] | import org.openquark.cal.compiler.SourceModel; | import org.openquark.cal.compiler.*; | [
"org.openquark.cal"
] | org.openquark.cal; | 1,092,358 |
private PendingIntent getPrevPendingIntent(Context context) {
Intent ankiDroidIntent = new Intent(context, UpdateService.class);
ankiDroidIntent.setAction(ACTION_PREV);
return PendingIntent.getService(context, 0, ankiDroidIntent, 0);
} | PendingIntent function(Context context) { Intent ankiDroidIntent = new Intent(context, UpdateService.class); ankiDroidIntent.setAction(ACTION_PREV); return PendingIntent.getService(context, 0, ankiDroidIntent, 0); } | /**
* Returns a pending intent that updates the widget to show the previous deck.
*/ | Returns a pending intent that updates the widget to show the previous deck | getPrevPendingIntent | {
"repo_name": "nachtfisch/Anki-Android",
"path": "src/com/ichi2/widget/AnkiDroidWidgetMedium.java",
"license": "gpl-3.0",
"size": 16287
} | [
"android.app.PendingIntent",
"android.content.Context",
"android.content.Intent"
] | import android.app.PendingIntent; import android.content.Context; import android.content.Intent; | import android.app.*; import android.content.*; | [
"android.app",
"android.content"
] | android.app; android.content; | 2,263,217 |
@Override
public String getUnlocalizedName(ItemStack itemstack) {
if (this.names == null) {
return super.getUnlocalizedName(itemstack);
}
int i = MathHelper.clamp_int(itemstack.getItemDamage(), 0, names.length - 1);
return super.getUnlocalizedName() + "_" + names[i];
}
| String function(ItemStack itemstack) { if (this.names == null) { return super.getUnlocalizedName(itemstack); } int i = MathHelper.clamp_int(itemstack.getItemDamage(), 0, names.length - 1); return super.getUnlocalizedName() + "_" + names[i]; } | /**
* Returns the unlocalized name of this item. This version accepts an ItemStack so different stacks can have
* different names based on their damage or NBT.
*/ | Returns the unlocalized name of this item. This version accepts an ItemStack so different stacks can have different names based on their damage or NBT | getUnlocalizedName | {
"repo_name": "Vexatos/Tropicraft",
"path": "src/main/java/net/tropicraft/item/ItemBlockTropicraft.java",
"license": "mpl-2.0",
"size": 1691
} | [
"net.minecraft.item.ItemStack",
"net.minecraft.util.MathHelper"
] | import net.minecraft.item.ItemStack; import net.minecraft.util.MathHelper; | import net.minecraft.item.*; import net.minecraft.util.*; | [
"net.minecraft.item",
"net.minecraft.util"
] | net.minecraft.item; net.minecraft.util; | 1,366,742 |
public static void goToGooglePlay(Context context, String id) {
try {
context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + id)));
} catch (ActivityNotFoundException e) {
context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + id)));
}
} | static void function(Context context, String id) { try { context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(STRhttps: } } | /**
* Opens Google Play if installed, if not opens browser
* @param context Context
* @param id PackageName on Google Play
*/ | Opens Google Play if installed, if not opens browser | goToGooglePlay | {
"repo_name": "vjrathod/APKHandler",
"path": "app/src/main/java/com/lim/apkhandler/utils/UtilsApp.java",
"license": "gpl-3.0",
"size": 11187
} | [
"android.content.Context",
"android.content.Intent",
"android.net.Uri"
] | import android.content.Context; import android.content.Intent; import android.net.Uri; | import android.content.*; import android.net.*; | [
"android.content",
"android.net"
] | android.content; android.net; | 1,308,727 |
public String displayHead() {
StringBuffer result = new StringBuffer(2048);
int buttonStyle = getSettings().getUserSettings().getWorkplaceButtonStyle();
// change to online project to allow exporting
try {
getJsp().getRequestContext().setCurrentProject(m_onlineProject);
String resourcePath = getJsp().link("/system/modules/" + MODULE_NAME + "/resources/");
result.append(buildHtmlHelpStart("workplace.css", false));
result.append("<body class=\"buttons-head\" unselectable=\"on\">\n");
result.append("<script type=\"text/javascript\" src=\"");
result.append(getJsp().link("/system/modules/org.opencms.workplace.help/resources/search.js"));
result.append("\"></script>\n");
// store home link in JS variable to use it in body frame
result.append("<script type=\"text/javascript\">\n<!--\n");
result.append("\tvar homeLink = \"");
result.append(CmsEncoder.escapeXml(getParamHomelink()));
result.append("\";\n\n");
result.append("//-->\n</script>\n");
// search form with invisible elements
// search index may be attached to resource /system/modules/org.opencms.workplace.help/elements/search.jsp,
// property search.index.
String index = getJsp().property(
"search.index",
"/system/modules/org.opencms.workplace.help/elements/search.jsp",
"German online help",
false);
StringBuffer submitAction = new StringBuffer();
submitAction.append("parseSearchQuery(document.forms[\'searchform\'],\'");
submitAction.append(
Messages.get().getBundle(getLocale()).key(
Messages.GUI_HELP_ERR_SEARCH_WORD_LENGTH_1,
new Integer(3))).append("\');");
result.append("<form style=\"margin: 0;\" name=\"searchform\" method=\"post\" action=\"");
String searchLink = getJsp().link(
new StringBuffer("/system/modules/org.opencms.workplace.help/elements/search.jsp?").append(
CmsLocaleManager.PARAMETER_LOCALE).append("=").append(getLocale()).toString());
result.append(searchLink);
result.append("\" target=\"body\"");
result.append(" onsubmit=\"");
result.append(submitAction.toString());
result.append("\">\n");
result.append(" <input type=\"hidden\" name=\"action\" value=\"search\" />\n");
result.append(" <input type=\"hidden\" name=\"query\" value=\"\" />\n");
result.append(" <input type=\"hidden\" name=\"index\" value=\"" + index + "\" />\n");
result.append(" <input type=\"hidden\" name=\"searchPage\" value=\"1\" />\n");
result.append("<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n");
result.append("<tr>\n");
result.append("\t<td align=\"left\">\n");
// display navigation buttons
result.append(buttonBar(HTML_START));
result.append(buttonBarStartTab(0, 5));
result.append(button(
"javascript:history.back();",
null,
"back.png",
org.opencms.search.Messages.GUI_HELP_BUTTON_BACK_0,
buttonStyle,
resourcePath));
result.append(button(
"javascript:history.forward();",
null,
"next.png",
org.opencms.search.Messages.GUI_HELP_BUTTON_NEXT_0,
buttonStyle,
resourcePath));
result.append(button(
"javascript:top.body.location.href='" + CmsEncoder.escapeXml(getParamHomelink()) + "';",
null,
"contents.png",
org.opencms.search.Messages.GUI_HELP_BUTTON_CONTENTS_0,
buttonStyle,
resourcePath));
//search
result.append("<td style=\"vertical-align: top;\">");
result.append("<input type=\"text\" name=\"query2\" class=\"onlineform\" style=\"width: 120px\" value=\"");
result.append("");
result.append(" \">");
result.append("</td>\n");
result.append(
button(
new StringBuffer("javascript:").append(submitAction.toString()).toString(),
null,
null,
org.opencms.search.Messages.GUI_HELP_BUTTON_SEARCH_0,
2,
null));
result.append(buttonBar(HTML_END));
result.append("</td>\n");
result.append("\t<td align=\"right\" width=\"100%\">\n");
// display close button
result.append(buttonBar(HTML_START));
result.append(buttonBarSeparator(5, 0));
result.append(button(
"javascript:top.close();",
null,
"close",
org.opencms.search.Messages.GUI_HELP_BUTTON_CLOSE_0,
buttonStyle,
resourcePath));
result.append(buttonBar(HTML_END));
result.append("\t</td>\n");
result.append("\t<td> </td>\n");
result.append("<td>");
// display logo
result.append("<span style=\"display: block; width: 80px; height: 22px; background-image: url(\'");
result.append(getSkinUri());
result.append("commons/workplace.png");
result.append("\'); \"></span>");
result.append("</td>");
result.append("</tr>\n");
result.append("</table>\n");
result.append("</form>\n");
result.append(buildHtmlHelpEnd());
return result.toString();
} finally {
// set back to offline project
getJsp().getRequestContext().setCurrentProject(m_offlineProject);
}
} | String function() { StringBuffer result = new StringBuffer(2048); int buttonStyle = getSettings().getUserSettings().getWorkplaceButtonStyle(); try { getJsp().getRequestContext().setCurrentProject(m_onlineProject); String resourcePath = getJsp().link(STR + MODULE_NAME + STR); result.append(buildHtmlHelpStart(STR, false)); result.append(STRbuttons-head\STRon\">\n"); result.append(STRtext/javascript\STRSTR/system/modules/org.opencms.workplace.help/resources/search.jsSTR\STR); result.append(STRtext/javascript\STR); result.append(STRSTR\";\n\n"); result.append(STRsearch.indexSTR/system/modules/org.opencms.workplace.help/elements/search.jspSTRGerman online helpSTRparseSearchQuery(document.forms[\'searchform\'],\'STR\');STR<form style=\STR name=\STR method=\"post\" action=\STR/system/modules/org.opencms.workplace.help/elements/search.jsp?STR=STR\STRbody\"STR onsubmit=\STR\">\nSTR <input type=\"hidden\STRaction\STRsearch\" />\nSTR <input type=\"hidden\STRquery\STR\" />\nSTR <input type=\"hidden\STRindex\STRSTR\" />\nSTR <input type=\"hidden\STRsearchPage\STR1\" />\nSTR<table width=\"100%\STR0\STR0\STR0\">\nSTR<tr>\nSTR\t<td align=\"left\">\n"); result.append(buttonBar(HTML_START)); result.append(buttonBarStartTab(0, 5)); result.append(button( STR, null, STR, org.opencms.search.Messages.GUI_HELP_BUTTON_BACK_0, buttonStyle, resourcePath)); result.append(button( STR, null, STR, org.opencms.search.Messages.GUI_HELP_BUTTON_NEXT_0, buttonStyle, resourcePath)); result.append(button( STR + CmsEncoder.escapeXml(getParamHomelink()) + "';", null, STR, org.opencms.search.Messages.GUI_HELP_BUTTON_CONTENTS_0, buttonStyle, resourcePath)); result.append(STRvertical-align: top;\">STR<input type=\"text\STRquery2\STRonlineform\STRwidth: 120px\STRSTRSTR \">STR</td>\n"); result.append( button( new StringBuffer(STR).append(submitAction.toString()).toString(), null, null, org.opencms.search.Messages.GUI_HELP_BUTTON_SEARCH_0, 2, null)); result.append(buttonBar(HTML_END)); result.append("</td>\nSTR\t<td align=\"right\STR100%\">\n"); result.append(buttonBar(HTML_START)); result.append(buttonBarSeparator(5, 0)); result.append(button( STR, null, "close", org.opencms.search.Messages.GUI_HELP_BUTTON_CLOSE_0, buttonStyle, resourcePath)); result.append(buttonBar(HTML_END)); result.append("\t</td>\nSTR\t<td> </td>\nSTR<td>STR<span style=\"display: block; width: 80px; height: 22px; background-image: url(\'STRcommons/workplace.pngSTR\'); \"></span>STR</td>STR</tr>\nSTR</table>\nSTR</form>\n"); result.append(buildHtmlHelpEnd()); return result.toString(); } finally { getJsp().getRequestContext().setCurrentProject(m_offlineProject); } } | /**
* Returns the HTML for the head frame of the online help.<p>
*
* @return the HTML for the head frame of the online help
*/ | Returns the HTML for the head frame of the online help | displayHead | {
"repo_name": "ggiudetti/opencms-core",
"path": "src-modules/org/opencms/workplace/help/CmsHelpTemplateBean.java",
"license": "lgpl-2.1",
"size": 36527
} | [
"org.opencms.i18n.CmsEncoder"
] | import org.opencms.i18n.CmsEncoder; | import org.opencms.i18n.*; | [
"org.opencms.i18n"
] | org.opencms.i18n; | 697,159 |
public static Date toDate(HttpServletRequest request, String dateParam, String fmParam, Date defaultValue){
try{
String format = request.getParameter(fmParam) ;
format = StringService.hasLength(format) ? format : DEFAULT_DATE_FORMAT ;
// get date value.
String date = request.getParameter(dateParam);
if(!StringService.hasLength(date)) return defaultValue ;
return DateService.getDate(date, format) ;
}catch(Exception ex){}
// return default value.
return defaultValue ;
} | static Date function(HttpServletRequest request, String dateParam, String fmParam, Date defaultValue){ try{ String format = request.getParameter(fmParam) ; format = StringService.hasLength(format) ? format : DEFAULT_DATE_FORMAT ; String date = request.getParameter(dateParam); if(!StringService.hasLength(date)) return defaultValue ; return DateService.getDate(date, format) ; }catch(Exception ex){} return defaultValue ; } | /**
* Get date from the given request and date parameter.
*
*
* @param request {@link HttpServletRequest} - the given servlet request.
* @param dateParam String - the given date parameter.
* @param fmParam String - the given format date parameter.
* @param defaultValue Date - the given default value when convert date error.
* @return the date or default value.
*/ | Get date from the given request and date parameter | toDate | {
"repo_name": "inetcloud/iMail",
"path": "source/mail-admin-service/src/com/inet/web/service/mail/utils/WebCommonService.java",
"license": "gpl-2.0",
"size": 10432
} | [
"com.inet.base.service.DateService",
"com.inet.base.service.StringService",
"java.util.Date",
"javax.servlet.http.HttpServletRequest"
] | import com.inet.base.service.DateService; import com.inet.base.service.StringService; import java.util.Date; import javax.servlet.http.HttpServletRequest; | import com.inet.base.service.*; import java.util.*; import javax.servlet.http.*; | [
"com.inet.base",
"java.util",
"javax.servlet"
] | com.inet.base; java.util; javax.servlet; | 261,641 |
private Set<String> keys = null;
protected Set<String> handleKeySet() {
return Collections.emptySet();
} | Set<String> keys = null; protected Set<String> function() { return Collections.emptySet(); } | /**
* Returns a Set of the keys contained <i>only</i> in this ResourceBundle.
* This does not include further keys from parent bundles.
* @return a Set of the keys contained only in this ResourceBundle,
* which is empty if this is not a bundle or a table resource
* @internal
* @deprecated This API is ICU internal only.
*/ | Returns a Set of the keys contained only in this ResourceBundle. This does not include further keys from parent bundles | handleKeySet | {
"repo_name": "UweTrottmann/QuickDic-Dictionary",
"path": "jars/icu4j-4_8_1_1/main/classes/core/src/com/ibm/icu/util/UResourceBundle.java",
"license": "apache-2.0",
"size": 41392
} | [
"java.util.Collections",
"java.util.Set"
] | import java.util.Collections; import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 1,363,746 |
private static Constructor forceDefaultConstructor(Class cl) throws Exception
{
Constructor cons = Object.class.getDeclaredConstructor(new Class[0]);
cons = reflFactory.newConstructorForSerialization(cl, cons);
cons.setAccessible(true);
System.out.println("Cons: " + cons);
return cons;
} | static Constructor function(Class cl) throws Exception { Constructor cons = Object.class.getDeclaredConstructor(new Class[0]); cons = reflFactory.newConstructorForSerialization(cl, cons); cons.setAccessible(true); System.out.println(STR + cons); return cons; } | /**
* Returns subclass-accessible no-arg constructor of first non-serializable
* superclass, or null if none found. Access checks are disabled on the
* returned constructor (if any).
*/ | Returns subclass-accessible no-arg constructor of first non-serializable superclass, or null if none found. Access checks are disabled on the returned constructor (if any) | forceDefaultConstructor | {
"repo_name": "kbarrett/third-year-project",
"path": "src/ch/idsia/utils/wox/serial/AccessTest.java",
"license": "bsd-3-clause",
"size": 4767
} | [
"java.lang.reflect.Constructor"
] | import java.lang.reflect.Constructor; | import java.lang.reflect.*; | [
"java.lang"
] | java.lang; | 982,398 |
public static URI getDefaultApplicationDir( IContextAieon aieon )
{
Location location = Platform.getConfigurationLocation();
File file = new File( location.getURL().getPath() );
file = new File( file, File.separator + aieon.getSource() + File.separator );
return file.toURI();
}
| static URI function( IContextAieon aieon ) { Location location = Platform.getConfigurationLocation(); File file = new File( location.getURL().getPath() ); file = new File( file, File.separator + aieon.getSource() + File.separator ); return file.toURI(); } | /**
* Get the default application directory. This is '.\config\<organisation>\'
* @param aieon
* @return
*/ | Get the default application directory. This is '.\config\\' | getDefaultApplicationDir | {
"repo_name": "condast/AieonF",
"path": "Workspace/org.aieonf.orientdb/src/org/aieonf/orientdb/OrientGraphContextAieon.java",
"license": "apache-2.0",
"size": 1956
} | [
"java.io.File",
"org.aieonf.concept.context.IContextAieon",
"org.eclipse.core.runtime.Platform",
"org.eclipse.osgi.service.datalocation.Location"
] | import java.io.File; import org.aieonf.concept.context.IContextAieon; import org.eclipse.core.runtime.Platform; import org.eclipse.osgi.service.datalocation.Location; | import java.io.*; import org.aieonf.concept.context.*; import org.eclipse.core.runtime.*; import org.eclipse.osgi.service.datalocation.*; | [
"java.io",
"org.aieonf.concept",
"org.eclipse.core",
"org.eclipse.osgi"
] | java.io; org.aieonf.concept; org.eclipse.core; org.eclipse.osgi; | 2,724,521 |
public static void setIsJavaRecordWriter(JobConf conf, boolean value) {
conf.setBoolean(Submitter.IS_JAVA_RW, value);
} | static void function(JobConf conf, boolean value) { conf.setBoolean(Submitter.IS_JAVA_RW, value); } | /**
* Set whether the job will use a Java RecordWriter.
* @param conf the configuration to modify
* @param value the new value to set
*/ | Set whether the job will use a Java RecordWriter | setIsJavaRecordWriter | {
"repo_name": "apache/hadoop-mapreduce",
"path": "src/java/org/apache/hadoop/mapred/pipes/Submitter.java",
"license": "apache-2.0",
"size": 19474
} | [
"org.apache.hadoop.mapred.JobConf"
] | import org.apache.hadoop.mapred.JobConf; | import org.apache.hadoop.mapred.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 338,850 |
private Object
getMatch(EntryRep tmpl, Transaction tr, long timeout, boolean takeIt,
boolean ifExists, QueryCookie queryCookieFromClient)
throws RemoteException, InterruptedException, TransactionException
{
typeCheck(tmpl);
checkTimeout(timeout);
// after this time, can stop looking
final long startTime = System.currentTimeMillis();
final long endTime; // when should we stop?
if (Long.MAX_VALUE - timeout <= startTime)
endTime = Long.MAX_VALUE; // If we would overflow, pin to MAX_VALUE
else
endTime = startTime + timeout;
// We get the txn object here, but we'll not check the validity
// of the transaction state until later...
Txn txn = enterTxn(tr);
// Take a quick peek to see if the transaction has already closed.
// If it has, then bail. NB: We must do this check again when we've
// found a candidate match (much deeper in the code).
if (txn != null) {
synchronized(txn) {
if (txn.getState() != ACTIVE)
throw throwNewCannotJoinException();
}
}
final OperationJournal.TransitionIterator transitionIterator =
operationJournal.newTransitionIterator();
// We use a distinguished EntryRep for the null template
if (tmpl == null)
tmpl = EntryRep.matchAnyEntryRep();
EntryHandle handle = null;
final Set conflictSet = new java.util.HashSet();
final Set lockedEntrySet =
(ifExists?new java.util.HashSet():null);
final WeakHashMap provisionallyRemovedEntrySet =
new java.util.WeakHashMap();
handle = find(tmpl, txn, takeIt, conflictSet, lockedEntrySet,
provisionallyRemovedEntrySet);
opsLogger.log(Level.FINEST, "getMatch, initial search found {0}", handle);
if (handle != null) { // found it
if (takeIt)
return completeTake(handle, txn);
else
return handle.rep();
}
if (opsLogger.isLoggable(Level.FINEST)) {
opsLogger.log(Level.FINEST, "{0} conflicts, endTime = {1}",
new Object[] {Integer.valueOf(conflictSet.size()),
Long.valueOf(endTime)});
}
final OutriggerQueryCookie queryCookie;
if (queryCookieFromClient == null ||
!(queryCookieFromClient instanceof OutriggerQueryCookie))
{
queryCookie = new OutriggerQueryCookie(startTime);
} else {
queryCookie = (OutriggerQueryCookie)queryCookieFromClient;
}
final long time = System.currentTimeMillis();
if (time >= endTime) {
monitor(conflictSet);
// Make sure the removal of any provisionally removed
// entries are committed to disk before failing the query
waitOnProvisionallyRemovedEntries(provisionallyRemovedEntrySet);
return queryCookie;
}
final SingletonQueryWatcher watcher;
final long startOrdinal =
transitionIterator.currentOrdinalAtCreation();
if (!ifExists && !takeIt && txn == null) {
watcher =
new ReadWatcher(endTime, queryCookie.startTime,
startOrdinal);
} else if (ifExists && !takeIt) {
if (txn == null) {
watcher = new ReadIfExistsWatcher(endTime, queryCookie.startTime,
startOrdinal, lockedEntrySet);
} else {
watcher = new TransactableReadIfExistsWatcher(endTime,
queryCookie.startTime, startOrdinal, lockedEntrySet,
provisionallyRemovedEntrySet, txn);
}
} else if (!ifExists && (takeIt || txn != null)) {
watcher = new ConsumingWatcher(endTime, queryCookie.startTime,
startOrdinal, provisionallyRemovedEntrySet, txn, takeIt);
} else if (ifExists && takeIt) {
watcher = new TakeIfExistsWatcher(endTime,
queryCookie.startTime, startOrdinal, lockedEntrySet,
provisionallyRemovedEntrySet, txn);
} else {
throw new AssertionError("Can't create watcher for query");
}
if (txn != null) {
synchronized(txn) {
if (txn.getState() != ACTIVE)
throw throwNewCannotJoinException();
txn.add((Transactable)watcher);
}
}
monitor(watcher, conflictSet);
templates.add(watcher, tmpl);
transitionIterator.watcherRegistered();
final String tmplClass = tmpl.classFor();
for (EntryTransition i = transitionIterator.next();
i != null;
i = transitionIterator.next())
{
final EntryRep rep = i.getHandle().rep();
if (rep.isAtLeastA(tmplClass) && tmpl.matches(rep)) {
// Match! - Need to process
if (watcher.catchUp(i, time)) {
break;
}
}
}
if (ifExists)
operationJournal.markCaughtUp((IfExistsWatcher)watcher);
watcher.waitOnResolution();
handle = watcher.resolvedWithEntry();
if (handle != null) { // got one
if (takeIt)
return completeTake(handle, txn);
else
return handle.rep();
}
final Throwable t = watcher.resolvedWithThrowable();
if (t != null) {
if (opsLogger.isLoggable(Levels.FAILED))
opsLogger.log(Levels.FAILED, t.getMessage(), t);
if (t instanceof RemoteException)
throw (RemoteException)t;
if (t instanceof InterruptedException)
throw (InterruptedException)t;
if (t instanceof TransactionException)
throw (TransactionException)t;
if (t instanceof RuntimeException)
throw (RuntimeException)t;
if (t instanceof Error)
throw (Error)t;
throw new InternalSpaceException(
"Query threw unexpected exception", t);
}
// Before returning nothing, make sure all pending removal
// have been logged.
waitOnProvisionallyRemovedEntries(provisionallyRemovedEntrySet);
if (ifExists && ((IfExistsWatcher)watcher).isLockedEntrySetEmpty())
return null;
return queryCookie;
} | Object function(EntryRep tmpl, Transaction tr, long timeout, boolean takeIt, boolean ifExists, QueryCookie queryCookieFromClient) throws RemoteException, InterruptedException, TransactionException { typeCheck(tmpl); checkTimeout(timeout); final long startTime = System.currentTimeMillis(); final long endTime; if (Long.MAX_VALUE - timeout <= startTime) endTime = Long.MAX_VALUE; else endTime = startTime + timeout; Txn txn = enterTxn(tr); if (txn != null) { synchronized(txn) { if (txn.getState() != ACTIVE) throw throwNewCannotJoinException(); } } final OperationJournal.TransitionIterator transitionIterator = operationJournal.newTransitionIterator(); if (tmpl == null) tmpl = EntryRep.matchAnyEntryRep(); EntryHandle handle = null; final Set conflictSet = new java.util.HashSet(); final Set lockedEntrySet = (ifExists?new java.util.HashSet():null); final WeakHashMap provisionallyRemovedEntrySet = new java.util.WeakHashMap(); handle = find(tmpl, txn, takeIt, conflictSet, lockedEntrySet, provisionallyRemovedEntrySet); opsLogger.log(Level.FINEST, STR, handle); if (handle != null) { if (takeIt) return completeTake(handle, txn); else return handle.rep(); } if (opsLogger.isLoggable(Level.FINEST)) { opsLogger.log(Level.FINEST, STR, new Object[] {Integer.valueOf(conflictSet.size()), Long.valueOf(endTime)}); } final OutriggerQueryCookie queryCookie; if (queryCookieFromClient == null !(queryCookieFromClient instanceof OutriggerQueryCookie)) { queryCookie = new OutriggerQueryCookie(startTime); } else { queryCookie = (OutriggerQueryCookie)queryCookieFromClient; } final long time = System.currentTimeMillis(); if (time >= endTime) { monitor(conflictSet); waitOnProvisionallyRemovedEntries(provisionallyRemovedEntrySet); return queryCookie; } final SingletonQueryWatcher watcher; final long startOrdinal = transitionIterator.currentOrdinalAtCreation(); if (!ifExists && !takeIt && txn == null) { watcher = new ReadWatcher(endTime, queryCookie.startTime, startOrdinal); } else if (ifExists && !takeIt) { if (txn == null) { watcher = new ReadIfExistsWatcher(endTime, queryCookie.startTime, startOrdinal, lockedEntrySet); } else { watcher = new TransactableReadIfExistsWatcher(endTime, queryCookie.startTime, startOrdinal, lockedEntrySet, provisionallyRemovedEntrySet, txn); } } else if (!ifExists && (takeIt txn != null)) { watcher = new ConsumingWatcher(endTime, queryCookie.startTime, startOrdinal, provisionallyRemovedEntrySet, txn, takeIt); } else if (ifExists && takeIt) { watcher = new TakeIfExistsWatcher(endTime, queryCookie.startTime, startOrdinal, lockedEntrySet, provisionallyRemovedEntrySet, txn); } else { throw new AssertionError(STR); } if (txn != null) { synchronized(txn) { if (txn.getState() != ACTIVE) throw throwNewCannotJoinException(); txn.add((Transactable)watcher); } } monitor(watcher, conflictSet); templates.add(watcher, tmpl); transitionIterator.watcherRegistered(); final String tmplClass = tmpl.classFor(); for (EntryTransition i = transitionIterator.next(); i != null; i = transitionIterator.next()) { final EntryRep rep = i.getHandle().rep(); if (rep.isAtLeastA(tmplClass) && tmpl.matches(rep)) { if (watcher.catchUp(i, time)) { break; } } } if (ifExists) operationJournal.markCaughtUp((IfExistsWatcher)watcher); watcher.waitOnResolution(); handle = watcher.resolvedWithEntry(); if (handle != null) { if (takeIt) return completeTake(handle, txn); else return handle.rep(); } final Throwable t = watcher.resolvedWithThrowable(); if (t != null) { if (opsLogger.isLoggable(Levels.FAILED)) opsLogger.log(Levels.FAILED, t.getMessage(), t); if (t instanceof RemoteException) throw (RemoteException)t; if (t instanceof InterruptedException) throw (InterruptedException)t; if (t instanceof TransactionException) throw (TransactionException)t; if (t instanceof RuntimeException) throw (RuntimeException)t; if (t instanceof Error) throw (Error)t; throw new InternalSpaceException( STR, t); } waitOnProvisionallyRemovedEntries(provisionallyRemovedEntrySet); if (ifExists && ((IfExistsWatcher)watcher).isLockedEntrySetEmpty()) return null; return queryCookie; } | /**
* Do the heavy lifting for queries. Find a match,
* optionally taking it, blocking as appropriate
* if a match can't be initially found.
* @param tmpl The template for the query, may be <code>null</code>
* if all entries match.
* @param tr The transaction the query is being performed under,
* or <code>null</code> if there is no transaction.
* @param timeout Maxium time to block in milliseconds.
* @param takeIt <code>true</code> if the entry found is
* to be removed.
* @param ifExists <code>true</code> if this query is to follow
* the rules for ifExists queries.
* @param queryCookieFromClient If this call is a continuation of
* an earlier query, the cookie from the
* last sub-query.
* @throws RemoteException if a network failure occurs.
* @throws TransactionException if there is a problem
* with the specified transaction such as
* it can not be joined, or leaves the active
* state before the call is complete.
* @throws InterruptedException if the thread in the server
* is interrupted before the query can be completed.
* @throws SecurityException if the server decides
* the caller has insufficient privilege to carry
* out the operation.
* @throws IllegalArgumentException if a negative timeout value is used
* @throws InternalSpaceException if there is an internal problem
* with the server.
*/ | Do the heavy lifting for queries. Find a match, optionally taking it, blocking as appropriate if a match can't be initially found | getMatch | {
"repo_name": "cdegroot/river",
"path": "src/com/sun/jini/outrigger/OutriggerServerImpl.java",
"license": "apache-2.0",
"size": 121997
} | [
"com.sun.jini.logging.Levels",
"java.rmi.RemoteException",
"java.util.Set",
"java.util.WeakHashMap",
"java.util.logging.Level",
"net.jini.core.transaction.Transaction",
"net.jini.core.transaction.TransactionException",
"net.jini.space.InternalSpaceException"
] | import com.sun.jini.logging.Levels; import java.rmi.RemoteException; import java.util.Set; import java.util.WeakHashMap; import java.util.logging.Level; import net.jini.core.transaction.Transaction; import net.jini.core.transaction.TransactionException; import net.jini.space.InternalSpaceException; | import com.sun.jini.logging.*; import java.rmi.*; import java.util.*; import java.util.logging.*; import net.jini.core.transaction.*; import net.jini.space.*; | [
"com.sun.jini",
"java.rmi",
"java.util",
"net.jini.core",
"net.jini.space"
] | com.sun.jini; java.rmi; java.util; net.jini.core; net.jini.space; | 803,338 |
public GryoMapper create() {
// consult the registry if provided and inject registry entries as custom classes.
registries.forEach(registry -> {
final List<Pair<Class, Object>> serializers = registry.find(GryoIo.class);
serializers.forEach(p -> {
if (null == p.getValue1())
addCustom(p.getValue0());
else if (p.getValue1() instanceof Serializer)
addCustom(p.getValue0(), (Serializer) p.getValue1());
else if (p.getValue1() instanceof Function)
addCustom(p.getValue0(), (Function<Kryo, Serializer>) p.getValue1());
else
throw new IllegalStateException(String.format(
"Unexpected value provided by %s for serializable class %s - expected a parameter in [null, %s implementation or Function<%s, %s>], but received %s",
registry.getClass().getSimpleName(), p.getValue0().getClass().getCanonicalName(),
Serializer.class.getName(), Kryo.class.getSimpleName(),
Serializer.class.getSimpleName(), p.getValue1()));
});
});
return new GryoMapper(this);
} | GryoMapper function() { registries.forEach(registry -> { final List<Pair<Class, Object>> serializers = registry.find(GryoIo.class); serializers.forEach(p -> { if (null == p.getValue1()) addCustom(p.getValue0()); else if (p.getValue1() instanceof Serializer) addCustom(p.getValue0(), (Serializer) p.getValue1()); else if (p.getValue1() instanceof Function) addCustom(p.getValue0(), (Function<Kryo, Serializer>) p.getValue1()); else throw new IllegalStateException(String.format( STR, registry.getClass().getSimpleName(), p.getValue0().getClass().getCanonicalName(), Serializer.class.getName(), Kryo.class.getSimpleName(), Serializer.class.getSimpleName(), p.getValue1())); }); }); return new GryoMapper(this); } | /**
* Creates a {@code GryoMapper}.
*/ | Creates a GryoMapper | create | {
"repo_name": "newkek/incubator-tinkerpop",
"path": "gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoMapper.java",
"license": "apache-2.0",
"size": 31608
} | [
"java.util.List",
"java.util.function.Function",
"org.apache.tinkerpop.shaded.kryo.Kryo",
"org.apache.tinkerpop.shaded.kryo.Serializer",
"org.javatuples.Pair"
] | import java.util.List; import java.util.function.Function; import org.apache.tinkerpop.shaded.kryo.Kryo; import org.apache.tinkerpop.shaded.kryo.Serializer; import org.javatuples.Pair; | import java.util.*; import java.util.function.*; import org.apache.tinkerpop.shaded.kryo.*; import org.javatuples.*; | [
"java.util",
"org.apache.tinkerpop",
"org.javatuples"
] | java.util; org.apache.tinkerpop; org.javatuples; | 108,498 |
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
SocialAccountInformation socialAccountInformation = (SocialAccountInformation) o;
return Objects.equals(this.email, socialAccountInformation.email) &&
Objects.equals(this.errorDetails, socialAccountInformation.errorDetails) &&
Objects.equals(this.provider, socialAccountInformation.provider) &&
Objects.equals(this.socialId, socialAccountInformation.socialId) &&
Objects.equals(this.userName, socialAccountInformation.userName);
} | boolean function(java.lang.Object o) { if (this == o) { return true; } if (o == null getClass() != o.getClass()) { return false; } SocialAccountInformation socialAccountInformation = (SocialAccountInformation) o; return Objects.equals(this.email, socialAccountInformation.email) && Objects.equals(this.errorDetails, socialAccountInformation.errorDetails) && Objects.equals(this.provider, socialAccountInformation.provider) && Objects.equals(this.socialId, socialAccountInformation.socialId) && Objects.equals(this.userName, socialAccountInformation.userName); } | /**
* Compares objects.
*
* @return true or false depending on comparison result.
*/ | Compares objects | equals | {
"repo_name": "docusign/docusign-java-client",
"path": "src/main/java/com/docusign/esign/model/SocialAccountInformation.java",
"license": "mit",
"size": 5117
} | [
"java.util.Objects"
] | import java.util.Objects; | import java.util.*; | [
"java.util"
] | java.util; | 2,510,620 |
public FormatterEngine newFormatterEngine(FormatterConfiguration config, PagedMediaWriter writer);
public default void setCreatedWithSPI(){} | FormatterEngine function(FormatterConfiguration config, PagedMediaWriter writer); public default void setCreatedWithSPI(){} | /**
* Returns a new FormatterEngine configured with the specified configuration and output writer
* @param config the configuration
* @param writer the output writer
* @return returns a new instance
*/ | Returns a new FormatterEngine configured with the specified configuration and output writer | newFormatterEngine | {
"repo_name": "daisy/pipeline-issues",
"path": "libs/dotify/dotify.api/src/org/daisy/dotify/api/engine/FormatterEngineFactoryService.java",
"license": "apache-2.0",
"size": 2220
} | [
"org.daisy.dotify.api.formatter.FormatterConfiguration",
"org.daisy.dotify.api.writer.PagedMediaWriter"
] | import org.daisy.dotify.api.formatter.FormatterConfiguration; import org.daisy.dotify.api.writer.PagedMediaWriter; | import org.daisy.dotify.api.formatter.*; import org.daisy.dotify.api.writer.*; | [
"org.daisy.dotify"
] | org.daisy.dotify; | 241,856 |
private synchronized void loadTable() {
// prevents racing condition
if (this.mtable.getPageCount() > 0) {
return;
}
// make sure we at least have one page
ScanResult sr = this.stable.scan(0, 0, 0);
this.mtable.grow(KeyBytes.getMinKey());
// load table content
long count = 0;
while (sr.next()) {
if (this.mtable.getType() == TableType.DATA) {
Row row = sr.getRow();
this.mtable.put(row);
}
else {
long pIndexKey = sr.getKeyPointer();
long pRowKey = sr.getIndexRowKeyPointer();
byte misc = sr.getMisc();
this.mtable.putIndex(pIndexKey, pRowKey, misc);
}
count++;
}
sr.close();
this.cache.cacheMiss();
_log.debug("{} records are fully cached for table {}", count, getId());
} | synchronized void function() { if (this.mtable.getPageCount() > 0) { return; } ScanResult sr = this.stable.scan(0, 0, 0); this.mtable.grow(KeyBytes.getMinKey()); long count = 0; while (sr.next()) { if (this.mtable.getType() == TableType.DATA) { Row row = sr.getRow(); this.mtable.put(row); } else { long pIndexKey = sr.getKeyPointer(); long pRowKey = sr.getIndexRowKeyPointer(); byte misc = sr.getMisc(); this.mtable.putIndex(pIndexKey, pRowKey, misc); } count++; } sr.close(); this.cache.cacheMiss(); _log.debug(STR, count, getId()); } | /**
* load the entire table content from backend
*/ | load the entire table content from backend | loadTable | {
"repo_name": "waterguo/antsdb",
"path": "fish-server/src/main/java/com/antsdb/saltedfish/minke/MinkeCacheTable.java",
"license": "lgpl-3.0",
"size": 16030
} | [
"com.antsdb.saltedfish.cpp.KeyBytes",
"com.antsdb.saltedfish.nosql.Row",
"com.antsdb.saltedfish.nosql.ScanResult",
"com.antsdb.saltedfish.nosql.TableType"
] | import com.antsdb.saltedfish.cpp.KeyBytes; import com.antsdb.saltedfish.nosql.Row; import com.antsdb.saltedfish.nosql.ScanResult; import com.antsdb.saltedfish.nosql.TableType; | import com.antsdb.saltedfish.cpp.*; import com.antsdb.saltedfish.nosql.*; | [
"com.antsdb.saltedfish"
] | com.antsdb.saltedfish; | 1,708,769 |
@Test
public void testInsert() {
JsonObject[] jsonObjects = this.createJsonObjects(5);
J array = this.createUnderlyingJsonArray();
JsonObjectArray<JsonObject> testJsonObjectArray = this.createJsonObjectArray(array);
for (int i = 0, j = 0; i < 5; i++) {
if (i != 1) {
testJsonObjectArray.set(j++, jsonObjects[i]);
}
}
testJsonObjectArray.insert(1, jsonObjects[1]);
assertEquals("array.length", 5, this.getArrayLength(array));
for (int i = 0; i < 5; i++) {
assertEquals("array[" + i + "]", jsonObjects[i].getObject(), this.getObjectElement(array, i));
}
} | void function() { JsonObject[] jsonObjects = this.createJsonObjects(5); J array = this.createUnderlyingJsonArray(); JsonObjectArray<JsonObject> testJsonObjectArray = this.createJsonObjectArray(array); for (int i = 0, j = 0; i < 5; i++) { if (i != 1) { testJsonObjectArray.set(j++, jsonObjects[i]); } } testJsonObjectArray.insert(1, jsonObjects[1]); assertEquals(STR, 5, this.getArrayLength(array)); for (int i = 0; i < 5; i++) { assertEquals(STR + i + "]", jsonObjects[i].getObject(), this.getObjectElement(array, i)); } } | /**
* Test the insertion of an element of the array.
* <p>
* This test asserts that inserting an element inserts an element at the
* corresponding index of the underlying array.
*/ | Test the insertion of an element of the array. This test asserts that inserting an element inserts an element at the corresponding index of the underlying array | testInsert | {
"repo_name": "kjots/json-toolkit",
"path": "json-object.shared/src/test/java/org/kjots/json/object/shared/impl/JsonObjectArrayImplTestBase.java",
"license": "apache-2.0",
"size": 8446
} | [
"junit.framework.Assert",
"org.kjots.json.object.shared.JsonObject",
"org.kjots.json.object.shared.JsonObjectArray"
] | import junit.framework.Assert; import org.kjots.json.object.shared.JsonObject; import org.kjots.json.object.shared.JsonObjectArray; | import junit.framework.*; import org.kjots.json.object.shared.*; | [
"junit.framework",
"org.kjots.json"
] | junit.framework; org.kjots.json; | 2,069,276 |
EAttribute getAirCompressor_AirCompressorRating(); | EAttribute getAirCompressor_AirCompressorRating(); | /**
* Returns the meta object for the attribute '{@link CIM.IEC61970.Generation.Production.AirCompressor#getAirCompressorRating <em>Air Compressor Rating</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the attribute '<em>Air Compressor Rating</em>'.
* @see CIM.IEC61970.Generation.Production.AirCompressor#getAirCompressorRating()
* @see #getAirCompressor()
* @generated
*/ | Returns the meta object for the attribute '<code>CIM.IEC61970.Generation.Production.AirCompressor#getAirCompressorRating Air Compressor Rating</code>'. | getAirCompressor_AirCompressorRating | {
"repo_name": "georghinkel/ttc2017smartGrids",
"path": "solutions/ModelJoin/src/main/java/CIM/IEC61970/Generation/Production/ProductionPackage.java",
"license": "mit",
"size": 499866
} | [
"org.eclipse.emf.ecore.EAttribute"
] | import org.eclipse.emf.ecore.EAttribute; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 806,837 |
public void buildTypeInformation(HostedUniverse hUniverse) {
hUniverse.orderedTypes = heightOrderedTypes;
ImageSingletons.lookup(DynamicHubSupport.class).setMaxTypeId(heightOrderedTypes.size());
for (int i = 0; i < heightOrderedTypes.size(); i++) {
HostedType type = heightOrderedTypes.get(i);
type.typeID = i;
assert subtypeMap.containsKey(type);
type.subTypes = subtypeMap.get(type).toArray(new HostedType[0]);
}
for (int i = heightOrderedTypes.size() - 1; i >= 0; i--) {
HostedType type = heightOrderedTypes.get(i);
HostedType subtypeStampType = null;
for (HostedType child : subtypeMap.get(type)) {
if (child.strengthenStampType != null) {
if (subtypeStampType != null && !subtypeStampType.equals(child.strengthenStampType)) {
subtypeStampType = type;
break;
} else {
subtypeStampType = child.strengthenStampType;
}
}
}
boolean isInstantiated = type.getWrapped().isInstantiated();
assert !isInstantiated ||
((type.isInstanceClass() &&
!Modifier.isAbstract(type.getModifiers())) || type.isArray());
if (subtypeStampType == null) {
if (isInstantiated) {
type.strengthenStampType = type;
type.uniqueConcreteImplementation = type.isWordType() ? null : type;
} else {
type.strengthenStampType = null;
type.uniqueConcreteImplementation = null;
}
} else if (subtypeStampType.equals(type)) {
type.strengthenStampType = type;
type.uniqueConcreteImplementation = null;
} else {
if (isInstantiated) {
type.strengthenStampType = type;
type.uniqueConcreteImplementation = null;
} else {
type.strengthenStampType = subtypeStampType;
type.uniqueConcreteImplementation = subtypeStampType.uniqueConcreteImplementation;
}
}
}
} | void function(HostedUniverse hUniverse) { hUniverse.orderedTypes = heightOrderedTypes; ImageSingletons.lookup(DynamicHubSupport.class).setMaxTypeId(heightOrderedTypes.size()); for (int i = 0; i < heightOrderedTypes.size(); i++) { HostedType type = heightOrderedTypes.get(i); type.typeID = i; assert subtypeMap.containsKey(type); type.subTypes = subtypeMap.get(type).toArray(new HostedType[0]); } for (int i = heightOrderedTypes.size() - 1; i >= 0; i--) { HostedType type = heightOrderedTypes.get(i); HostedType subtypeStampType = null; for (HostedType child : subtypeMap.get(type)) { if (child.strengthenStampType != null) { if (subtypeStampType != null && !subtypeStampType.equals(child.strengthenStampType)) { subtypeStampType = type; break; } else { subtypeStampType = child.strengthenStampType; } } } boolean isInstantiated = type.getWrapped().isInstantiated(); assert !isInstantiated ((type.isInstanceClass() && !Modifier.isAbstract(type.getModifiers())) type.isArray()); if (subtypeStampType == null) { if (isInstantiated) { type.strengthenStampType = type; type.uniqueConcreteImplementation = type.isWordType() ? null : type; } else { type.strengthenStampType = null; type.uniqueConcreteImplementation = null; } } else if (subtypeStampType.equals(type)) { type.strengthenStampType = type; type.uniqueConcreteImplementation = null; } else { if (isInstantiated) { type.strengthenStampType = type; type.uniqueConcreteImplementation = null; } else { type.strengthenStampType = subtypeStampType; type.uniqueConcreteImplementation = subtypeStampType.uniqueConcreteImplementation; } } } } | /**
* This method set's the universe's orderedType collection, and for each HostedType, sets the
* following fields:
* <ul>
* <li>typeID</li>
* <li>subTypes</li>
* <li>strengthenStampType</li>
* <li>uniqueConcreteImplementation</li>
* </ul>
*
* The stamps are calculated by performing a dataflow analysis of the {@link #subtypeMap}.
*/ | This method set's the universe's orderedType collection, and for each HostedType, sets the following fields: typeID subTypes strengthenStampType uniqueConcreteImplementation The stamps are calculated by performing a dataflow analysis of the <code>#subtypeMap</code> | buildTypeInformation | {
"repo_name": "smarr/Truffle",
"path": "substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/meta/TypeCheckBuilder.java",
"license": "gpl-2.0",
"size": 80738
} | [
"com.oracle.svm.core.hub.DynamicHubSupport",
"java.lang.reflect.Modifier",
"org.graalvm.nativeimage.ImageSingletons"
] | import com.oracle.svm.core.hub.DynamicHubSupport; import java.lang.reflect.Modifier; import org.graalvm.nativeimage.ImageSingletons; | import com.oracle.svm.core.hub.*; import java.lang.reflect.*; import org.graalvm.nativeimage.*; | [
"com.oracle.svm",
"java.lang",
"org.graalvm.nativeimage"
] | com.oracle.svm; java.lang; org.graalvm.nativeimage; | 2,527,224 |
boolean onTouchEvent(MotionEvent event); | boolean onTouchEvent(MotionEvent event); | /**
* Allows the controller to handle a touch event.
*
* @param event the touch event
* @return whether the controller handled the event
*/ | Allows the controller to handle a touch event | onTouchEvent | {
"repo_name": "biezhihua/FrescoStudy",
"path": "samples/zoomable/src/main/java/com/facebook/samples/zoomable/ZoomableController.java",
"license": "bsd-3-clause",
"size": 2700
} | [
"android.view.MotionEvent"
] | import android.view.MotionEvent; | import android.view.*; | [
"android.view"
] | android.view; | 1,109,409 |
public static void metaScan(Configuration configuration, HConnection connection,
MetaScannerVisitor visitor, byte [] tableName, byte[] row,
int rowLimit, final byte [] metaTableName)
throws IOException {
HTable metaTable = null;
try {
if (connection == null) {
metaTable = new HTable(configuration, HConstants.META_TABLE_NAME, null);
} else {
metaTable = new HTable(HConstants.META_TABLE_NAME, connection, null);
}
int rowUpperLimit = rowLimit > 0 ? rowLimit: Integer.MAX_VALUE;
// if row is not null, we want to use the startKey of the row's region as
// the startRow for the meta scan.
byte[] startRow;
if (row != null) {
// Scan starting at a particular row in a particular table
assert tableName != null;
byte[] searchRow =
HRegionInfo.createRegionName(tableName, row, HConstants.NINES,
false);
Result startRowResult = metaTable.getRowOrBefore(searchRow,
HConstants.CATALOG_FAMILY);
if (startRowResult == null) {
throw new TableNotFoundException("Cannot find row in .META. for table: "
+ Bytes.toString(tableName) + ", row=" + Bytes.toStringBinary(searchRow));
}
byte[] value = startRowResult.getValue(HConstants.CATALOG_FAMILY,
HConstants.REGIONINFO_QUALIFIER);
if (value == null || value.length == 0) {
throw new IOException("HRegionInfo was null or empty in Meta for " +
Bytes.toString(tableName) + ", row=" + Bytes.toStringBinary(searchRow));
}
HRegionInfo regionInfo = Writables.getHRegionInfo(value);
byte[] rowBefore = regionInfo.getStartKey();
startRow = HRegionInfo.createRegionName(tableName, rowBefore,
HConstants.ZEROES, false);
} else if (tableName == null || tableName.length == 0) {
// Full META scan
startRow = HConstants.EMPTY_START_ROW;
} else {
// Scan META for an entire table
startRow = HRegionInfo.createRegionName(
tableName, HConstants.EMPTY_START_ROW, HConstants.ZEROES, false);
}
// Scan over each meta region
ScannerCallable callable;
int rows = Math.min(rowLimit, configuration.getInt(
HConstants.HBASE_META_SCANNER_CACHING,
HConstants.DEFAULT_HBASE_META_SCANNER_CACHING));
do {
final Scan scan = new Scan(startRow).addFamily(HConstants.CATALOG_FAMILY);
if (LOG.isDebugEnabled()) {
LOG.debug("Scanning " + Bytes.toString(metaTableName) +
" starting at row=" + Bytes.toStringBinary(startRow) + " for max=" +
rowUpperLimit + " rows using " + metaTable.getConnection().toString());
}
callable = new ScannerCallable(metaTable.getConnection(), metaTableName, scan, null);
// Open scanner
callable.withRetries();
int processedRows = 0;
try {
callable.setCaching(rows);
done: do {
if (processedRows >= rowUpperLimit) {
break;
}
//we have all the rows here
Result [] rrs = callable.withRetries();
if (rrs == null || rrs.length == 0 || rrs[0].size() == 0) {
break; //exit completely
}
for (Result rr : rrs) {
if (processedRows >= rowUpperLimit) {
break done;
}
if (!visitor.processRow(rr))
break done; //exit completely
processedRows++;
}
//here, we didn't break anywhere. Check if we have more rows
} while(true);
// Advance the startRow to the end key of the current region
startRow = callable.getHRegionInfo().getEndKey();
} finally {
// Close scanner
callable.setClose();
callable.withRetries();
}
} while (Bytes.compareTo(startRow, HConstants.LAST_ROW) != 0);
} finally {
visitor.close();
if (metaTable != null) {
metaTable.close();
}
}
} | static void function(Configuration configuration, HConnection connection, MetaScannerVisitor visitor, byte [] tableName, byte[] row, int rowLimit, final byte [] metaTableName) throws IOException { HTable metaTable = null; try { if (connection == null) { metaTable = new HTable(configuration, HConstants.META_TABLE_NAME, null); } else { metaTable = new HTable(HConstants.META_TABLE_NAME, connection, null); } int rowUpperLimit = rowLimit > 0 ? rowLimit: Integer.MAX_VALUE; byte[] startRow; if (row != null) { assert tableName != null; byte[] searchRow = HRegionInfo.createRegionName(tableName, row, HConstants.NINES, false); Result startRowResult = metaTable.getRowOrBefore(searchRow, HConstants.CATALOG_FAMILY); if (startRowResult == null) { throw new TableNotFoundException(STR + Bytes.toString(tableName) + STR + Bytes.toStringBinary(searchRow)); } byte[] value = startRowResult.getValue(HConstants.CATALOG_FAMILY, HConstants.REGIONINFO_QUALIFIER); if (value == null value.length == 0) { throw new IOException(STR + Bytes.toString(tableName) + STR + Bytes.toStringBinary(searchRow)); } HRegionInfo regionInfo = Writables.getHRegionInfo(value); byte[] rowBefore = regionInfo.getStartKey(); startRow = HRegionInfo.createRegionName(tableName, rowBefore, HConstants.ZEROES, false); } else if (tableName == null tableName.length == 0) { startRow = HConstants.EMPTY_START_ROW; } else { startRow = HRegionInfo.createRegionName( tableName, HConstants.EMPTY_START_ROW, HConstants.ZEROES, false); } ScannerCallable callable; int rows = Math.min(rowLimit, configuration.getInt( HConstants.HBASE_META_SCANNER_CACHING, HConstants.DEFAULT_HBASE_META_SCANNER_CACHING)); do { final Scan scan = new Scan(startRow).addFamily(HConstants.CATALOG_FAMILY); if (LOG.isDebugEnabled()) { LOG.debug(STR + Bytes.toString(metaTableName) + STR + Bytes.toStringBinary(startRow) + STR + rowUpperLimit + STR + metaTable.getConnection().toString()); } callable = new ScannerCallable(metaTable.getConnection(), metaTableName, scan, null); callable.withRetries(); int processedRows = 0; try { callable.setCaching(rows); done: do { if (processedRows >= rowUpperLimit) { break; } Result [] rrs = callable.withRetries(); if (rrs == null rrs.length == 0 rrs[0].size() == 0) { break; } for (Result rr : rrs) { if (processedRows >= rowUpperLimit) { break done; } if (!visitor.processRow(rr)) break done; processedRows++; } } while(true); startRow = callable.getHRegionInfo().getEndKey(); } finally { callable.setClose(); callable.withRetries(); } } while (Bytes.compareTo(startRow, HConstants.LAST_ROW) != 0); } finally { visitor.close(); if (metaTable != null) { metaTable.close(); } } } | /**
* Scans the meta table and calls a visitor on each RowResult. Uses a table
* name and a row name to locate meta regions. And it only scans at most
* <code>rowLimit</code> of rows.
*
* @param configuration HBase configuration.
* @param connection connection to be used internally (null not allowed)
* @param visitor Visitor object. Closes the visitor before returning.
* @param tableName User table name in meta table to start scan at. Pass
* null if not interested in a particular table.
* @param row Name of the row at the user table. The scan will start from
* the region row where the row resides.
* @param rowLimit Max of processed rows. If it is less than 0, it
* will be set to default value <code>Integer.MAX_VALUE</code>.
* @param metaTableName Meta table to scan, root or meta.
* @throws IOException e
*/ | Scans the meta table and calls a visitor on each RowResult. Uses a table name and a row name to locate meta regions. And it only scans at most <code>rowLimit</code> of rows | metaScan | {
"repo_name": "wanhao/IRIndex",
"path": "src/main/java/org/apache/hadoop/hbase/client/MetaScanner.java",
"license": "apache-2.0",
"size": 20879
} | [
"java.io.IOException",
"org.apache.hadoop.conf.Configuration",
"org.apache.hadoop.hbase.HConstants",
"org.apache.hadoop.hbase.HRegionInfo",
"org.apache.hadoop.hbase.TableNotFoundException",
"org.apache.hadoop.hbase.util.Bytes",
"org.apache.hadoop.hbase.util.Writables"
] | import java.io.IOException; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.HRegionInfo; import org.apache.hadoop.hbase.TableNotFoundException; import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.hbase.util.Writables; | import java.io.*; import org.apache.hadoop.conf.*; import org.apache.hadoop.hbase.*; import org.apache.hadoop.hbase.util.*; | [
"java.io",
"org.apache.hadoop"
] | java.io; org.apache.hadoop; | 1,338,256 |
@XmlElement("expression")
Expression getExpression1(); | @XmlElement(STR) Expression getExpression1(); | /**
* Returns the expression that represents the first (left) value that will be used in the
* computation of another value.
*/ | Returns the expression that represents the first (left) value that will be used in the computation of another value | getExpression1 | {
"repo_name": "geotools/geotools",
"path": "modules/library/opengis/src/main/java/org/opengis/filter/expression/BinaryExpression.java",
"license": "lgpl-2.1",
"size": 1147
} | [
"org.opengis.annotation.XmlElement"
] | import org.opengis.annotation.XmlElement; | import org.opengis.annotation.*; | [
"org.opengis.annotation"
] | org.opengis.annotation; | 809,903 |
public void setName(String name) {
ArgumentChecker.notNull(name, "name");
_name = name;
} | void function(String name) { ArgumentChecker.notNull(name, "name"); _name = name; } | /**
* Sets the name.
*
* @param name the name to set, not null
*/ | Sets the name | setName | {
"repo_name": "DevStreet/FinanceAnalytics",
"path": "projects/OG-Util/src/main/java/com/opengamma/transport/AbstractBatchMessageDispatcher.java",
"license": "apache-2.0",
"size": 5512
} | [
"com.opengamma.util.ArgumentChecker"
] | import com.opengamma.util.ArgumentChecker; | import com.opengamma.util.*; | [
"com.opengamma.util"
] | com.opengamma.util; | 2,495,639 |
public void assignArray(Object source) {
int len = Array.getLength(source);
List<Object> list = new ArrayList<Object>(len);
for (int i = 0; i < len; i++) {
list.add(Array.get(source, i));
}
assign(list);
} | void function(Object source) { int len = Array.getLength(source); List<Object> list = new ArrayList<Object>(len); for (int i = 0; i < len; i++) { list.add(Array.get(source, i)); } assign(list); } | /**
* Copies source values from an input array as integer-indexed vector values.
*
* @param source Source values.
*/ | Copies source values from an input array as integer-indexed vector values | assignArray | {
"repo_name": "carewebframework/carewebframework-vista",
"path": "org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/RPCParameter.java",
"license": "apache-2.0",
"size": 5724
} | [
"java.lang.reflect.Array",
"java.util.ArrayList",
"java.util.List"
] | import java.lang.reflect.Array; import java.util.ArrayList; import java.util.List; | import java.lang.reflect.*; import java.util.*; | [
"java.lang",
"java.util"
] | java.lang; java.util; | 2,239,121 |
protected void updateContents()
{
final Project project = ProdEdit.getInstance().getProjectService().getProject();
if (project != null)
{
// selectionInFunctionalEntities.setList(project.getFunctionalEntities());
// selectionInCatalogEntries.setList(project.getCatalogEntries())
}
} | void function() { final Project project = ProdEdit.getInstance().getProjectService().getProject(); if (project != null) { } } | /**
* Update the contents.
*/ | Update the contents | updateContents | {
"repo_name": "selfbus/development-tools-incubation",
"path": "sbtools-products-editor/src/main/java/org/selfbus/sbtools/prodedit/tabs/prodgroup/general/ApplicationProgramElem.java",
"license": "gpl-3.0",
"size": 6266
} | [
"org.selfbus.sbtools.prodedit.ProdEdit",
"org.selfbus.sbtools.prodedit.model.global.Project"
] | import org.selfbus.sbtools.prodedit.ProdEdit; import org.selfbus.sbtools.prodedit.model.global.Project; | import org.selfbus.sbtools.prodedit.*; import org.selfbus.sbtools.prodedit.model.global.*; | [
"org.selfbus.sbtools"
] | org.selfbus.sbtools; | 1,554,478 |
try {
PrivilegedCarbonContext.startTenantFlow();
this.bundleContext = componentContext.getBundleContext();
if (dataSourceServiceProvided) {
initAttachmentServer();
registerAttachmentDownloadServlet();
registerAttachmentServerService();
}
PrivilegedCarbonContext.endTenantFlow();
} catch (Throwable t) {
log.error("Failed to activate Attachment management bundle", t);
}
if (log.isDebugEnabled()) {
log.debug("Attachment management bundle is activated.");
}
} | try { PrivilegedCarbonContext.startTenantFlow(); this.bundleContext = componentContext.getBundleContext(); if (dataSourceServiceProvided) { initAttachmentServer(); registerAttachmentDownloadServlet(); registerAttachmentServerService(); } PrivilegedCarbonContext.endTenantFlow(); } catch (Throwable t) { log.error(STR, t); } if (log.isDebugEnabled()) { log.debug(STR); } } | /**
* Bundle activation method.
*
* @param componentContext : The component context.
*/ | Bundle activation method | activate | {
"repo_name": "wso2/carbon-business-process",
"path": "components/attachment-mgt/org.wso2.carbon.attachment.mgt/src/main/java/org/wso2/carbon/attachment/mgt/server/internal/AttachmentServiceComponent.java",
"license": "apache-2.0",
"size": 5989
} | [
"org.wso2.carbon.context.PrivilegedCarbonContext"
] | import org.wso2.carbon.context.PrivilegedCarbonContext; | import org.wso2.carbon.context.*; | [
"org.wso2.carbon"
] | org.wso2.carbon; | 1,272,744 |
public void trace(Throwable throwable, String msg, Object arg0) {
logIfEnabled(Level.TRACE, throwable, msg, arg0, UNKNOWN_ARG, UNKNOWN_ARG, null);
} | void function(Throwable throwable, String msg, Object arg0) { logIfEnabled(Level.TRACE, throwable, msg, arg0, UNKNOWN_ARG, UNKNOWN_ARG, null); } | /**
* Log a trace message with a throwable.
*/ | Log a trace message with a throwable | trace | {
"repo_name": "dankito/ormlite-jpa-core",
"path": "src/main/java/com/j256/ormlite/logger/Logger.java",
"license": "isc",
"size": 17794
} | [
"com.j256.ormlite.logger.Log"
] | import com.j256.ormlite.logger.Log; | import com.j256.ormlite.logger.*; | [
"com.j256.ormlite"
] | com.j256.ormlite; | 1,024,500 |
public static Duration newDuration(final String length) {
try {
if (NumberUtils.isCreatable(length)) {
return Duration.ofSeconds(Long.valueOf(length));
}
return Duration.parse(length);
} catch (final Exception e) {
throw Throwables.propagate(e);
}
} | static Duration function(final String length) { try { if (NumberUtils.isCreatable(length)) { return Duration.ofSeconds(Long.valueOf(length)); } return Duration.parse(length); } catch (final Exception e) { throw Throwables.propagate(e); } } | /**
* New duration. If the provided length is duration,
* it will be parsed accordingly, or if it's a numeric value
* it will be pared as a duration assuming it's provided as seconds.
*
* @param length the length in seconds.
* @return the duration
*/ | New duration. If the provided length is duration, it will be parsed accordingly, or if it's a numeric value it will be pared as a duration assuming it's provided as seconds | newDuration | {
"repo_name": "gabedwrds/cas",
"path": "core/cas-server-core-configuration/src/main/java/org/apereo/cas/configuration/support/Beans.java",
"license": "apache-2.0",
"size": 43729
} | [
"com.google.common.base.Throwables",
"java.time.Duration",
"org.apache.commons.lang3.math.NumberUtils"
] | import com.google.common.base.Throwables; import java.time.Duration; import org.apache.commons.lang3.math.NumberUtils; | import com.google.common.base.*; import java.time.*; import org.apache.commons.lang3.math.*; | [
"com.google.common",
"java.time",
"org.apache.commons"
] | com.google.common; java.time; org.apache.commons; | 1,240,937 |
private String getLatex(final Latex latex) {
if (latex == null || latex.getLatex() == null) {
return "";
}
StringBuffer result = new StringBuffer(latex.getLatex());
// LATER mime 20080324: check if LaTeX is correct and no forbidden tags are used
transformQref(result);
return deleteLineLeadingWhitespace(result.toString());
} | String function(final Latex latex) { if (latex == null latex.getLatex() == null) { return ""; } StringBuffer result = new StringBuffer(latex.getLatex()); transformQref(result); return deleteLineLeadingWhitespace(result.toString()); } | /**
* Get really LaTeX. Does some simple character replacements for umlauts. Also transforms
* <code>\qref{key}</code> into LaTeX.
*
* @param latex Unescaped text.
* @return Really LaTeX.
*/ | Get really LaTeX. Does some simple character replacements for umlauts. Also transforms <code>\qref{key}</code> into LaTeX | getLatex | {
"repo_name": "m-31/qedeq",
"path": "QedeqKernelBo/src/org/qedeq/kernel/bo/service/latex/Qedeq2LatexExecutor.java",
"license": "gpl-2.0",
"size": 68023
} | [
"org.qedeq.kernel.se.base.module.Latex"
] | import org.qedeq.kernel.se.base.module.Latex; | import org.qedeq.kernel.se.base.module.*; | [
"org.qedeq.kernel"
] | org.qedeq.kernel; | 1,381,084 |
public B message(Message message) {
delegate.message(message);
return self;
} | B function(Message message) { delegate.message(message); return self; } | /**
* Sets the message instance to send.
* @param message
* @return
*/ | Sets the message instance to send | message | {
"repo_name": "christophd/citrus",
"path": "vintage/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/SendMessageActionBuilder.java",
"license": "apache-2.0",
"size": 14071
} | [
"com.consol.citrus.message.Message"
] | import com.consol.citrus.message.Message; | import com.consol.citrus.message.*; | [
"com.consol.citrus"
] | com.consol.citrus; | 220,931 |
private CharSequence getPreviewText(Key key) {
if (mInMultiTap) {
mPreviewLabel.setLength(0);
mPreviewLabel.append((char) key.codes[mTapCount < 0 ? 0 : mTapCount]);
return adjustCase(mPreviewLabel);
} else {
return adjustCase(key.label);
}
} | CharSequence function(Key key) { if (mInMultiTap) { mPreviewLabel.setLength(0); mPreviewLabel.append((char) key.codes[mTapCount < 0 ? 0 : mTapCount]); return adjustCase(mPreviewLabel); } else { return adjustCase(key.label); } } | /**
* Handle multi-tap keys by producing the key label for the current multi-tap state.
*/ | Handle multi-tap keys by producing the key label for the current multi-tap state | getPreviewText | {
"repo_name": "s20121035/rk3288_android5.1_repo",
"path": "packages/inputmethods/OpenWnn/src/jp/co/omronsoft/openwnn/KeyboardView.java",
"license": "gpl-3.0",
"size": 57498
} | [
"jp.co.omronsoft.openwnn.Keyboard"
] | import jp.co.omronsoft.openwnn.Keyboard; | import jp.co.omronsoft.openwnn.*; | [
"jp.co.omronsoft"
] | jp.co.omronsoft; | 2,384,658 |
protected static void writeHeader(OutputStream os, String[] comments) {
PrintStream ps = new PrintStream(os);
if (comments != null)
for (String s : comments) {
ps.println("# " + s);
}
ps.println(""); // add blank line
ps.flush();
} | static void function(OutputStream os, String[] comments) { PrintStream ps = new PrintStream(os); if (comments != null) for (String s : comments) { ps.println(STR + s); } ps.println(""); ps.flush(); } | /**
* Write header.
*
* @param os the os
* @param comments the comments
*/ | Write header | writeHeader | {
"repo_name": "pipseq/semantic",
"path": "src/main/org/pipseq/rdf/jena/model/TripleBase.java",
"license": "mit",
"size": 4731
} | [
"java.io.OutputStream",
"java.io.PrintStream"
] | import java.io.OutputStream; import java.io.PrintStream; | import java.io.*; | [
"java.io"
] | java.io; | 925,393 |
@Test(timeout = 60000)
public void testDowncastJoinRef() {
AstModel model = newModel();
AstAbstractClafer a = model.addAbstract("A");
AstAbstractClafer b = model.addAbstract("B").extending(a);
AstConcreteClafer c = model.addChild("C").extending(b).refToUnique(IntType).withCard(Mandatory);
AstConcreteClafer d = model.addChild("D").extending(b).withCard(Mandatory);
model.addConstraint(equal(joinRef(union(global(c), global(d))), constant(1)));
ClaferSolver solver = ClaferCompiler.compile(model, Scope.defaultScope(2).intLow(-1).intHigh(1));
int count = 0;
while (solver.find()) {
for (InstanceClafer Ci : solver.instance().getTopClafers(c)) {
assertEquals(1, Ci.getRef());
}
count++;
}
assertEquals(1, count);
} | @Test(timeout = 60000) void function() { AstModel model = newModel(); AstAbstractClafer a = model.addAbstract("A"); AstAbstractClafer b = model.addAbstract("B").extending(a); AstConcreteClafer c = model.addChild("C").extending(b).refToUnique(IntType).withCard(Mandatory); AstConcreteClafer d = model.addChild("D").extending(b).withCard(Mandatory); model.addConstraint(equal(joinRef(union(global(c), global(d))), constant(1))); ClaferSolver solver = ClaferCompiler.compile(model, Scope.defaultScope(2).intLow(-1).intHigh(1)); int count = 0; while (solver.find()) { for (InstanceClafer Ci : solver.instance().getTopClafers(c)) { assertEquals(1, Ci.getRef()); } count++; } assertEquals(1, count); } | /**
* <pre>
* abstract A
* abstract B : A
* C : B -> int
* D : B
*
* [(C ++ D).ref = 1]
* </pre>
*/ | <code> abstract A abstract B : A C : B -> int D : B [(C ++ D).ref = 1] </code> | testDowncastJoinRef | {
"repo_name": "gsdlab/chocosolver",
"path": "src/test/java/org/clafer/TypingConstraintTest.java",
"license": "mit",
"size": 13267
} | [
"org.clafer.ast.AstAbstractClafer",
"org.clafer.ast.AstConcreteClafer",
"org.clafer.ast.AstModel",
"org.clafer.ast.Asts",
"org.clafer.compiler.ClaferCompiler",
"org.clafer.compiler.ClaferSolver",
"org.clafer.instance.InstanceClafer",
"org.clafer.scope.Scope",
"org.junit.Assert",
"org.junit.Test"
] | import org.clafer.ast.AstAbstractClafer; import org.clafer.ast.AstConcreteClafer; import org.clafer.ast.AstModel; import org.clafer.ast.Asts; import org.clafer.compiler.ClaferCompiler; import org.clafer.compiler.ClaferSolver; import org.clafer.instance.InstanceClafer; import org.clafer.scope.Scope; import org.junit.Assert; import org.junit.Test; | import org.clafer.ast.*; import org.clafer.compiler.*; import org.clafer.instance.*; import org.clafer.scope.*; import org.junit.*; | [
"org.clafer.ast",
"org.clafer.compiler",
"org.clafer.instance",
"org.clafer.scope",
"org.junit"
] | org.clafer.ast; org.clafer.compiler; org.clafer.instance; org.clafer.scope; org.junit; | 538,896 |
public static Shader create(GL2ES2 gl, int type, String name) {
int handle = gl.glCreateShader(type);
return new Shader(type, handle, name);
}
protected Shader(int type, int handle, String name) {
this.type = type;
this.handle = handle;
this.name = name;
this.source = null;
this.programs = new HashSet<>();
this.ltObservers = new HashSet<>();
} | static Shader function(GL2ES2 gl, int type, String name) { int handle = gl.glCreateShader(type); return new Shader(type, handle, name); } protected Shader(int type, int handle, String name) { this.type = type; this.handle = handle; this.name = name; this.source = null; this.programs = new HashSet<>(); this.ltObservers = new HashSet<>(); } | /**
* Creates a new OpenGL shader for the givne type and name and wraps it in a {@code Shader}.
*
* @param gl the {@code GL2ES2}-Object of the OpenGL context.
* @param type the (OpenGL) type-id of the shader.
* @param name the (unique) name of the shader that can be used to identify it.
* @return the created OpenGL shader wrapped as {@code Shader}.
*/ | Creates a new OpenGL shader for the givne type and name and wraps it in a Shader | create | {
"repo_name": "sgs-us/microtrafficsim",
"path": "microtrafficsim-core/src/main/java/microtrafficsim/core/vis/opengl/shader/Shader.java",
"license": "gpl-3.0",
"size": 7053
} | [
"java.util.HashSet"
] | import java.util.HashSet; | import java.util.*; | [
"java.util"
] | java.util; | 1,074,422 |
protected void onResignMaster() {
log.info("Resigning Twitter master node...");
for (TwitterStream stream : new ArrayList<>(m_streams)) {
try {
removeNodeStream(stream.getChannel());
} catch (Exception ex) {
log.error("Unable to add remove stream for channel #" + stream.getChannel().getChannelId(), ex);
}
}
} | void function() { log.info(STR); for (TwitterStream stream : new ArrayList<>(m_streams)) { try { removeNodeStream(stream.getChannel()); } catch (Exception ex) { log.error(STR + stream.getChannel().getChannelId(), ex); } } } | /**
* Called when this node ceases to be the Twitter master
*/ | Called when this node ceases to be the Twitter master | onResignMaster | {
"repo_name": "xkmato/mage",
"path": "src/main/java/io/rapidpro/mage/twitter/TwitterManager.java",
"license": "agpl-3.0",
"size": 11083
} | [
"java.util.ArrayList"
] | import java.util.ArrayList; | import java.util.*; | [
"java.util"
] | java.util; | 2,697,012 |
public void setGCType(@NotNull GCType gcType) {
this.gcType = gcType;
} | void function(@NotNull GCType gcType) { this.gcType = gcType; } | /**
* Set the gc type.
* @param gcType the type of gc to run.
*/ | Set the gc type | setGCType | {
"repo_name": "stillalex/jackrabbit-oak",
"path": "oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/compaction/SegmentGCOptions.java",
"license": "apache-2.0",
"size": 10560
} | [
"org.jetbrains.annotations.NotNull"
] | import org.jetbrains.annotations.NotNull; | import org.jetbrains.annotations.*; | [
"org.jetbrains.annotations"
] | org.jetbrains.annotations; | 406,957 |
void addMetadata(List<AndesMessageMetadata> metadataList) throws AndesException; | void addMetadata(List<AndesMessageMetadata> metadataList) throws AndesException; | /**
* store mata data of messages
*
* @param metadataList metadata list to store
* @throws AndesException
*/ | store mata data of messages | addMetadata | {
"repo_name": "ThilankaBowala/andes",
"path": "modules/andes-core/broker/src/main/java/org/wso2/andes/kernel/MessageStore.java",
"license": "apache-2.0",
"size": 15591
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 671,129 |
@JsonProperty
public void setCountry(String country) {
Locale locale = LocaleUtil.toLocale(country, countryLocale);
if (locale == null) {
this.country = country;
} else {
setCountry(locale);
}
} | void function(String country) { Locale locale = LocaleUtil.toLocale(country, countryLocale); if (locale == null) { this.country = country; } else { setCountry(locale); } } | /**
* Setting the country in ISO 3166 2 letter code. Case doesn't matter, will be corrected automatically.
*
* @param country The country code string.
*/ | Setting the country in ISO 3166 2 letter code. Case doesn't matter, will be corrected automatically | setCountry | {
"repo_name": "secucard/secucard-connect-java-sdk",
"path": "src/main/java/com/secucard/connect/product/general/model/Address.java",
"license": "apache-2.0",
"size": 2843
} | [
"com.secucard.connect.util.LocaleUtil",
"java.util.Locale"
] | import com.secucard.connect.util.LocaleUtil; import java.util.Locale; | import com.secucard.connect.util.*; import java.util.*; | [
"com.secucard.connect",
"java.util"
] | com.secucard.connect; java.util; | 1,253,065 |
public ExecRow _getCurrentRow() throws StandardException {
ExecRow sourceRow = null;
if (SanityManager.DEBUG) {
SanityManager.ASSERT(isOpen,
"IndexRowToBaseRowResultSet is expected to be open");
}
// Gemstone changes BEGIN
if (currentRowPrescanned) {
setRegionAndKeyInfo(this.currentRow);
return currentRow;
}
// Gemstone changes BEGIN
if (currentRow == null)
{
return null;
}
// We do not need to read the row from the index first, since we already
// have the rowLocation of the current row and can read it directly from
// the heap.
sourceRow = activation.getExecutionFactory().
getValueRow(indexCols.length);
// GemStone changes BEGIN
sourceRow.setRowArray(this.baseRow);
// Fetch the columns coming from the heap
baseRowLocation = source.fetch(baseRowLocation, sourceRow,
(FormatableBitSet) null, this.faultInValues, this.gfc);
boolean row_exists = baseRowLocation != null;
// GemStone changes END
if (row_exists) {
setCurrentRow(sourceRow);
} else {
clearCurrentRow();
}
// Gemstone changes BEGIN
setRegionAndKeyInfo(this.currentRow);
// Gemstone changes END
return currentRow;
} | ExecRow function() throws StandardException { ExecRow sourceRow = null; if (SanityManager.DEBUG) { SanityManager.ASSERT(isOpen, STR); } if (currentRowPrescanned) { setRegionAndKeyInfo(this.currentRow); return currentRow; } if (currentRow == null) { return null; } sourceRow = activation.getExecutionFactory(). getValueRow(indexCols.length); sourceRow.setRowArray(this.baseRow); baseRowLocation = source.fetch(baseRowLocation, sourceRow, (FormatableBitSet) null, this.faultInValues, this.gfc); boolean row_exists = baseRowLocation != null; if (row_exists) { setCurrentRow(sourceRow); } else { clearCurrentRow(); } setRegionAndKeyInfo(this.currentRow); return currentRow; } | /** * Gets last row returned.
*
* @see CursorResultSet
*
* @return the last row returned.
* @exception StandardException thrown on failure.
*/ | Gets last row returned | _getCurrentRow | {
"repo_name": "gemxd/gemfirexd-oss",
"path": "gemfirexd/core/src/main/java/com/pivotal/gemfirexd/internal/impl/sql/execute/IndexRowToBaseRowResultSet.java",
"license": "apache-2.0",
"size": 36903
} | [
"com.pivotal.gemfirexd.internal.iapi.error.StandardException",
"com.pivotal.gemfirexd.internal.iapi.services.io.FormatableBitSet",
"com.pivotal.gemfirexd.internal.iapi.services.sanity.SanityManager",
"com.pivotal.gemfirexd.internal.iapi.sql.execute.ExecRow"
] | import com.pivotal.gemfirexd.internal.iapi.error.StandardException; import com.pivotal.gemfirexd.internal.iapi.services.io.FormatableBitSet; import com.pivotal.gemfirexd.internal.iapi.services.sanity.SanityManager; import com.pivotal.gemfirexd.internal.iapi.sql.execute.ExecRow; | import com.pivotal.gemfirexd.internal.iapi.error.*; import com.pivotal.gemfirexd.internal.iapi.services.io.*; import com.pivotal.gemfirexd.internal.iapi.services.sanity.*; import com.pivotal.gemfirexd.internal.iapi.sql.execute.*; | [
"com.pivotal.gemfirexd"
] | com.pivotal.gemfirexd; | 1,021,894 |
public void setLabelString(String labelString) throws IOException {
// noop
} | void function(String labelString) throws IOException { } | /**
* Sets the label string for a node. This value will be returned by {@link #getLabelString()}.
*
* @param labelString
* The new label string to use.
* @since 1.475
*/ | Sets the label string for a node. This value will be returned by <code>#getLabelString()</code> | setLabelString | {
"repo_name": "abayer/jenkins",
"path": "core/src/main/java/hudson/model/Node.java",
"license": "mit",
"size": 16311
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,782,561 |
List<CompletedCheckpoint> getAllCheckpoints() throws Exception; | List<CompletedCheckpoint> getAllCheckpoints() throws Exception; | /**
* Returns all {@link CompletedCheckpoint} instances.
*
* <p>Returns an empty list if no checkpoint has been added yet.
*/ | Returns all <code>CompletedCheckpoint</code> instances. Returns an empty list if no checkpoint has been added yet | getAllCheckpoints | {
"repo_name": "gyfora/flink",
"path": "flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/CompletedCheckpointStore.java",
"license": "apache-2.0",
"size": 3949
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 320,262 |
State state(); | State state(); | /**
* Returns the state of this stream.
*/ | Returns the state of this stream | state | {
"repo_name": "wangcy6/storm_app",
"path": "frame/java/netty-4.1/codec-http2/src/main/java/io/netty/handler/codec/http2/Http2FrameStream.java",
"license": "apache-2.0",
"size": 1538
} | [
"io.netty.handler.codec.http2.Http2Stream"
] | import io.netty.handler.codec.http2.Http2Stream; | import io.netty.handler.codec.http2.*; | [
"io.netty.handler"
] | io.netty.handler; | 2,089,766 |
@SuppressWarnings("static-access")
@Override
public int registerPlayer(String name, RMIClient _client) throws RemoteException {
// Store Client information
GameClientInfo tempClient = new GameClientInfo();
tempClient.id = (int) nextClientId++;
tempClient.client = _client;
tempClient.lastActiveTime = new Date();
tempClient.name = name;
try {
tempClient.ip = this.getClientHost();
} catch (ServerNotActiveException e1) {
e1.printStackTrace();
}
clients.put(tempClient.id, tempClient);
// Broadcast to all clients
for(GameClientInfo client : clients.values())
{
client.client.writeLog("[System] Player '"+tempClient.name+"' (" + tempClient.ip + ") connected\n");
}
return tempClient.id;
} | @SuppressWarnings(STR) int function(String name, RMIClient _client) throws RemoteException { GameClientInfo tempClient = new GameClientInfo(); tempClient.id = (int) nextClientId++; tempClient.client = _client; tempClient.lastActiveTime = new Date(); tempClient.name = name; try { tempClient.ip = this.getClientHost(); } catch (ServerNotActiveException e1) { e1.printStackTrace(); } clients.put(tempClient.id, tempClient); for(GameClientInfo client : clients.values()) { client.client.writeLog(STR+tempClient.name+STR + tempClient.ip + STR); } return tempClient.id; } | /**
* registers a new player on the server
* @param name client name
* @param _client client rmi interface
* @returns the client id
*/ | registers a new player on the server | registerPlayer | {
"repo_name": "hendrikp/GameFindRefuge",
"path": "src/rmi/RMIServer.java",
"license": "bsd-2-clause",
"size": 4374
} | [
"java.rmi.RemoteException",
"java.rmi.server.ServerNotActiveException",
"java.util.Date"
] | import java.rmi.RemoteException; import java.rmi.server.ServerNotActiveException; import java.util.Date; | import java.rmi.*; import java.rmi.server.*; import java.util.*; | [
"java.rmi",
"java.util"
] | java.rmi; java.util; | 1,239,047 |
private boolean isUnderInternalThreshold(File apkFile, boolean isForwardLocked, long threshold)
throws IOException {
long size = apkFile.length();
if (size == 0 && !apkFile.exists()) {
throw new FileNotFoundException();
}
if (isForwardLocked) {
size += PackageHelper.extractPublicFiles(apkFile.getAbsolutePath(), null);
}
final StatFs internalStats = new StatFs(Environment.getDataDirectory().getPath());
final long availInternalSize = (long) internalStats.getAvailableBlocks()
* (long) internalStats.getBlockSize();
return (availInternalSize - size) > threshold;
} | boolean function(File apkFile, boolean isForwardLocked, long threshold) throws IOException { long size = apkFile.length(); if (size == 0 && !apkFile.exists()) { throw new FileNotFoundException(); } if (isForwardLocked) { size += PackageHelper.extractPublicFiles(apkFile.getAbsolutePath(), null); } final StatFs internalStats = new StatFs(Environment.getDataDirectory().getPath()); final long availInternalSize = (long) internalStats.getAvailableBlocks() * (long) internalStats.getBlockSize(); return (availInternalSize - size) > threshold; } | /**
* Measure a file to see if it fits within the free space threshold.
*
* @param apkFile file to check
* @param threshold byte threshold to compare against
* @return true if file fits under threshold
* @throws FileNotFoundException when APK does not exist
*/ | Measure a file to see if it fits within the free space threshold | isUnderInternalThreshold | {
"repo_name": "DmitryADP/diff_qc750",
"path": "frameworks/base/packages/DefaultContainerService/src/com/android/defcontainer/DefaultContainerService.java",
"license": "gpl-2.0",
"size": 33341
} | [
"android.os.Environment",
"android.os.StatFs",
"com.android.internal.content.PackageHelper",
"java.io.File",
"java.io.FileNotFoundException",
"java.io.IOException"
] | import android.os.Environment; import android.os.StatFs; import com.android.internal.content.PackageHelper; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; | import android.os.*; import com.android.internal.content.*; import java.io.*; | [
"android.os",
"com.android.internal",
"java.io"
] | android.os; com.android.internal; java.io; | 1,261,910 |
void setAsComplete(int pieceLength) {
synchronized (blocks) {
// remove all of the original blocks
blocks.clear();
// simply add one block with a starting index of 0 with the
// specified length
blocks.add(new Block(0, pieceLength));
}
} | void setAsComplete(int pieceLength) { synchronized (blocks) { blocks.clear(); blocks.add(new Block(0, pieceLength)); } } | /**
* Record the piece's state as being completed. All {@link Block}s will be
* removed and only one will be added starting at index zero and the length
* equal to <code>pieceLength</code>.
*
* @param pieceLength
* the length of the piece that this <code>PieceState</code>
* represents
*/ | Record the piece's state as being completed. All <code>Block</code>s will be removed and only one will be added starting at index zero and the length equal to <code>pieceLength</code> | setAsComplete | {
"repo_name": "AcademicTorrents/AcademicTorrents-Downloader",
"path": "eclipse/org/eclipse/bittorrent/internal/torrent/PieceState.java",
"license": "gpl-2.0",
"size": 6472
} | [
"org.eclipse.bittorrent.internal.torrent.Block"
] | import org.eclipse.bittorrent.internal.torrent.Block; | import org.eclipse.bittorrent.internal.torrent.*; | [
"org.eclipse.bittorrent"
] | org.eclipse.bittorrent; | 1,857,478 |
@Nullable
public Buffer requestBuffer() {
return bufferManager.requestBuffer();
} | Buffer function() { return bufferManager.requestBuffer(); } | /**
* Requests buffer from input channel directly for receiving network data.
* It should always return an available buffer in credit-based mode unless
* the channel has been released.
*
* @return The available buffer.
*/ | Requests buffer from input channel directly for receiving network data. It should always return an available buffer in credit-based mode unless the channel has been released | requestBuffer | {
"repo_name": "jinglining/flink",
"path": "flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/consumer/RemoteInputChannel.java",
"license": "apache-2.0",
"size": 17300
} | [
"org.apache.flink.runtime.io.network.buffer.Buffer"
] | import org.apache.flink.runtime.io.network.buffer.Buffer; | import org.apache.flink.runtime.io.network.buffer.*; | [
"org.apache.flink"
] | org.apache.flink; | 1,170,462 |
public FacesConfigApplicationType<T> removeAllElResolver()
{
childNode.removeChildren("el-resolver");
return this;
}
// --------------------------------------------------------------------------------------------------------||
// ClassName: FacesConfigApplicationType ElementName: xsd:token ElementType : property-resolver
// MaxOccurs: -unbounded isGeneric: true isAttribute: false isEnum: false isDataType: true
// --------------------------------------------------------------------------------------------------------|| | FacesConfigApplicationType<T> function() { childNode.removeChildren(STR); return this; } | /**
* Removes the <code>el-resolver</code> element
* @return the current instance of <code>FacesConfigApplicationType<T></code>
*/ | Removes the <code>el-resolver</code> element | removeAllElResolver | {
"repo_name": "forge/javaee-descriptors",
"path": "impl/src/main/java/org/jboss/shrinkwrap/descriptor/impl/facesconfig20/FacesConfigApplicationTypeImpl.java",
"license": "epl-1.0",
"size": 32125
} | [
"org.jboss.shrinkwrap.descriptor.api.facesconfig20.FacesConfigApplicationType"
] | import org.jboss.shrinkwrap.descriptor.api.facesconfig20.FacesConfigApplicationType; | import org.jboss.shrinkwrap.descriptor.api.facesconfig20.*; | [
"org.jboss.shrinkwrap"
] | org.jboss.shrinkwrap; | 498,035 |
@Test
public void isRetryStillAllowed_twoExceptionTypes_moreRetriesAllowed() {
Map<String, Long> retriesPerException = new HashMap<String, Long>();
assertTrue(transactionRetryer.isRetryStillAllowed(retriesPerException));
// retry for ConstraintViolationException
transactionRetryer.addOrIncrementRetries(retriesPerException, ConstraintViolationException.class.getName());
assertTrue(transactionRetryer.isRetryStillAllowed(retriesPerException));
for (int i = 0; i < 3; i++) {
// retry for MailSendException
transactionRetryer.addOrIncrementRetries(retriesPerException, MailSendException.class.getName());
assertTrue(transactionRetryer.isRetryStillAllowed(retriesPerException));
}
// retry for MailSendException - isRetryStillAllowed should return false since MailSendException is configured to be retried 3 times
transactionRetryer.addOrIncrementRetries(retriesPerException, MailSendException.class.getName());
boolean isMailSendExceptionRetryAllowed = transactionRetryer.isRetryStillAllowed(retriesPerException);
// retry second time no more allowed - throw error further
transactionRetryer.addOrIncrementRetries(retriesPerException, ConstraintViolationException.class.getName());
boolean isConstraintViolationExceptionAllowed = transactionRetryer.isRetryStillAllowed(retriesPerException);
assertFalse(isMailSendExceptionRetryAllowed);
assertFalse(isConstraintViolationExceptionAllowed);
// retry no more allowed
transactionRetryer.addOrIncrementRetries(retriesPerException, ConstraintViolationException.class.getName());
assertFalse(transactionRetryer.isRetryStillAllowed(retriesPerException));
}
| void function() { Map<String, Long> retriesPerException = new HashMap<String, Long>(); assertTrue(transactionRetryer.isRetryStillAllowed(retriesPerException)); transactionRetryer.addOrIncrementRetries(retriesPerException, ConstraintViolationException.class.getName()); assertTrue(transactionRetryer.isRetryStillAllowed(retriesPerException)); for (int i = 0; i < 3; i++) { transactionRetryer.addOrIncrementRetries(retriesPerException, MailSendException.class.getName()); assertTrue(transactionRetryer.isRetryStillAllowed(retriesPerException)); } transactionRetryer.addOrIncrementRetries(retriesPerException, MailSendException.class.getName()); boolean isMailSendExceptionRetryAllowed = transactionRetryer.isRetryStillAllowed(retriesPerException); transactionRetryer.addOrIncrementRetries(retriesPerException, ConstraintViolationException.class.getName()); boolean isConstraintViolationExceptionAllowed = transactionRetryer.isRetryStillAllowed(retriesPerException); assertFalse(isMailSendExceptionRetryAllowed); assertFalse(isConstraintViolationExceptionAllowed); transactionRetryer.addOrIncrementRetries(retriesPerException, ConstraintViolationException.class.getName()); assertFalse(transactionRetryer.isRetryStillAllowed(retriesPerException)); } | /**
* Assumes that ConstraintViolationException could be retried once while MailSendException could be retried 3 times, see lmsLearnTestContext.xml for
* maxRetriesPerException.
*/ | Assumes that ConstraintViolationException could be retried once while MailSendException could be retried 3 times, see lmsLearnTestContext.xml for maxRetriesPerException | isRetryStillAllowed_twoExceptionTypes_moreRetriesAllowed | {
"repo_name": "huihoo/olat",
"path": "OLAT-LMS/src/test/java/org/olat/lms/learn/TransactionRetryerITCaseNew.java",
"license": "apache-2.0",
"size": 13201
} | [
"java.util.HashMap",
"java.util.Map",
"org.hibernate.exception.ConstraintViolationException",
"org.junit.Assert",
"org.springframework.mail.MailSendException"
] | import java.util.HashMap; import java.util.Map; import org.hibernate.exception.ConstraintViolationException; import org.junit.Assert; import org.springframework.mail.MailSendException; | import java.util.*; import org.hibernate.exception.*; import org.junit.*; import org.springframework.mail.*; | [
"java.util",
"org.hibernate.exception",
"org.junit",
"org.springframework.mail"
] | java.util; org.hibernate.exception; org.junit; org.springframework.mail; | 367,741 |
private List<IteratorSetting> jobIterators(JobConf job) {
return InputConfigurator.getIterators(CLASS, job);
} | List<IteratorSetting> function(JobConf job) { return InputConfigurator.getIterators(CLASS, job); } | /**
* Extracts Iterators settings from the context to be used by RecordReader.
*
* @param job
* the Hadoop job configuration
* @return List of iterator settings for given table
*/ | Extracts Iterators settings from the context to be used by RecordReader | jobIterators | {
"repo_name": "keith-turner/accumulo",
"path": "hadoop-mapreduce/src/main/java/org/apache/accumulo/hadoopImpl/mapred/AccumuloRecordReader.java",
"license": "apache-2.0",
"size": 17908
} | [
"java.util.List",
"org.apache.accumulo.core.client.IteratorSetting",
"org.apache.accumulo.hadoopImpl.mapreduce.lib.InputConfigurator",
"org.apache.hadoop.mapred.JobConf"
] | import java.util.List; import org.apache.accumulo.core.client.IteratorSetting; import org.apache.accumulo.hadoopImpl.mapreduce.lib.InputConfigurator; import org.apache.hadoop.mapred.JobConf; | import java.util.*; import org.apache.accumulo.*; import org.apache.accumulo.core.client.*; import org.apache.hadoop.mapred.*; | [
"java.util",
"org.apache.accumulo",
"org.apache.hadoop"
] | java.util; org.apache.accumulo; org.apache.hadoop; | 2,894,724 |
public ResourceMocker withServletRequest(final HttpServletRequest req) {
Mockito.doReturn(req).when(this.resource).httpServletRequest();
return this;
} | ResourceMocker function(final HttpServletRequest req) { Mockito.doReturn(req).when(this.resource).httpServletRequest(); return this; } | /**
* With this instance of {@link HttpServletRequests}.
* @param req The instance
* @return This object
*/ | With this instance of <code>HttpServletRequests</code> | withServletRequest | {
"repo_name": "yegor256/rexsl",
"path": "src/main/java/com/rexsl/page/mock/ResourceMocker.java",
"license": "bsd-3-clause",
"size": 6405
} | [
"javax.servlet.http.HttpServletRequest",
"org.mockito.Mockito"
] | import javax.servlet.http.HttpServletRequest; import org.mockito.Mockito; | import javax.servlet.http.*; import org.mockito.*; | [
"javax.servlet",
"org.mockito"
] | javax.servlet; org.mockito; | 1,005,543 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.