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 ServiceResponseWithHeaders<Void, LROSADsDelete202NonRetry400HeadersInner> delete202NonRetry400() throws CloudException, IOException, InterruptedException { Response<ResponseBody> result = service.delete202NonRetry400(this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken<Void>() { }.getType(), LROSADsDelete202NonRetry400HeadersInner.class); }
ServiceResponseWithHeaders<Void, LROSADsDelete202NonRetry400HeadersInner> function() throws CloudException, IOException, InterruptedException { Response<ResponseBody> result = service.delete202NonRetry400(this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken<Void>() { }.getType(), LROSADsDelete202NonRetry400HeadersInner.class); }
/** * Long running delete request, service returns a 202 with a location header. * * @throws CloudException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ServiceResponseWithHeaders object if successful. */
Long running delete request, service returns a 202 with a location header
delete202NonRetry400
{ "repo_name": "John-Hart/autorest", "path": "src/generator/AutoRest.Java.Azure.Fluent.Tests/src/main/java/fixtures/lro/implementation/LROSADsInner.java", "license": "mit", "size": 244077 }
[ "com.google.common.reflect.TypeToken", "com.microsoft.azure.CloudException", "com.microsoft.rest.ServiceResponseWithHeaders", "java.io.IOException" ]
import com.google.common.reflect.TypeToken; import com.microsoft.azure.CloudException; import com.microsoft.rest.ServiceResponseWithHeaders; import java.io.IOException;
import com.google.common.reflect.*; import com.microsoft.azure.*; import com.microsoft.rest.*; import java.io.*;
[ "com.google.common", "com.microsoft.azure", "com.microsoft.rest", "java.io" ]
com.google.common; com.microsoft.azure; com.microsoft.rest; java.io;
2,080,514
private static MutableSource loadSource(MutableContext context, Sink sink, Object value) { MutableSource result = null; if (value instanceof String) { return load(sink, (String) value); } else if (value instanceof RuntimeBeanReference) { result = load(sink, (RuntimeBeanReference) value, context); } else if (value instanceof TypedStringValue) { result = load(sink, (TypedStringValue) value); } else if (value instanceof BeanDefinitionHolder) { result = load(sink, (BeanDefinitionHolder) value, context); } else if (value instanceof ManagedList) { result = load(sink, (ManagedList) value, context); } else if (value instanceof ManagedMap) { result = load(context, sink, (ManagedMap) value); } else if (value instanceof ManagedProperties) { result = load(sink, (ManagedProperties) value); } else { System.err.println("No support for " + value.getClass().getName()); return null; } result.setId("source" + (counter++)); return result; }
static MutableSource function(MutableContext context, Sink sink, Object value) { MutableSource result = null; if (value instanceof String) { return load(sink, (String) value); } else if (value instanceof RuntimeBeanReference) { result = load(sink, (RuntimeBeanReference) value, context); } else if (value instanceof TypedStringValue) { result = load(sink, (TypedStringValue) value); } else if (value instanceof BeanDefinitionHolder) { result = load(sink, (BeanDefinitionHolder) value, context); } else if (value instanceof ManagedList) { result = load(sink, (ManagedList) value, context); } else if (value instanceof ManagedMap) { result = load(context, sink, (ManagedMap) value); } else if (value instanceof ManagedProperties) { result = load(sink, (ManagedProperties) value); } else { System.err.println(STR + value.getClass().getName()); return null; } result.setId(STR + (counter++)); return result; }
/** * Loads a {@link MutableSource} by examining the value of a Sink. * * @param sink * The {@link Sink} configured using a certain type of source. * @param value * The Spring representation of that source. * @return A {@link MutableSource}, representing the source of the data to * be injected in the {@link Sink}. */
Loads a <code>MutableSource</code> by examining the value of a Sink
loadSource
{ "repo_name": "wspringer/spring-me", "path": "spring-me-core/src/main/java/me/springframework/di/spring/SpringConfigurationLoader.java", "license": "gpl-2.0", "size": 19518 }
[ "me.springframework.di.Sink", "me.springframework.di.base.MutableContext", "me.springframework.di.base.MutableSource", "org.springframework.beans.factory.config.BeanDefinitionHolder", "org.springframework.beans.factory.config.RuntimeBeanReference", "org.springframework.beans.factory.config.TypedStringValue", "org.springframework.beans.factory.support.ManagedList", "org.springframework.beans.factory.support.ManagedMap", "org.springframework.beans.factory.support.ManagedProperties" ]
import me.springframework.di.Sink; import me.springframework.di.base.MutableContext; import me.springframework.di.base.MutableSource; import org.springframework.beans.factory.config.BeanDefinitionHolder; import org.springframework.beans.factory.config.RuntimeBeanReference; import org.springframework.beans.factory.config.TypedStringValue; import org.springframework.beans.factory.support.ManagedList; import org.springframework.beans.factory.support.ManagedMap; import org.springframework.beans.factory.support.ManagedProperties;
import me.springframework.di.*; import me.springframework.di.base.*; import org.springframework.beans.factory.config.*; import org.springframework.beans.factory.support.*;
[ "me.springframework.di", "org.springframework.beans" ]
me.springframework.di; org.springframework.beans;
1,308,667
public Plot getPlot() { return this.plot; }
Plot function() { return this.plot; }
/** * Get the plot involved * * @return Plot */
Get the plot involved
getPlot
{ "repo_name": "manuelgu/PlotSquared", "path": "Nukkit/src/main/java/com/plotsquared/nukkit/events/PlayerClaimPlotEvent.java", "license": "gpl-3.0", "size": 1341 }
[ "com.intellectualcrafters.plot.object.Plot" ]
import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.*;
[ "com.intellectualcrafters.plot" ]
com.intellectualcrafters.plot;
910,374
@Test public void getIpInformationXForwardProxyTest() { final MockHttpServletRequest request = new MockHttpServletRequest("GET", "/path"); request.addHeader(WebBrowserUtil.X_FORWARDED_FOR, "203.0.113.195, 70.41.3.18, 150.172.238.178"); RequestContextHolder.setRequestAttributes(new ServletRequestAttributes(request)); final WebBrowser webBrowser = new WebBrowser(); assertEquals("203.0.113.195",WebBrowserUtil.getIpInformation(webBrowser)); }
void function() { final MockHttpServletRequest request = new MockHttpServletRequest("GET", "/path"); request.addHeader(WebBrowserUtil.X_FORWARDED_FOR, STR); RequestContextHolder.setRequestAttributes(new ServletRequestAttributes(request)); final WebBrowser webBrowser = new WebBrowser(); assertEquals(STR,WebBrowserUtil.getIpInformation(webBrowser)); }
/** * Gets the ip information X forward proxy test. * * @return the ip information X forward proxy test */
Gets the ip information X forward proxy test
getIpInformationXForwardProxyTest
{ "repo_name": "Hack23/cia", "path": "citizen-intelligence-agency/src/test/java/com/hack23/cia/web/impl/ui/application/util/WebBrowserUtilTest.java", "license": "apache-2.0", "size": 2608 }
[ "com.vaadin.server.WebBrowser", "org.springframework.mock.web.MockHttpServletRequest", "org.springframework.web.context.request.RequestContextHolder", "org.springframework.web.context.request.ServletRequestAttributes" ]
import com.vaadin.server.WebBrowser; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes;
import com.vaadin.server.*; import org.springframework.mock.web.*; import org.springframework.web.context.request.*;
[ "com.vaadin.server", "org.springframework.mock", "org.springframework.web" ]
com.vaadin.server; org.springframework.mock; org.springframework.web;
2,699,960
@SuppressWarnings("unchecked") public static InstanceBean getInstanceByUID(final Session session, final String id) { final Query q = session.createQuery("from InstanceBean where uuid='" + id + "'"); final List<InstanceBean> l = q.list(); if (l == null || l.size() == 0) { return null; } return l.get(0); }
@SuppressWarnings(STR) static InstanceBean function(final Session session, final String id) { final Query q = session.createQuery(STR + id + "'"); final List<InstanceBean> l = q.list(); if (l == null l.size() == 0) { return null; } return l.get(0); }
/** * Read an instance definition from datastore. * * @param session * hibernate session to use * @param id * unique ID for instance * @return instance definition */
Read an instance definition from datastore
getInstanceByUID
{ "repo_name": "TranscendComputing/TopStackCore", "path": "src/com/msi/tough/utils/InstanceUtil.java", "license": "apache-2.0", "size": 12964 }
[ "com.msi.tough.model.InstanceBean", "java.util.List", "org.hibernate.Query", "org.hibernate.Session" ]
import com.msi.tough.model.InstanceBean; import java.util.List; import org.hibernate.Query; import org.hibernate.Session;
import com.msi.tough.model.*; import java.util.*; import org.hibernate.*;
[ "com.msi.tough", "java.util", "org.hibernate" ]
com.msi.tough; java.util; org.hibernate;
2,526,169
return String.format("%1$tm/%1$td/%1$tY %1$tH:%1$tM:%1$tS", new Date()); }
return String.format(STR, new Date()); }
/** * Returns the current time formatted as <tt>MM/dd/yyyy hh:mm:ss</tt>. */
Returns the current time formatted as MM/dd/yyyy hh:mm:ss
getTimestampString
{ "repo_name": "nico01f/z-pec", "path": "ZimbraCommon/src/java/com/zimbra/common/stats/StatUtil.java", "license": "mit", "size": 858 }
[ "java.util.Date" ]
import java.util.Date;
import java.util.*;
[ "java.util" ]
java.util;
2,214,703
public static String getXMLSignatureAlgorithmURI(String algo) { String xmlSignatureAlgo = null; if ("DSA".equalsIgnoreCase(algo)) { xmlSignatureAlgo = JBossSAMLConstants.SIGNATURE_SHA1_WITH_DSA.get(); } else if ("RSA".equalsIgnoreCase(algo)) { xmlSignatureAlgo = JBossSAMLConstants.SIGNATURE_SHA1_WITH_RSA.get(); } return xmlSignatureAlgo; }
static String function(String algo) { String xmlSignatureAlgo = null; if ("DSA".equalsIgnoreCase(algo)) { xmlSignatureAlgo = JBossSAMLConstants.SIGNATURE_SHA1_WITH_DSA.get(); } else if ("RSA".equalsIgnoreCase(algo)) { xmlSignatureAlgo = JBossSAMLConstants.SIGNATURE_SHA1_WITH_RSA.get(); } return xmlSignatureAlgo; }
/** * Get the XML Signature URI for the algo (RSA, DSA) * * @param algo * * @return */
Get the XML Signature URI for the algo (RSA, DSA)
getXMLSignatureAlgorithmURI
{ "repo_name": "jean-merelis/keycloak", "path": "saml-core/src/main/java/org/keycloak/saml/processing/core/saml/v2/util/SignatureUtil.java", "license": "apache-2.0", "size": 10694 }
[ "org.keycloak.saml.common.constants.JBossSAMLConstants" ]
import org.keycloak.saml.common.constants.JBossSAMLConstants;
import org.keycloak.saml.common.constants.*;
[ "org.keycloak.saml" ]
org.keycloak.saml;
648,842
public void deleteArchiveInfo(String vaultName, String archiveId) { Iterator<VaultInfo> it = getVaults().iterator(); while (it.hasNext()) { VaultInfo v = it.next(); if (v.getVaultMetadata().getVaultName().equals(vaultName)) { List<ArchiveInfo> archiveList = v.getVaultInventory().getArchiveList(); Iterator<ArchiveInfo> archIt = archiveList.iterator(); while (archIt.hasNext()) { ArchiveInfo a = archIt.next(); if (a.getArchiveId().equals(archiveId)) { archIt.remove(); saveCache(); log.debug("Removed archive " + archiveId + " from cache."); break; } } } } }
void function(String vaultName, String archiveId) { Iterator<VaultInfo> it = getVaults().iterator(); while (it.hasNext()) { VaultInfo v = it.next(); if (v.getVaultMetadata().getVaultName().equals(vaultName)) { List<ArchiveInfo> archiveList = v.getVaultInventory().getArchiveList(); Iterator<ArchiveInfo> archIt = archiveList.iterator(); while (archIt.hasNext()) { ArchiveInfo a = archIt.next(); if (a.getArchiveId().equals(archiveId)) { archIt.remove(); saveCache(); log.debug(STR + archiveId + STR); break; } } } } }
/** * Remove archive from cached vault * * @param vaultName * @param archiveId */
Remove archive from cached vault
deleteArchiveInfo
{ "repo_name": "lekkas/glacier-jclient", "path": "src/main/java/org/glacierjclient/operations/cache/model/LocalCache.java", "license": "mit", "size": 10395 }
[ "java.util.Iterator", "java.util.List" ]
import java.util.Iterator; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,681,774
@Test(expected = IllegalArgumentException.class) public void createSameBody() { new WeldJoint(b1, b1, new Vector2()); }
@Test(expected = IllegalArgumentException.class) void function() { new WeldJoint(b1, b1, new Vector2()); }
/** * Tests the create method passing the same body. */
Tests the create method passing the same body
createSameBody
{ "repo_name": "jipalgol/dyn4j", "path": "junit/org/dyn4j/dynamics/WeldJointTest.java", "license": "bsd-3-clause", "size": 5200 }
[ "org.dyn4j.dynamics.joint.WeldJoint", "org.dyn4j.geometry.Vector2", "org.junit.Test" ]
import org.dyn4j.dynamics.joint.WeldJoint; import org.dyn4j.geometry.Vector2; import org.junit.Test;
import org.dyn4j.dynamics.joint.*; import org.dyn4j.geometry.*; import org.junit.*;
[ "org.dyn4j.dynamics", "org.dyn4j.geometry", "org.junit" ]
org.dyn4j.dynamics; org.dyn4j.geometry; org.junit;
1,104,527
private int makeAvailable() throws IOException { if (pos != -1) { return 0; } // Move the data to the beginning of the buffer. total += tail - head - pad; System.arraycopy(buffer, tail - pad, buffer, 0, pad); // Refill buffer with new data. head = 0; tail = pad; for (;;) { int bytesRead = input.read(buffer, tail, bufSize - tail); if (bytesRead == -1) { // The last pad amount is left in the buffer. // Boundary can't be in there so signal an error // condition. final String msg = "Stream ended unexpectedly"; throw new MalformedStreamException(msg); } if (notifier != null) { notifier.noteBytesRead(bytesRead); } tail += bytesRead; findSeparator(); int av = available(); if (av > 0 || pos != -1) { return av; } } }
int function() throws IOException { if (pos != -1) { return 0; } total += tail - head - pad; System.arraycopy(buffer, tail - pad, buffer, 0, pad); head = 0; tail = pad; for (;;) { int bytesRead = input.read(buffer, tail, bufSize - tail); if (bytesRead == -1) { final String msg = STR; throw new MalformedStreamException(msg); } if (notifier != null) { notifier.noteBytesRead(bytesRead); } tail += bytesRead; findSeparator(); int av = available(); if (av > 0 pos != -1) { return av; } } }
/** * Attempts to read more data. * * @return Number of available bytes * @throws IOException An I/O error occurred. */
Attempts to read more data
makeAvailable
{ "repo_name": "mohanaraosv/commons-fileupload", "path": "src/main/java/org/apache/commons/fileupload/MultipartStream.java", "license": "apache-2.0", "size": 33089 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
1,547,859
public void initSyntax(Syntax syntax, int startPos, int endPos, boolean forceLastBuffer, boolean forceNotLastBuffer) throws BadLocationException { doc.readLock(); try { Segment text = DocumentUtilities.SEGMENT_CACHE.getSegment(); try { int docLen = doc.getLength(); doc.prepareSyntax(text, syntax, startPos, 0, forceLastBuffer, forceNotLastBuffer); int preScan = syntax.getPreScan(); char[] buffer = doc.getChars(startPos - preScan, endPos - startPos + preScan); boolean lastBuffer = forceNotLastBuffer ? false : (forceLastBuffer || (endPos == docLen)); syntax.relocate(buffer, preScan, endPos - startPos, lastBuffer, endPos); } finally { DocumentUtilities.SEGMENT_CACHE.releaseSegment(text); } } finally { doc.readUnlock(); } }
void function(Syntax syntax, int startPos, int endPos, boolean forceLastBuffer, boolean forceNotLastBuffer) throws BadLocationException { doc.readLock(); try { Segment text = DocumentUtilities.SEGMENT_CACHE.getSegment(); try { int docLen = doc.getLength(); doc.prepareSyntax(text, syntax, startPos, 0, forceLastBuffer, forceNotLastBuffer); int preScan = syntax.getPreScan(); char[] buffer = doc.getChars(startPos - preScan, endPos - startPos + preScan); boolean lastBuffer = forceNotLastBuffer ? false : (forceLastBuffer (endPos == docLen)); syntax.relocate(buffer, preScan, endPos - startPos, lastBuffer, endPos); } finally { DocumentUtilities.SEGMENT_CACHE.releaseSegment(text); } } finally { doc.readUnlock(); } }
/** Initialize the syntax so it's ready to scan the given area. * @param syntax lexical analyzer to prepare * @param startPos starting position of the scanning * @param endPos ending position of the scanning * @param forceLastBuffer force the syntax to think that the scanned area is the last * in the document. This is useful for forcing the syntax to process all the characters * in the given area. * @param forceNotLastBuffer force the syntax to think that the scanned area is NOT * the last buffer in the document. This is useful when the syntax will continue * scanning on another buffer. */
Initialize the syntax so it's ready to scan the given area
initSyntax
{ "repo_name": "CharlesSkelton/studio", "path": "src/org/netbeans/editor/SyntaxSupport.java", "license": "apache-2.0", "size": 17917 }
[ "javax.swing.text.BadLocationException", "javax.swing.text.Segment" ]
import javax.swing.text.BadLocationException; import javax.swing.text.Segment;
import javax.swing.text.*;
[ "javax.swing" ]
javax.swing;
435,199
private void animateLogo() { YoYo.with(Techniques.FadeIn) .duration(2500) .repeat(1) .playOn(findViewById(R.id.logo_first_login)); }
void function() { YoYo.with(Techniques.FadeIn) .duration(2500) .repeat(1) .playOn(findViewById(R.id.logo_first_login)); }
/** * This uses the library to call animation on the logo elements to make it look cool! */
This uses the library to call animation on the logo elements to make it look cool
animateLogo
{ "repo_name": "ayushr2/PlaySoduko", "path": "PlaySoduko/app/src/main/java/com/ayush/playsoduko/playsoduko/storyboard/LogInActivity.java", "license": "mit", "size": 4465 }
[ "com.daimajia.androidanimations.library.Techniques", "com.daimajia.androidanimations.library.YoYo" ]
import com.daimajia.androidanimations.library.Techniques; import com.daimajia.androidanimations.library.YoYo;
import com.daimajia.androidanimations.library.*;
[ "com.daimajia.androidanimations" ]
com.daimajia.androidanimations;
2,663,771
public Set<NewsGroup> getTopNewsGroups() { return this.getTopsNewsgroups(); }
Set<NewsGroup> function() { return this.getTopsNewsgroups(); }
/** * Gets the top news groups. * * @return the top news groups */
Gets the top news groups
getTopNewsGroups
{ "repo_name": "leonarduk/unison", "path": "src/main/java/uk/co/sleonard/unison/NewsGroupFilter.java", "license": "apache-2.0", "size": 7581 }
[ "java.util.Set", "uk.co.sleonard.unison.datahandling.DAO" ]
import java.util.Set; import uk.co.sleonard.unison.datahandling.DAO;
import java.util.*; import uk.co.sleonard.unison.datahandling.*;
[ "java.util", "uk.co.sleonard" ]
java.util; uk.co.sleonard;
696,410
@Test public void announceFloat() throws Exception { System.out.println("announceFloat"); String name = "TESTFLOAT"; float value = 334567.543f ; instance.announce(name, value, "FLOATGROUP" ); GMetricResult.GMetricDetail readValue = GMetricResult.getGMetric(name); assertEquals(value, Float.valueOf(readValue.value)); assertEquals(GMetricType.FLOAT.getGangliaType(), readValue.type); }
void function() throws Exception { System.out.println(STR); String name = STR; float value = 334567.543f ; instance.announce(name, value, STR ); GMetricResult.GMetricDetail readValue = GMetricResult.getGMetric(name); assertEquals(value, Float.valueOf(readValue.value)); assertEquals(GMetricType.FLOAT.getGangliaType(), readValue.type); }
/** * Test of announce method, type float */
Test of announce method, type float
announceFloat
{ "repo_name": "schubertzhang/jmxetric", "path": "src/test/java/ganglia/gmetric/GMetricTest.java", "license": "mit", "size": 3212 }
[ "org.junit.Assert" ]
import org.junit.Assert;
import org.junit.*;
[ "org.junit" ]
org.junit;
633,045
BasicInterval getBasicInterval(Register r, Instruction s) { CompoundInterval c = getInterval(r); if (c == null) return null; return c.getBasicInterval(s); } } public static final class IntervalAnalysis extends CompilerPhase implements Operators { IR ir; private BasicBlock listOfBlocks; private BasicBlock reverseTopFirst; private static final Constructor<CompilerPhase> constructor = getCompilerPhaseConstructor(IntervalAnalysis.class);
BasicInterval getBasicInterval(Register r, Instruction s) { CompoundInterval c = getInterval(r); if (c == null) return null; return c.getBasicInterval(s); } } public static final class IntervalAnalysis extends CompilerPhase implements Operators { IR ir; private BasicBlock listOfBlocks; private BasicBlock reverseTopFirst; private static final Constructor<CompilerPhase> constructor = getCompilerPhaseConstructor(IntervalAnalysis.class);
/** * Find the basic interval for register r containing instruction s. * If there are two such intervals, return the 1st one. * If there is none, return null. */
Find the basic interval for register r containing instruction s. If there are two such intervals, return the 1st one. If there is none, return null
getBasicInterval
{ "repo_name": "CodeOffloading/JikesRVM-CCO", "path": "jikesrvm-3.1.3/rvm/src/org/jikesrvm/compilers/opt/regalloc/LinearScan.java", "license": "epl-1.0", "size": 88417 }
[ "java.lang.reflect.Constructor", "org.jikesrvm.compilers.opt.driver.CompilerPhase", "org.jikesrvm.compilers.opt.ir.BasicBlock", "org.jikesrvm.compilers.opt.ir.Instruction", "org.jikesrvm.compilers.opt.ir.Operators", "org.jikesrvm.compilers.opt.ir.Register" ]
import java.lang.reflect.Constructor; import org.jikesrvm.compilers.opt.driver.CompilerPhase; import org.jikesrvm.compilers.opt.ir.BasicBlock; import org.jikesrvm.compilers.opt.ir.Instruction; import org.jikesrvm.compilers.opt.ir.Operators; import org.jikesrvm.compilers.opt.ir.Register;
import java.lang.reflect.*; import org.jikesrvm.compilers.opt.driver.*; import org.jikesrvm.compilers.opt.ir.*;
[ "java.lang", "org.jikesrvm.compilers" ]
java.lang; org.jikesrvm.compilers;
2,182,446
public Builder columns(Column... columns) { return columns(ImmutableList.copyOf(columns)); }
Builder function(Column... columns) { return columns(ImmutableList.copyOf(columns)); }
/** * Sets the {@code columns} property in the builder * from an array of objects. * @param columns the new value, not null * @return this, for chaining, not null */
Sets the columns property in the builder from an array of objects
columns
{ "repo_name": "nssales/Strata", "path": "modules/engine/src/main/java/com/opengamma/strata/engine/config/CalculationTasksConfig.java", "license": "apache-2.0", "size": 12839 }
[ "com.google.common.collect.ImmutableList", "com.opengamma.strata.engine.Column" ]
import com.google.common.collect.ImmutableList; import com.opengamma.strata.engine.Column;
import com.google.common.collect.*; import com.opengamma.strata.engine.*;
[ "com.google.common", "com.opengamma.strata" ]
com.google.common; com.opengamma.strata;
2,171,893
public void makeBright(){ Window window = this.getWindow(); LayoutParams params = window.getAttributes(); params.screenBrightness = 1f; window.setAttributes(params); }
void function(){ Window window = this.getWindow(); LayoutParams params = window.getAttributes(); params.screenBrightness = 1f; window.setAttributes(params); }
/** * maximize the brightness of current window */
maximize the brightness of current window
makeBright
{ "repo_name": "harrierjack/android-torch", "path": "app/src/main/java/com/harrierdev/android/torch/NoLightActivity.java", "license": "mit", "size": 749 }
[ "android.view.Window", "android.view.WindowManager" ]
import android.view.Window; import android.view.WindowManager;
import android.view.*;
[ "android.view" ]
android.view;
369,433
@Nullable public static String getString(String name, String dflt) { String val = getString(name); return val == null ? dflt : val; }
@Nullable static String function(String name, String dflt) { String val = getString(name); return val == null ? dflt : val; }
/** * Gets either system property or environment variable with given name. * * @param name Name of the system property or environment variable. * @param dflt Default value. * @return Value of the system property or environment variable. * Returns {@code null} if neither can be found for given name. */
Gets either system property or environment variable with given name
getString
{ "repo_name": "mcherkasov/ignite", "path": "modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java", "license": "apache-2.0", "size": 34746 }
[ "org.jetbrains.annotations.Nullable" ]
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.*;
[ "org.jetbrains.annotations" ]
org.jetbrains.annotations;
2,069,665
@ServiceMethod(returns = ReturnType.SINGLE) public PollerFlux<PollResult<Void>, Void> beginLoadContentAsync( String resourceGroupName, String profileName, String endpointName, List<String> contentPaths) { Mono<Response<Flux<ByteBuffer>>> mono = loadContentWithResponseAsync(resourceGroupName, profileName, endpointName, contentPaths); return this .client .<Void, Void>getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); }
@ServiceMethod(returns = ReturnType.SINGLE) PollerFlux<PollResult<Void>, Void> function( String resourceGroupName, String profileName, String endpointName, List<String> contentPaths) { Mono<Response<Flux<ByteBuffer>>> mono = loadContentWithResponseAsync(resourceGroupName, profileName, endpointName, contentPaths); return this .client .<Void, Void>getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); }
/** * Pre-loads a content to CDN. Available for Verizon Profiles. * * @param resourceGroupName Name of the Resource group within the Azure subscription. * @param profileName Name of the CDN profile which is unique within the resource group. * @param endpointName Name of the endpoint under the profile which is unique globally. * @param contentPaths The path to the content to be loaded. Path should be a relative file URL of the origin. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */
Pre-loads a content to CDN. Available for Verizon Profiles
beginLoadContentAsync
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/resourcemanager/azure-resourcemanager-cdn/src/main/java/com/azure/resourcemanager/cdn/implementation/EndpointsClientImpl.java", "license": "mit", "size": 169310 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.http.rest.Response", "com.azure.core.management.polling.PollResult", "com.azure.core.util.Context", "com.azure.core.util.polling.PollerFlux", "java.nio.ByteBuffer", "java.util.List" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.Response; import com.azure.core.management.polling.PollResult; import com.azure.core.util.Context; import com.azure.core.util.polling.PollerFlux; import java.nio.ByteBuffer; import java.util.List;
import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.management.polling.*; import com.azure.core.util.*; import com.azure.core.util.polling.*; import java.nio.*; import java.util.*;
[ "com.azure.core", "java.nio", "java.util" ]
com.azure.core; java.nio; java.util;
2,602,217
private static String getStringCheckSet(final Configuration conf, final String key) { final String value = conf.get(key); requireNonNull(value, key + " not set"); return value; }
static String function(final Configuration conf, final String key) { final String value = conf.get(key); requireNonNull(value, key + STR); return value; }
/** * get a value from the configuration file and throw an exception if the * value does not exist. * * @param conf * @param key * @return */
get a value from the configuration file and throw an exception if the value does not exist
getStringCheckSet
{ "repo_name": "apache/incubator-rya", "path": "extras/indexing/src/main/java/org/apache/rya/indexing/accumulo/ConfigUtils.java", "license": "apache-2.0", "size": 21985 }
[ "java.util.Objects", "org.apache.hadoop.conf.Configuration" ]
import java.util.Objects; import org.apache.hadoop.conf.Configuration;
import java.util.*; import org.apache.hadoop.conf.*;
[ "java.util", "org.apache.hadoop" ]
java.util; org.apache.hadoop;
2,564,933
public T getLink(String place) { return findByTechnicalSelectorOr(place, LinkBy::heuristic); }
T function(String place) { return findByTechnicalSelectorOr(place, LinkBy::heuristic); }
/** * Finds link. * @param place technical selector or (partial text on link). * @return first interactable link found, * first element found if no interactable link could be found, * null if none could be found. */
Finds link
getLink
{ "repo_name": "GDasai/hsac-fitnesse-fixtures", "path": "src/main/java/nl/hsac/fitnesse/fixture/util/selenium/SeleniumHelper.java", "license": "apache-2.0", "size": 44330 }
[ "nl.hsac.fitnesse.fixture.util.selenium.by.LinkBy" ]
import nl.hsac.fitnesse.fixture.util.selenium.by.LinkBy;
import nl.hsac.fitnesse.fixture.util.selenium.by.*;
[ "nl.hsac.fitnesse" ]
nl.hsac.fitnesse;
2,439,345
public boolean changed() { return this.changed; } /** * Get the {@link RoutingTable} referenced by this result * @return referenced {@link RoutingTable}
boolean function() { return this.changed; } /** * Get the {@link RoutingTable} referenced by this result * @return referenced {@link RoutingTable}
/** determine whether the actual {@link RoutingTable} has been changed * @return <code>true</code> if the {@link RoutingTable} has been changed by allocation. Otherwise <code>false</code> */
determine whether the actual <code>RoutingTable</code> has been changed
changed
{ "repo_name": "moriartyy/elasticsearch160", "path": "src/main/java/org/elasticsearch/cluster/routing/allocation/RoutingAllocation.java", "license": "apache-2.0", "size": 7866 }
[ "org.elasticsearch.cluster.routing.RoutingTable" ]
import org.elasticsearch.cluster.routing.RoutingTable;
import org.elasticsearch.cluster.routing.*;
[ "org.elasticsearch.cluster" ]
org.elasticsearch.cluster;
2,025,470
@Test public void testPartitionIdsUpdates() throws Exception { supervisor = getTestableSupervisor(1, 1, false, "PT1H", null, null); addSomeEvents(1100); Capture<KafkaIndexTask> captured = Capture.newInstance(); EasyMock.expect(taskMaster.getTaskQueue()).andReturn(Optional.of(taskQueue)).anyTimes(); EasyMock.expect(taskMaster.getTaskRunner()).andReturn(Optional.absent()).anyTimes(); EasyMock.expect(taskStorage.getActiveTasksByDatasource(DATASOURCE)).andReturn(ImmutableList.of()).anyTimes(); EasyMock.expect(indexerMetadataStorageCoordinator.retrieveDataSourceMetadata(DATASOURCE)).andReturn( new KafkaDataSourceMetadata( null ) ).anyTimes(); EasyMock.expect(taskQueue.add(EasyMock.capture(captured))).andReturn(true); replayAll(); supervisor.start(); supervisor.runInternal(); verifyAll(); Assert.assertFalse(supervisor.isPartitionIdsEmpty()); }
void function() throws Exception { supervisor = getTestableSupervisor(1, 1, false, "PT1H", null, null); addSomeEvents(1100); Capture<KafkaIndexTask> captured = Capture.newInstance(); EasyMock.expect(taskMaster.getTaskQueue()).andReturn(Optional.of(taskQueue)).anyTimes(); EasyMock.expect(taskMaster.getTaskRunner()).andReturn(Optional.absent()).anyTimes(); EasyMock.expect(taskStorage.getActiveTasksByDatasource(DATASOURCE)).andReturn(ImmutableList.of()).anyTimes(); EasyMock.expect(indexerMetadataStorageCoordinator.retrieveDataSourceMetadata(DATASOURCE)).andReturn( new KafkaDataSourceMetadata( null ) ).anyTimes(); EasyMock.expect(taskQueue.add(EasyMock.capture(captured))).andReturn(true); replayAll(); supervisor.start(); supervisor.runInternal(); verifyAll(); Assert.assertFalse(supervisor.isPartitionIdsEmpty()); }
/** * Test if partitionIds get updated */
Test if partitionIds get updated
testPartitionIdsUpdates
{ "repo_name": "nishantmonu51/druid", "path": "extensions-core/kafka-indexing-service/src/test/java/org/apache/druid/indexing/kafka/supervisor/KafkaSupervisorTest.java", "license": "apache-2.0", "size": 168400 }
[ "com.google.common.base.Optional", "com.google.common.collect.ImmutableList", "org.apache.druid.indexing.kafka.KafkaDataSourceMetadata", "org.apache.druid.indexing.kafka.KafkaIndexTask", "org.easymock.Capture", "org.easymock.EasyMock", "org.junit.Assert" ]
import com.google.common.base.Optional; import com.google.common.collect.ImmutableList; import org.apache.druid.indexing.kafka.KafkaDataSourceMetadata; import org.apache.druid.indexing.kafka.KafkaIndexTask; import org.easymock.Capture; import org.easymock.EasyMock; import org.junit.Assert;
import com.google.common.base.*; import com.google.common.collect.*; import org.apache.druid.indexing.kafka.*; import org.easymock.*; import org.junit.*;
[ "com.google.common", "org.apache.druid", "org.easymock", "org.junit" ]
com.google.common; org.apache.druid; org.easymock; org.junit;
1,902,586
public static void SaveState(ObjectOutputStream stream) { try { stream.writeObject(_timerInstance); } catch(Exception e) { AgentLogger.GetInstance().logAndPrint("Exception: " + e); e.printStackTrace(); } }
static void function(ObjectOutputStream stream) { try { stream.writeObject(_timerInstance); } catch(Exception e) { AgentLogger.GetInstance().logAndPrint(STR + e); e.printStackTrace(); } }
/** * Saves the state of the current AgentSimulationTimer to a * currently opened ObjectOutputStream, the method does not * close the stream and is intended for embedding the timer state * into an output stream containing other objects * @param stream - the open object output stream to save the timer to */
Saves the state of the current AgentSimulationTimer to a currently opened ObjectOutputStream, the method does not close the stream and is intended for embedding the timer state into an output stream containing other objects
SaveState
{ "repo_name": "nurv/lirec", "path": "AgentMind/trunk/AgentMind/FAtiMA/src/FAtiMA/AgentSimulationTime.java", "license": "gpl-3.0", "size": 7687 }
[ "java.io.ObjectOutputStream" ]
import java.io.ObjectOutputStream;
import java.io.*;
[ "java.io" ]
java.io;
2,299,120
private Credential createCredential(Map<String, Object> properties) throws IllegalArgumentException { String principal; String key; if (properties.get(CREDENTIAL_PRINCIPAL_PROPERTY_ID) == null) { throw new IllegalArgumentException("Property " + CREDENTIAL_PRINCIPAL_PROPERTY_ID + " must be provided"); } else { principal = String.valueOf(properties.get(CREDENTIAL_PRINCIPAL_PROPERTY_ID)); } if (properties.get(CREDENTIAL_KEY_PROPERTY_ID) == null) { LOG.warn("The credential is being added without a key"); key = null; } else { key = String.valueOf(properties.get(CREDENTIAL_KEY_PROPERTY_ID)); } return new PrincipalKeyCredential(principal, key); }
Credential function(Map<String, Object> properties) throws IllegalArgumentException { String principal; String key; if (properties.get(CREDENTIAL_PRINCIPAL_PROPERTY_ID) == null) { throw new IllegalArgumentException(STR + CREDENTIAL_PRINCIPAL_PROPERTY_ID + STR); } else { principal = String.valueOf(properties.get(CREDENTIAL_PRINCIPAL_PROPERTY_ID)); } if (properties.get(CREDENTIAL_KEY_PROPERTY_ID) == null) { LOG.warn(STR); key = null; } else { key = String.valueOf(properties.get(CREDENTIAL_KEY_PROPERTY_ID)); } return new PrincipalKeyCredential(principal, key); }
/** * Give a map of credential-related properties attempts to create a Credential (PrincipalKeyCredential) * after validating that the required properties are present. * <p/> * The credential's principal is required, however a warning will be logged if a value for the key * is not supplied. * * @param properties a map of properties * @return a new Credential * @throws IllegalArgumentException if the map of properties does not contain enough information to create * a new PrincipalKeyCredential instance */
Give a map of credential-related properties attempts to create a Credential (PrincipalKeyCredential) after validating that the required properties are present. The credential's principal is required, however a warning will be logged if a value for the key is not supplied
createCredential
{ "repo_name": "zouzhberk/ambaridemo", "path": "demo-server/src/main/java/org/apache/ambari/server/controller/internal/CredentialResourceProvider.java", "license": "apache-2.0", "size": 18475 }
[ "java.util.Map", "org.apache.ambari.server.security.credential.Credential", "org.apache.ambari.server.security.credential.PrincipalKeyCredential" ]
import java.util.Map; import org.apache.ambari.server.security.credential.Credential; import org.apache.ambari.server.security.credential.PrincipalKeyCredential;
import java.util.*; import org.apache.ambari.server.security.credential.*;
[ "java.util", "org.apache.ambari" ]
java.util; org.apache.ambari;
1,358,641
public static List<Integer> optimalPermutation(List<GenPolynomial<BigInteger>> D) { if (D == null) { throw new IllegalArgumentException("list must be non null"); } List<Integer> P = new ArrayList<Integer>(D.size()); if (D.size() == 0) { return P; } if (D.size() == 1) { P.add(0); return P; } SortedMap<GenPolynomial<BigInteger>, List<Integer>> map = new TreeMap<GenPolynomial<BigInteger>, List<Integer>>(); int i = 0; for (GenPolynomial<BigInteger> p : D) { List<Integer> il = map.get(p); if (il == null) { il = new ArrayList<Integer>(3); } il.add(i); map.put(p, il); i++; } List<List<Integer>> V = new ArrayList<List<Integer>>(map.values()); //System.out.println("V = " + V); //for ( int j = V.size()-1; j >= 0; j-- ) { for (int j = 0; j < V.size(); j++) { List<Integer> v = V.get(j); for (Integer k : v) { P.add(k); } } return P; }
static List<Integer> function(List<GenPolynomial<BigInteger>> D) { if (D == null) { throw new IllegalArgumentException(STR); } List<Integer> P = new ArrayList<Integer>(D.size()); if (D.size() == 0) { return P; } if (D.size() == 1) { P.add(0); return P; } SortedMap<GenPolynomial<BigInteger>, List<Integer>> map = new TreeMap<GenPolynomial<BigInteger>, List<Integer>>(); int i = 0; for (GenPolynomial<BigInteger> p : D) { List<Integer> il = map.get(p); if (il == null) { il = new ArrayList<Integer>(3); } il.add(i); map.put(p, il); i++; } List<List<Integer>> V = new ArrayList<List<Integer>>(map.values()); for (int j = 0; j < V.size(); j++) { List<Integer> v = V.get(j); for (Integer k : v) { P.add(k); } } return P; }
/** * Optimal permutation for the Degree matrix. * @param D degree matrix. * @return optimal permutation for D. */
Optimal permutation for the Degree matrix
optimalPermutation
{ "repo_name": "breandan/java-algebra-system", "path": "src/edu/jas/poly/TermOrderOptimization.java", "license": "gpl-2.0", "size": 19600 }
[ "edu.jas.arith.BigInteger", "java.util.ArrayList", "java.util.List", "java.util.SortedMap", "java.util.TreeMap" ]
import edu.jas.arith.BigInteger; import java.util.ArrayList; import java.util.List; import java.util.SortedMap; import java.util.TreeMap;
import edu.jas.arith.*; import java.util.*;
[ "edu.jas.arith", "java.util" ]
edu.jas.arith; java.util;
437,137
EnumeratedIntegerDistribution invalid = null; try { new EnumeratedIntegerDistribution(new int[]{1, 2}, new double[]{0.0}); Assert.fail("Expected DimensionMismatchException"); } catch (DimensionMismatchException e) { } try { new EnumeratedIntegerDistribution(new int[]{1, 2}, new double[]{0.0, -1.0}); Assert.fail("Expected NotPositiveException"); } catch (NotPositiveException e) { } try { new EnumeratedIntegerDistribution(new int[]{1, 2}, new double[]{0.0, 0.0}); Assert.fail("Expected MathArithmeticException"); } catch (MathArithmeticException e) { } try { new EnumeratedIntegerDistribution(new int[]{1, 2}, new double[]{0.0, Double.NaN}); Assert.fail("Expected NotANumberException"); } catch (NotANumberException e) { } try { new EnumeratedIntegerDistribution(new int[]{1, 2}, new double[]{0.0, Double.POSITIVE_INFINITY}); Assert.fail("Expected NotFiniteNumberException"); } catch (NotFiniteNumberException e) { } Assert.assertNull("Expected non-initialized DiscreteRealDistribution", invalid); }
EnumeratedIntegerDistribution invalid = null; try { new EnumeratedIntegerDistribution(new int[]{1, 2}, new double[]{0.0}); Assert.fail(STR); } catch (DimensionMismatchException e) { } try { new EnumeratedIntegerDistribution(new int[]{1, 2}, new double[]{0.0, -1.0}); Assert.fail(STR); } catch (NotPositiveException e) { } try { new EnumeratedIntegerDistribution(new int[]{1, 2}, new double[]{0.0, 0.0}); Assert.fail(STR); } catch (MathArithmeticException e) { } try { new EnumeratedIntegerDistribution(new int[]{1, 2}, new double[]{0.0, Double.NaN}); Assert.fail(STR); } catch (NotANumberException e) { } try { new EnumeratedIntegerDistribution(new int[]{1, 2}, new double[]{0.0, Double.POSITIVE_INFINITY}); Assert.fail(STR); } catch (NotFiniteNumberException e) { } Assert.assertNull(STR, invalid); }
/** * Tests if the EnumeratedIntegerDistribution constructor throws * exceptions for invalid data. */
Tests if the EnumeratedIntegerDistribution constructor throws exceptions for invalid data
testExceptions
{ "repo_name": "tknandu/CommonsMath_Modifed", "path": "math (trunk)/src/test/java/org/apache/commons/math3/distribution/EnumeratedIntegerDistributionTest.java", "license": "apache-2.0", "size": 6321 }
[ "org.apache.commons.math3.exception.DimensionMismatchException", "org.apache.commons.math3.exception.MathArithmeticException", "org.apache.commons.math3.exception.NotANumberException", "org.apache.commons.math3.exception.NotFiniteNumberException", "org.apache.commons.math3.exception.NotPositiveException", "org.junit.Assert" ]
import org.apache.commons.math3.exception.DimensionMismatchException; import org.apache.commons.math3.exception.MathArithmeticException; import org.apache.commons.math3.exception.NotANumberException; import org.apache.commons.math3.exception.NotFiniteNumberException; import org.apache.commons.math3.exception.NotPositiveException; import org.junit.Assert;
import org.apache.commons.math3.exception.*; import org.junit.*;
[ "org.apache.commons", "org.junit" ]
org.apache.commons; org.junit;
1,026,815
protected int getMaxDomainSize() { StudentSectioningModel model = (StudentSectioningModel) getModel(); return model == null ? -1 : model.getMaxDomainSize(); }
int function() { StudentSectioningModel model = (StudentSectioningModel) getModel(); return model == null ? -1 : model.getMaxDomainSize(); }
/** * Maximal domain size (i.e., number of enrollments of a course request), -1 if there is no limit. * @return maximal domain size, -1 if unlimited */
Maximal domain size (i.e., number of enrollments of a course request), -1 if there is no limit
getMaxDomainSize
{ "repo_name": "UniTime/cpsolver", "path": "src/org/cpsolver/studentsct/model/CourseRequest.java", "license": "lgpl-3.0", "size": 52190 }
[ "org.cpsolver.studentsct.StudentSectioningModel" ]
import org.cpsolver.studentsct.StudentSectioningModel;
import org.cpsolver.studentsct.*;
[ "org.cpsolver.studentsct" ]
org.cpsolver.studentsct;
1,467,893
public void generateReport(List<XmlSuite> xmlSuites, List<ISuite> suites, String outputDirectoryName) { removeEmptyDirectories(new File(outputDirectoryName)); File outputDirectory = new File(outputDirectoryName, REPORT_DIRECTORY); outputDirectory.mkdirs(); Collection<TestClassResults> flattenedResults = flattenResults(suites); for (TestClassResults results : flattenedResults) { VelocityContext context = createContext(); context.put(RESULTS_KEY, results); try { generateFile(new File(outputDirectory, results.getTestClass().getName() + '_' + RESULTS_FILE), RESULTS_FILE + TEMPLATE_EXTENSION, context); } catch (Exception ex) { throw new ReportNGException("Failed generating JUnit XML report.", ex); } } }
void function(List<XmlSuite> xmlSuites, List<ISuite> suites, String outputDirectoryName) { removeEmptyDirectories(new File(outputDirectoryName)); File outputDirectory = new File(outputDirectoryName, REPORT_DIRECTORY); outputDirectory.mkdirs(); Collection<TestClassResults> flattenedResults = flattenResults(suites); for (TestClassResults results : flattenedResults) { VelocityContext context = createContext(); context.put(RESULTS_KEY, results); try { generateFile(new File(outputDirectory, results.getTestClass().getName() + '_' + RESULTS_FILE), RESULTS_FILE + TEMPLATE_EXTENSION, context); } catch (Exception ex) { throw new ReportNGException(STR, ex); } } }
/** * Generates a set of XML files (JUnit format) that contain data about the * outcome of the specified test suites. * @param suites Data about the test runs. * @param outputDirectoryName The directory in which to create the report. */
Generates a set of XML files (JUnit format) that contain data about the outcome of the specified test suites
generateReport
{ "repo_name": "donhenton/reportng", "path": "src/main/java/org/uncommons/reportng/JUnitXMLReporter.java", "license": "apache-2.0", "size": 7510 }
[ "java.io.File", "java.util.Collection", "java.util.List", "org.apache.velocity.VelocityContext", "org.testng.ISuite", "org.testng.xml.XmlSuite" ]
import java.io.File; import java.util.Collection; import java.util.List; import org.apache.velocity.VelocityContext; import org.testng.ISuite; import org.testng.xml.XmlSuite;
import java.io.*; import java.util.*; import org.apache.velocity.*; import org.testng.*; import org.testng.xml.*;
[ "java.io", "java.util", "org.apache.velocity", "org.testng", "org.testng.xml" ]
java.io; java.util; org.apache.velocity; org.testng; org.testng.xml;
1,338,441
public BundleInstanceInfo cancelBundleInstance(String bundleId) throws EC2Exception { Map<String, String> params = new HashMap<String, String>(); params.put("BundleId", bundleId); GetMethod method = new GetMethod(); try { CancelBundleTaskResponse response = makeRequestInt(method, "CancelBundleTask", params, CancelBundleTaskResponse.class); BundleInstanceTaskType task = response.getBundleInstanceTask(); return new BundleInstanceInfo(response.getRequestId(), task.getInstanceId(), task.getBundleId(), task.getState(), task.getStartTime().toGregorianCalendar(), task.getUpdateTime().toGregorianCalendar(), task.getStorage(), task.getProgress(), task.getError()); } finally { method.releaseConnection(); } }
BundleInstanceInfo function(String bundleId) throws EC2Exception { Map<String, String> params = new HashMap<String, String>(); params.put(STR, bundleId); GetMethod method = new GetMethod(); try { CancelBundleTaskResponse response = makeRequestInt(method, STR, params, CancelBundleTaskResponse.class); BundleInstanceTaskType task = response.getBundleInstanceTask(); return new BundleInstanceInfo(response.getRequestId(), task.getInstanceId(), task.getBundleId(), task.getState(), task.getStartTime().toGregorianCalendar(), task.getUpdateTime().toGregorianCalendar(), task.getStorage(), task.getProgress(), task.getError()); } finally { method.releaseConnection(); } }
/** * Cancel a bundling operation. * * @param bundleId the Id of the bundle task to cancel * @return information about the cancelled task * @throws EC2Exception wraps checked exceptions */
Cancel a bundling operation
cancelBundleInstance
{ "repo_name": "jonnyzzz/maragogype", "path": "tags/v1.6/java/com/xerox/amazonws/ec2/Jec2.java", "license": "apache-2.0", "size": 81043 }
[ "com.xerox.amazonws.typica.jaxb.BundleInstanceTaskType", "com.xerox.amazonws.typica.jaxb.CancelBundleTaskResponse", "java.util.HashMap", "java.util.Map", "org.apache.commons.httpclient.methods.GetMethod" ]
import com.xerox.amazonws.typica.jaxb.BundleInstanceTaskType; import com.xerox.amazonws.typica.jaxb.CancelBundleTaskResponse; import java.util.HashMap; import java.util.Map; import org.apache.commons.httpclient.methods.GetMethod;
import com.xerox.amazonws.typica.jaxb.*; import java.util.*; import org.apache.commons.httpclient.methods.*;
[ "com.xerox.amazonws", "java.util", "org.apache.commons" ]
com.xerox.amazonws; java.util; org.apache.commons;
494,565
@NotNull public FileType getFileTypeByFileName(@NotNull @NonNls CharSequence fileNameSeq) { return getFileTypeByFileName(fileNameSeq.toString()); }
FileType function(@NotNull @NonNls CharSequence fileNameSeq) { return getFileTypeByFileName(fileNameSeq.toString()); }
/** * Returns the file type for the specified file name. * * @param fileNameSeq The file name for which the type is requested. * @return The file type instance, or {@link FileTypes#UNKNOWN} if not found. */
Returns the file type for the specified file name
getFileTypeByFileName
{ "repo_name": "asedunov/intellij-community", "path": "platform/core-api/src/com/intellij/openapi/fileTypes/FileTypeRegistry.java", "license": "apache-2.0", "size": 4319 }
[ "org.jetbrains.annotations.NonNls", "org.jetbrains.annotations.NotNull" ]
import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.*;
[ "org.jetbrains.annotations" ]
org.jetbrains.annotations;
2,193,127
public ThreadInfo[] getAllThreadInfo(ThreadMXBean threadMXBean) { ThreadInfo[] allThreadInfo = threadMXBean.dumpAllThreads(true, true); return allThreadInfo; }
ThreadInfo[] function(ThreadMXBean threadMXBean) { ThreadInfo[] allThreadInfo = threadMXBean.dumpAllThreads(true, true); return allThreadInfo; }
/** * return ThreadInfo of all threads * * @param threadMXBean ThreadMXBean object of remote VM. * @return Array of ThreadInfo objects */
return ThreadInfo of all threads
getAllThreadInfo
{ "repo_name": "suhand/carbon-platform-integration", "path": "test-automation-framework/org.wso2.carbon.automation.test.utils/src/main/java/org/wso2/carbon/automation/test/utils/jmxclient/threadinfo/ThreadInformationProvider.java", "license": "apache-2.0", "size": 8891 }
[ "java.lang.management.ThreadInfo", "java.lang.management.ThreadMXBean" ]
import java.lang.management.ThreadInfo; import java.lang.management.ThreadMXBean;
import java.lang.management.*;
[ "java.lang" ]
java.lang;
163,037
public Claim copy(Claim object) { if (this.deepCopy) { return deepCopyClaim(object); } else { return this.dataObjectFactory.getClaim(object.getSubject(), object.getMainSnak(), object.getQualifiers()); } }
Claim function(Claim object) { if (this.deepCopy) { return deepCopyClaim(object); } else { return this.dataObjectFactory.getClaim(object.getSubject(), object.getMainSnak(), object.getQualifiers()); } }
/** * Copies a {@link Claim}. * * @param object * object to copy * @return copied object */
Copies a <code>Claim</code>
copy
{ "repo_name": "notconfusing/Wikidata-Toolkit", "path": "wdtk-datamodel/src/main/java/org/wikidata/wdtk/datamodel/helpers/DatamodelConverter.java", "license": "apache-2.0", "size": 28518 }
[ "org.wikidata.wdtk.datamodel.interfaces.Claim" ]
import org.wikidata.wdtk.datamodel.interfaces.Claim;
import org.wikidata.wdtk.datamodel.interfaces.*;
[ "org.wikidata.wdtk" ]
org.wikidata.wdtk;
2,825,769
LOG.debug("Scanning for classpath resources at '" + path + "' (Prefix: '" + prefix + "', Suffix: '" + suffix + "')"); Set<Resource> resources = new TreeSet<Resource>(); Set<String> resourceNames = findResourceNames(path, prefix, suffix); for (String resourceName : resourceNames) { resources.add(new ClassPathResource(resourceName, classLoader)); LOG.debug("Found resource: " + resourceName); } return resources.toArray(new Resource[resources.size()]); }
LOG.debug(STR + path + STR + prefix + STR + suffix + "')"); Set<Resource> resources = new TreeSet<Resource>(); Set<String> resourceNames = findResourceNames(path, prefix, suffix); for (String resourceName : resourceNames) { resources.add(new ClassPathResource(resourceName, classLoader)); LOG.debug(STR + resourceName); } return resources.toArray(new Resource[resources.size()]); }
/** * Scans the classpath for resources under the specified location, starting with the specified prefix and ending with * the specified suffix. * * @param path The path in the classpath to start searching. Subdirectories are also searched. * @param prefix The prefix of the resource names to match. * @param suffix The suffix of the resource names to match. * @return The resources that were found. * @throws IOException when the location could not be scanned. */
Scans the classpath for resources under the specified location, starting with the specified prefix and ending with the specified suffix
scanForResources
{ "repo_name": "mpage23/flyway", "path": "flyway-core/src/main/java/org/flywaydb/core/internal/util/scanner/classpath/ClassPathScanner.java", "license": "apache-2.0", "size": 11158 }
[ "java.util.Set", "java.util.TreeSet", "org.flywaydb.core.internal.util.scanner.Resource" ]
import java.util.Set; import java.util.TreeSet; import org.flywaydb.core.internal.util.scanner.Resource;
import java.util.*; import org.flywaydb.core.internal.util.scanner.*;
[ "java.util", "org.flywaydb.core" ]
java.util; org.flywaydb.core;
2,590,773
@Nonnull DistributionPackageInfo importStream(@Nonnull ResourceResolver resourceResolver, @Nonnull InputStream stream) throws DistributionException;
DistributionPackageInfo importStream(@Nonnull ResourceResolver resourceResolver, @Nonnull InputStream stream) throws DistributionException;
/** * Tries to convert an {@link java.io.InputStream} to a {@link DistributionPackage} and then imports it into the underlying system * * @param resourceResolver - the resource resolver used to read the package * @param stream the {@link InputStream} of the package to be converted and imported * @return a {@link DistributionPackageInfo} if the stream has been successfully converted and imported * @throws DistributionException when the stream cannot be read as a {@link DistributionPackage} and imported */
Tries to convert an <code>java.io.InputStream</code> to a <code>DistributionPackage</code> and then imports it into the underlying system
importStream
{ "repo_name": "Nimco/sling", "path": "contrib/extensions/distribution/core/src/main/java/org/apache/sling/distribution/packaging/DistributionPackageImporter.java", "license": "apache-2.0", "size": 2581 }
[ "java.io.InputStream", "javax.annotation.Nonnull", "org.apache.sling.api.resource.ResourceResolver", "org.apache.sling.distribution.common.DistributionException" ]
import java.io.InputStream; import javax.annotation.Nonnull; import org.apache.sling.api.resource.ResourceResolver; import org.apache.sling.distribution.common.DistributionException;
import java.io.*; import javax.annotation.*; import org.apache.sling.api.resource.*; import org.apache.sling.distribution.common.*;
[ "java.io", "javax.annotation", "org.apache.sling" ]
java.io; javax.annotation; org.apache.sling;
605,647
public void setTextIsSelectable(boolean selectable) { if (!selectable && mEditor == null) return; // false is default value with no edit data createEditorIfNeeded(); if (mEditor.mTextIsSelectable == selectable) return; mEditor.mTextIsSelectable = selectable; setFocusableInTouchMode(selectable); setFocusable(selectable); setClickable(selectable); setLongClickable(selectable); // mInputType should already be EditorInfo.TYPE_NULL and mInput should be null setMovementMethod(selectable ? ArrowKeyMovementMethod.getInstance() : null); setText(mText, selectable ? BufferType.SPANNABLE : BufferType.NORMAL); // Called by setText above, but safer in case of future code changes mEditor.prepareCursorControllers(); }
void function(boolean selectable) { if (!selectable && mEditor == null) return; createEditorIfNeeded(); if (mEditor.mTextIsSelectable == selectable) return; mEditor.mTextIsSelectable = selectable; setFocusableInTouchMode(selectable); setFocusable(selectable); setClickable(selectable); setLongClickable(selectable); setMovementMethod(selectable ? ArrowKeyMovementMethod.getInstance() : null); setText(mText, selectable ? BufferType.SPANNABLE : BufferType.NORMAL); mEditor.prepareCursorControllers(); }
/** * Sets whether or not (default) the content of this view is selectable by the user. * Note that this methods affect the {@link #setFocusable(boolean)}, {@link #setFocusableInTouchMode(boolean)} {@link #setClickable(boolean)} and {@link #setLongClickable(boolean)} states and you may want to restore these if they were * customized. * See {@link #isTextSelectable} for details. * * @param selectable * Whether or not the content of this TextView should be selectable. */
Sets whether or not (default) the content of this view is selectable by the user. Note that this methods affect the <code>#setFocusable(boolean)</code>, <code>#setFocusableInTouchMode(boolean)</code> <code>#setClickable(boolean)</code> and <code>#setLongClickable(boolean)</code> states and you may want to restore these if they were customized. See <code>#isTextSelectable</code> for details
setTextIsSelectable
{ "repo_name": "haikuowuya/android_system_code", "path": "src/android/widget/TextView.java", "license": "apache-2.0", "size": 271830 }
[ "android.text.method.ArrowKeyMovementMethod" ]
import android.text.method.ArrowKeyMovementMethod;
import android.text.method.*;
[ "android.text" ]
android.text;
31,441
// type parameter <S> lets us avoid the extra <String> in statements like: // Ordering<String> o = Ordering.<String>natural().nullsLast(); @GwtCompatible(serializable = true) public <S extends T> Ordering<S> nullsLast() { return new NullsLastOrdering<S>(this); }
@GwtCompatible(serializable = true) <S extends T> Ordering<S> function() { return new NullsLastOrdering<S>(this); }
/** * Returns an ordering that treats {@code null} as greater than all other * values and uses this ordering to compare non-null values. */
Returns an ordering that treats null as greater than all other values and uses this ordering to compare non-null values
nullsLast
{ "repo_name": "eoneil1942/voltdb-4.7fix", "path": "third_party/java/src/com/google_voltpatches/common/collect/Ordering.java", "license": "agpl-3.0", "size": 34926 }
[ "com.google_voltpatches.common.annotations.GwtCompatible" ]
import com.google_voltpatches.common.annotations.GwtCompatible;
import com.google_voltpatches.common.annotations.*;
[ "com.google_voltpatches.common" ]
com.google_voltpatches.common;
2,622,719
return Node.createAnon(new AnonId(uri + "#bean-" + propertyUri.hashCode() + "-" + bean.toString().hashCode())); }
return Node.createAnon(new AnonId(uri + STR + propertyUri.hashCode() + "-" + bean.toString().hashCode())); }
/** * Creates an anonymous node (blank node) for the use in {@link GabotoBean}s. * * @param uri * The URI of the corresponding entity. * @param propertyUri * The URI of the corresponding property. * * @return A new blank node with a reconstructible URI. * @see GabotoBean */
Creates an anonymous node (blank node) for the use in <code>GabotoBean</code>s
createAnonForBean
{ "repo_name": "ox-it/gaboto", "path": "src/main/java/net/sf/gaboto/node/GabotoEntityUtils.java", "license": "bsd-3-clause", "size": 21606 }
[ "com.hp.hpl.jena.graph.Node", "com.hp.hpl.jena.rdf.model.AnonId" ]
import com.hp.hpl.jena.graph.Node; import com.hp.hpl.jena.rdf.model.AnonId;
import com.hp.hpl.jena.graph.*; import com.hp.hpl.jena.rdf.model.*;
[ "com.hp.hpl" ]
com.hp.hpl;
857,681
// [START on_invite_clicked] private void onInviteClicked() { Intent intent = new AppInviteInvitation.IntentBuilder(getString(R.string.invitation_title)) .setMessage(getString(R.string.invitation_message)) .setDeepLink(Uri.parse(getString(R.string.invitation_deep_link))) .setCustomImage(Uri.parse(getString(R.string.invitation_custom_image))) .setCallToActionText(getString(R.string.invitation_cta)) .build(); startActivityForResult(intent, REQUEST_INVITE); } // [END on_invite_clicked]
void function() { Intent intent = new AppInviteInvitation.IntentBuilder(getString(R.string.invitation_title)) .setMessage(getString(R.string.invitation_message)) .setDeepLink(Uri.parse(getString(R.string.invitation_deep_link))) .setCustomImage(Uri.parse(getString(R.string.invitation_custom_image))) .setCallToActionText(getString(R.string.invitation_cta)) .build(); startActivityForResult(intent, REQUEST_INVITE); }
/** * User has clicked the 'Invite' button, launch the invitation UI with the proper * title, message, and deep link */
User has clicked the 'Invite' button, launch the invitation UI with the proper title, message, and deep link
onInviteClicked
{ "repo_name": "leonwrath/ProjectWednsday", "path": "android/appinvites/app/src/main/java/com/google/android/gms/samples/appinvite/MainActivity.java", "license": "apache-2.0", "size": 7383 }
[ "android.content.Intent", "android.net.Uri", "com.google.android.gms.appinvite.AppInviteInvitation" ]
import android.content.Intent; import android.net.Uri; import com.google.android.gms.appinvite.AppInviteInvitation;
import android.content.*; import android.net.*; import com.google.android.gms.appinvite.*;
[ "android.content", "android.net", "com.google.android" ]
android.content; android.net; com.google.android;
362,836
public Map getIndex() { Hashtable availableIndexes = new Hashtable(); for (final Object ind : this.indexes.values()) { // Check if the returned value is instance of Index (this means // the index is not in create phase, its created successfully). if (ind instanceof Index) { availableIndexes.put(((Index) ind).getName(), ind); } } return availableIndexes; }
Map function() { Hashtable availableIndexes = new Hashtable(); for (final Object ind : this.indexes.values()) { if (ind instanceof Index) { availableIndexes.put(((Index) ind).getName(), ind); } } return availableIndexes; }
/** * Returns the map containing all the indexes on this partitioned region. * * @return Map of all the indexes created. */
Returns the map containing all the indexes on this partitioned region
getIndex
{ "repo_name": "smgoller/geode", "path": "geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java", "license": "apache-2.0", "size": 379988 }
[ "java.util.Hashtable", "java.util.Map", "org.apache.geode.cache.query.Index" ]
import java.util.Hashtable; import java.util.Map; import org.apache.geode.cache.query.Index;
import java.util.*; import org.apache.geode.cache.query.*;
[ "java.util", "org.apache.geode" ]
java.util; org.apache.geode;
782,216
// value can be specified by either attribute or tag private static String getAttributeOrTagValue (Node node, ParseState ps, String attributeName) { // AIML 2.0 //log.info("getAttributeOrTagValue "+attributeName); String result = ""; Node m = node.getAttributes().getNamedItem(attributeName); if (m == null) { NodeList childList = node.getChildNodes(); result = null; // no attribute or tag named attributeName for (int i = 0; i < childList.getLength(); i++) { Node child = childList.item(i); //log.info("getAttributeOrTagValue child = "+child.getNodeName()); if (child.getNodeName().equals(attributeName)) { result = evalTagContent(child, ps, null); //log.info("getAttributeOrTagValue result from child = "+result); } } } else { result = m.getNodeValue(); } //log.info("getAttributeOrTagValue "+attributeName+" = "+result); return result; }
static String function (Node node, ParseState ps, String attributeName) { String result = ""; Node m = node.getAttributes().getNamedItem(attributeName); if (m == null) { NodeList childList = node.getChildNodes(); result = null; for (int i = 0; i < childList.getLength(); i++) { Node child = childList.item(i); if (child.getNodeName().equals(attributeName)) { result = evalTagContent(child, ps, null); } } } else { result = m.getNodeValue(); } return result; }
/** * in AIML 2.0, an attribute value can be specified by either an XML attribute value * or a subtag of the same name. This function tries to read the value from the XML attribute first, * then tries to look for the subtag. * * @param node current parse node. * @param ps current parse state. * @param attributeName the name of the attribute. * @return the attribute value. */
in AIML 2.0, an attribute value can be specified by either an XML attribute value or a subtag of the same name. This function tries to read the value from the XML attribute first, then tries to look for the subtag
getAttributeOrTagValue
{ "repo_name": "lumenitb/program-ab", "path": "src/main/java/org/alicebot/ab/AIMLProcessor.java", "license": "lgpl-3.0", "size": 48832 }
[ "org.w3c.dom.Node", "org.w3c.dom.NodeList" ]
import org.w3c.dom.Node; import org.w3c.dom.NodeList;
import org.w3c.dom.*;
[ "org.w3c.dom" ]
org.w3c.dom;
1,959,628
public static List<Integer> findFieldSeparatorIndicesInSegment(byte[] hl7MessageBytes, int startingIndex) { List<Integer> fieldSeparatorIndices = new LinkedList<>(); if (hl7MessageBytes != null && hl7MessageBytes.length > startingIndex && hl7MessageBytes.length > 3) { final byte fieldSeparator = hl7MessageBytes[3]; for (int i = startingIndex; i < hl7MessageBytes.length; ++i) { if (fieldSeparator == hl7MessageBytes[i]) { fieldSeparatorIndices.add(i); } else if (MllpProtocolConstants.SEGMENT_DELIMITER == hl7MessageBytes[i]) { fieldSeparatorIndices.add(i); break; } } } return fieldSeparatorIndices; }
static List<Integer> function(byte[] hl7MessageBytes, int startingIndex) { List<Integer> fieldSeparatorIndices = new LinkedList<>(); if (hl7MessageBytes != null && hl7MessageBytes.length > startingIndex && hl7MessageBytes.length > 3) { final byte fieldSeparator = hl7MessageBytes[3]; for (int i = startingIndex; i < hl7MessageBytes.length; ++i) { if (fieldSeparator == hl7MessageBytes[i]) { fieldSeparatorIndices.add(i); } else if (MllpProtocolConstants.SEGMENT_DELIMITER == hl7MessageBytes[i]) { fieldSeparatorIndices.add(i); break; } } } return fieldSeparatorIndices; }
/** * Find the field separator indices in the Segment. * * NOTE: The last element of the list will be the index of the end of the segment. * * @param hl7MessageBytes the HL7 binary message * @param startingIndex index of the beginning of the HL7 Segment * * @return List of the field separator indices, which may be empty. */
Find the field separator indices in the Segment
findFieldSeparatorIndicesInSegment
{ "repo_name": "pax95/camel", "path": "components/camel-mllp/src/main/java/org/apache/camel/component/mllp/internal/Hl7Util.java", "license": "apache-2.0", "size": 19944 }
[ "java.util.LinkedList", "java.util.List", "org.apache.camel.component.mllp.MllpProtocolConstants" ]
import java.util.LinkedList; import java.util.List; import org.apache.camel.component.mllp.MllpProtocolConstants;
import java.util.*; import org.apache.camel.component.mllp.*;
[ "java.util", "org.apache.camel" ]
java.util; org.apache.camel;
470,291
@WebMethod(operationName = "cambioPrecioProducto") public RespuestaEntity cambioPrecioProducto(@WebParam(name = "tius_tius") Integer usuario, @WebParam(name = "sede_sede") Integer sede, @WebParam(name = "dska_dska") Integer dska, @WebParam(name = "precio") BigDecimal precio, @WebParam(name = "precioUni") BigDecimal precioUni, @WebParam(name = "precioDec") BigDecimal precioDec, @WebParam(name = "precioMil") BigDecimal precioMil, @WebParam(name = "precioEstatic") String precioEstatic) { RespuestaEntity rta = null; try (ProductoLogic objLogic = new ProductoLogic()) { rta = objLogic.cambioPrecioProducto(usuario, sede, dska, precio, precioUni, precioDec, precioMil, precioEstatic); } catch (Exception e) { e.printStackTrace(); } return rta; }
@WebMethod(operationName = STR) RespuestaEntity function(@WebParam(name = STR) Integer usuario, @WebParam(name = STR) Integer sede, @WebParam(name = STR) Integer dska, @WebParam(name = STR) BigDecimal precio, @WebParam(name = STR) BigDecimal precioUni, @WebParam(name = STR) BigDecimal precioDec, @WebParam(name = STR) BigDecimal precioMil, @WebParam(name = STR) String precioEstatic) { RespuestaEntity rta = null; try (ProductoLogic objLogic = new ProductoLogic()) { rta = objLogic.cambioPrecioProducto(usuario, sede, dska, precio, precioUni, precioDec, precioMil, precioEstatic); } catch (Exception e) { e.printStackTrace(); } return rta; }
/** * Funcion con la cual cambio el precio del producto * * @param usuario * @param sede * @param dska * @param precio * @return */
Funcion con la cual cambio el precio del producto
cambioPrecioProducto
{ "repo_name": "codesoftware/SIGEMCOWS", "path": "src/java/co/com/codesoftware/server/nsigemco/AdministrationEndPoint.java", "license": "apache-2.0", "size": 26210 }
[ "co.com.codesoftware.logic.ProductoLogic", "co.com.codesoftware.persistence.entity.administracion.RespuestaEntity", "java.math.BigDecimal", "javax.jws.WebMethod", "javax.jws.WebParam" ]
import co.com.codesoftware.logic.ProductoLogic; import co.com.codesoftware.persistence.entity.administracion.RespuestaEntity; import java.math.BigDecimal; import javax.jws.WebMethod; import javax.jws.WebParam;
import co.com.codesoftware.logic.*; import co.com.codesoftware.persistence.entity.administracion.*; import java.math.*; import javax.jws.*;
[ "co.com.codesoftware", "java.math", "javax.jws" ]
co.com.codesoftware; java.math; javax.jws;
1,054,132
@ServiceMethod(returns = ReturnType.SINGLE) private Mono<Response<AgentPoolInner>> getWithResponseAsync( String resourceGroupName, String resourceName, String agentPoolName, Context context) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } if (resourceName == null) { return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); } if (agentPoolName == null) { return Mono.error(new IllegalArgumentException("Parameter agentPoolName is required and cannot be null.")); } final String apiVersion = "2020-06-01"; context = this.client.mergeContext(context); return service .get( this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), resourceGroupName, resourceName, agentPoolName, context); }
@ServiceMethod(returns = ReturnType.SINGLE) Mono<Response<AgentPoolInner>> function( String resourceGroupName, String resourceName, String agentPoolName, Context context) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( STR)); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( STR)); } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException(STR)); } if (resourceName == null) { return Mono.error(new IllegalArgumentException(STR)); } if (agentPoolName == null) { return Mono.error(new IllegalArgumentException(STR)); } final String apiVersion = STR; context = this.client.mergeContext(context); return service .get( this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), resourceGroupName, resourceName, agentPoolName, context); }
/** * Gets the details of the agent pool by managed cluster and resource group. * * @param resourceGroupName The name of the resource group. * @param resourceName The name of the managed cluster resource. * @param agentPoolName The name of the agent pool. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the details of the agent pool by managed cluster and resource group. */
Gets the details of the agent pool by managed cluster and resource group
getWithResponseAsync
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/resourcemanager/azure-resourcemanager-containerservice/src/main/java/com/azure/resourcemanager/containerservice/implementation/AgentPoolsClientImpl.java", "license": "mit", "size": 70622 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.http.rest.Response", "com.azure.core.util.Context", "com.azure.resourcemanager.containerservice.fluent.models.AgentPoolInner" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.Response; import com.azure.core.util.Context; import com.azure.resourcemanager.containerservice.fluent.models.AgentPoolInner;
import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.util.*; import com.azure.resourcemanager.containerservice.fluent.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
587,643
@Override public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { if (itemPropertyDescriptors == null) { super.getPropertyDescriptors(object); } return itemPropertyDescriptors; }
List<IItemPropertyDescriptor> function(Object object) { if (itemPropertyDescriptors == null) { super.getPropertyDescriptors(object); } return itemPropertyDescriptors; }
/** * This returns the property descriptors for the adapted class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
This returns the property descriptors for the adapted class.
getPropertyDescriptors
{ "repo_name": "nwnpallewela/devstudio-tooling-esb", "path": "plugins/org.wso2.developerstudio.eclipse.gmf.esb.edit/src/org/wso2/developerstudio/eclipse/gmf/esb/provider/AddressingEndpointInputConnectorItemProvider.java", "license": "apache-2.0", "size": 3490 }
[ "java.util.List", "org.eclipse.emf.edit.provider.IItemPropertyDescriptor" ]
import java.util.List; import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
import java.util.*; import org.eclipse.emf.edit.provider.*;
[ "java.util", "org.eclipse.emf" ]
java.util; org.eclipse.emf;
1,568,861
@Override public void actionPerformed(ActionEvent e) { final MainWindow mainWin = MainWindow.getInstance(); try { mainWin.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); final ProjectSelector dlg = new ProjectSelector(mainWin);
void function(ActionEvent e) { final MainWindow mainWin = MainWindow.getInstance(); try { mainWin.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); final ProjectSelector dlg = new ProjectSelector(mainWin);
/** * Perform the action. */
Perform the action
actionPerformed
{ "repo_name": "Paolo-Maffei/freebus-fts", "path": "freebus-fts-client/src/main/java/org/freebus/fts/client/actions/OpenProjectAction.java", "license": "gpl-3.0", "size": 2066 }
[ "java.awt.Cursor", "java.awt.event.ActionEvent", "org.freebus.fts.client.application.MainWindow", "org.freebus.fts.client.dialogs.ProjectSelector" ]
import java.awt.Cursor; import java.awt.event.ActionEvent; import org.freebus.fts.client.application.MainWindow; import org.freebus.fts.client.dialogs.ProjectSelector;
import java.awt.*; import java.awt.event.*; import org.freebus.fts.client.application.*; import org.freebus.fts.client.dialogs.*;
[ "java.awt", "org.freebus.fts" ]
java.awt; org.freebus.fts;
1,026,178
protected void unsetLocationService(WsLocationAdmin locationService) { }
void function(WsLocationAdmin locationService) { }
/** * Required <code>WsLocationAdmin</code> service instance. * Called to unset intermediate dynamic references or after * deactivate. Do nothing. * * @param locationService * a location service */
Required <code>WsLocationAdmin</code> service instance. Called to unset intermediate dynamic references or after deactivate. Do nothing
unsetLocationService
{ "repo_name": "kgibm/open-liberty", "path": "dev/com.ibm.ws.kernel.feature.core/src/com/ibm/ws/kernel/feature/internal/FeatureManager.java", "license": "epl-1.0", "size": 113378 }
[ "com.ibm.wsspi.kernel.service.location.WsLocationAdmin" ]
import com.ibm.wsspi.kernel.service.location.WsLocationAdmin;
import com.ibm.wsspi.kernel.service.location.*;
[ "com.ibm.wsspi" ]
com.ibm.wsspi;
2,368,470
public static int getDateDif(Date pDataInicio, Date pDataFim){ if (pDataInicio.equals(pDataFim)){ return 0; } //Calcula intervalo entre as datas desprezando fusohorário return Days.daysBetween(new DateTime(pDataInicio).toLocalDate(), new DateTime(pDataFim).toLocalDate()).getDays(); }
static int function(Date pDataInicio, Date pDataFim){ if (pDataInicio.equals(pDataFim)){ return 0; } return Days.daysBetween(new DateTime(pDataInicio).toLocalDate(), new DateTime(pDataFim).toLocalDate()).getDays(); }
/** * Calcula a quantidade de dias entre duas datas * @param pDataInicio Data Inicio * @param pDataFim Data Fim * @return Quantidade de dias */
Calcula a quantidade de dias entre duas datas
getDateDif
{ "repo_name": "dbsoftcombr/dbssdk", "path": "src/main/java/br/com/dbsoft/util/DBSDate.java", "license": "mit", "size": 65869 }
[ "java.sql.Date", "org.joda.time.DateTime", "org.joda.time.Days" ]
import java.sql.Date; import org.joda.time.DateTime; import org.joda.time.Days;
import java.sql.*; import org.joda.time.*;
[ "java.sql", "org.joda.time" ]
java.sql; org.joda.time;
1,605,951
public Observable<ServiceResponse<ConnectionResetSharedKeyInner>> beginResetSharedKeyWithServiceResponseAsync(String resourceGroupName, String virtualNetworkGatewayConnectionName, int keyLength) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (virtualNetworkGatewayConnectionName == null) { throw new IllegalArgumentException("Parameter virtualNetworkGatewayConnectionName is required and cannot be null."); } if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); }
Observable<ServiceResponse<ConnectionResetSharedKeyInner>> function(String resourceGroupName, String virtualNetworkGatewayConnectionName, int keyLength) { if (resourceGroupName == null) { throw new IllegalArgumentException(STR); } if (virtualNetworkGatewayConnectionName == null) { throw new IllegalArgumentException(STR); } if (this.client.subscriptionId() == null) { throw new IllegalArgumentException(STR); }
/** * The VirtualNetworkGatewayConnectionResetSharedKey operation resets the virtual network gateway connection shared key for passed virtual network gateway connection in the specified resource group through Network resource provider. * * @param resourceGroupName The name of the resource group. * @param virtualNetworkGatewayConnectionName The virtual network gateway connection reset shared key Name. * @param keyLength The virtual network connection reset shared key length, should between 1 and 128. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the ConnectionResetSharedKeyInner object */
The VirtualNetworkGatewayConnectionResetSharedKey operation resets the virtual network gateway connection shared key for passed virtual network gateway connection in the specified resource group through Network resource provider
beginResetSharedKeyWithServiceResponseAsync
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/network/mgmt-v2019_07_01/src/main/java/com/microsoft/azure/management/network/v2019_07_01/implementation/VirtualNetworkGatewayConnectionsInner.java", "license": "mit", "size": 146427 }
[ "com.microsoft.rest.ServiceResponse" ]
import com.microsoft.rest.ServiceResponse;
import com.microsoft.rest.*;
[ "com.microsoft.rest" ]
com.microsoft.rest;
508,004
public Currency getCurrency() { return Currency.getInstance(mCommodity.getCurrencyCode()); }
Currency function() { return Currency.getInstance(mCommodity.getCurrencyCode()); }
/** * Returns the currency of the money object * @return {@link Currency} of the money value */
Returns the currency of the money object
getCurrency
{ "repo_name": "aint/gnucash-android", "path": "app/src/main/java/org/gnucash/android/model/Money.java", "license": "apache-2.0", "size": 17899 }
[ "java.util.Currency" ]
import java.util.Currency;
import java.util.*;
[ "java.util" ]
java.util;
2,914,732
public Map<String, NXorientation> getAllOrientation();
Map<String, NXorientation> function();
/** * Get all NXorientation nodes: * <ul> * <li> * orientation of component</li> * </ul> * * @return a map from node names to the NXorientation for that node. */
Get all NXorientation nodes: orientation of component
getAllOrientation
{ "repo_name": "jonahkichwacoders/dawnsci", "path": "org.eclipse.dawnsci.nexus/src/org/eclipse/dawnsci/nexus/NXgeometry.java", "license": "epl-1.0", "size": 3757 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
259,250
final IteratorSetting setting = new IteratorSetting(1, "startTimeIterator", TimestampFilter.class); TimestampFilter.setStart(setting, time.getTime(), true); TimestampFilter.setEnd(setting, Long.MAX_VALUE, true); return setting; }
final IteratorSetting setting = new IteratorSetting(1, STR, TimestampFilter.class); TimestampFilter.setStart(setting, time.getTime(), true); TimestampFilter.setEnd(setting, Long.MAX_VALUE, true); return setting; }
/** * Creates an {@link IteratorSetting} with a time stamp filter that starts with the specified data. * @param time the start time of the filter. * @return the {@link IteratorSetting}. */
Creates an <code>IteratorSetting</code> with a time stamp filter that starts with the specified data
getStartTimeSetting
{ "repo_name": "apache/incubator-rya", "path": "extras/rya.export/export.accumulo/src/main/java/org/apache/rya/export/accumulo/policy/TimestampPolicyAccumuloRyaStatementStore.java", "license": "apache-2.0", "size": 2609 }
[ "org.apache.accumulo.core.client.IteratorSetting", "org.apache.accumulo.core.iterators.user.TimestampFilter" ]
import org.apache.accumulo.core.client.IteratorSetting; import org.apache.accumulo.core.iterators.user.TimestampFilter;
import org.apache.accumulo.core.client.*; import org.apache.accumulo.core.iterators.user.*;
[ "org.apache.accumulo" ]
org.apache.accumulo;
2,897,298
@Test public void testBounds() throws SQLException { GeoPackageTestUtils.testBounds(activity, geoPackage); }
void function() throws SQLException { GeoPackageTestUtils.testBounds(activity, geoPackage); }
/** * Test bounds * * @throws SQLException * upon error */
Test bounds
testBounds
{ "repo_name": "ngageoint/geopackage-android", "path": "geopackage-sdk/src/androidTest/java/mil/nga/geopackage/GeoPackageCreateTest.java", "license": "mit", "size": 2155 }
[ "java.sql.SQLException" ]
import java.sql.SQLException;
import java.sql.*;
[ "java.sql" ]
java.sql;
2,397,280
@Override public void hflush() throws IOException { if (out instanceof Syncable) { flush(); ((Syncable) out).hflush(); } else { if (!downgradeSyncable) { throw new UnsupportedOperationException("hflush not supported by " + out); } else { flush(); } } }
void function() throws IOException { if (out instanceof Syncable) { flush(); ((Syncable) out).hflush(); } else { if (!downgradeSyncable) { throw new UnsupportedOperationException(STR + out); } else { flush(); } } }
/** * If the inner stream is Syncable, flush the buffer and then * invoke the inner stream's hflush() operation. * * Otherwise: throw an exception, unless the stream was constructed with * {@link #downgradeSyncable} set to true, in which case the stream * is just flushed. * @throws IOException IO Problem * @throws UnsupportedOperationException if the inner class is not syncable */
If the inner stream is Syncable, flush the buffer and then invoke the inner stream's hflush() operation. Otherwise: throw an exception, unless the stream was constructed with <code>#downgradeSyncable</code> set to true, in which case the stream is just flushed
hflush
{ "repo_name": "mapr/hadoop-common", "path": "hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/statistics/BufferedIOStatisticsOutputStream.java", "license": "apache-2.0", "size": 4955 }
[ "java.io.IOException", "org.apache.hadoop.fs.Syncable" ]
import java.io.IOException; import org.apache.hadoop.fs.Syncable;
import java.io.*; import org.apache.hadoop.fs.*;
[ "java.io", "org.apache.hadoop" ]
java.io; org.apache.hadoop;
482,218
public RequestBody serialize(Object obj, String contentType) throws ApiException { if (obj instanceof byte[]) { // Binary (byte array) body parameter support. return RequestBody.create(MediaType.parse(contentType), (byte[]) obj); } else if (obj instanceof File) { // File body parameter support. return RequestBody.create(MediaType.parse(contentType), (File) obj); } else if (isJsonMime(contentType)) { String content; if (obj != null) { content = json.serialize(obj); } else { content = null; } return RequestBody.create(MediaType.parse(contentType), content); } else { throw new ApiException("Content type \"" + contentType + "\" is not supported"); } }
RequestBody function(Object obj, String contentType) throws ApiException { if (obj instanceof byte[]) { return RequestBody.create(MediaType.parse(contentType), (byte[]) obj); } else if (obj instanceof File) { return RequestBody.create(MediaType.parse(contentType), (File) obj); } else if (isJsonMime(contentType)) { String content; if (obj != null) { content = json.serialize(obj); } else { content = null; } return RequestBody.create(MediaType.parse(contentType), content); } else { throw new ApiException(STRSTR\STR); } }
/** * Serialize the given Java object into request body according to the object's * class and the request Content-Type. * * @param obj The Java object * @param contentType The request Content-Type * @return The serialized request body * @throws ApiException If fail to serialize the given object */
Serialize the given Java object into request body according to the object's class and the request Content-Type
serialize
{ "repo_name": "A-Team-hackathon/Hackathon2016", "path": "textanalytics-client/src/main/java/org/pontis/hackathon/ApiClient.java", "license": "apache-2.0", "size": 47957 }
[ "com.squareup.okhttp.MediaType", "com.squareup.okhttp.RequestBody", "java.io.File" ]
import com.squareup.okhttp.MediaType; import com.squareup.okhttp.RequestBody; import java.io.File;
import com.squareup.okhttp.*; import java.io.*;
[ "com.squareup.okhttp", "java.io" ]
com.squareup.okhttp; java.io;
2,148,432
void reset() throws IOException { packer.reset(out); }
void reset() throws IOException { packer.reset(out); }
/** * Reset our position in the array. */
Reset our position in the array
reset
{ "repo_name": "apache/incubator-htrace", "path": "htrace-htraced/src/main/java/org/apache/htrace/impl/PackedBuffer.java", "license": "apache-2.0", "size": 14122 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,339,283
BivariateRealFunction interpolate(double[] xval, double[] yval, double[][] fval) throws MathException;
BivariateRealFunction interpolate(double[] xval, double[] yval, double[][] fval) throws MathException;
/** * Computes an interpolating function for the data set. * * @param xval All the x-coordinates of the interpolation points, sorted * in increasing order. * @param yval All the y-coordinates of the interpolation points, sorted * in increasing order. * @param fval The values of the interpolation points on all the grid knots: * {@code fval[i][j] = f(xval[i], yval[j])}. * @return a function which interpolates the data set. * @throws MathException if arguments violate assumptions made by the * interpolation algorithm. */
Computes an interpolating function for the data set
interpolate
{ "repo_name": "haisamido/SFDaaS", "path": "src/org/apache/commons/math/analysis/interpolation/BivariateRealGridInterpolator.java", "license": "lgpl-3.0", "size": 1961 }
[ "org.apache.commons.math.MathException", "org.apache.commons.math.analysis.BivariateRealFunction" ]
import org.apache.commons.math.MathException; import org.apache.commons.math.analysis.BivariateRealFunction;
import org.apache.commons.math.*; import org.apache.commons.math.analysis.*;
[ "org.apache.commons" ]
org.apache.commons;
956,981
private void parseValidationXml() { if ( ignoreXmlConfiguration ) { log.ignoringXmlConfiguration(); // make sure we use the defaults in case they haven't been provided yet if ( validationBootstrapParameters.getMessageInterpolator() == null ) { validationBootstrapParameters.setMessageInterpolator( defaultMessageInterpolator ); } if ( validationBootstrapParameters.getTraversableResolver() == null ) { validationBootstrapParameters.setTraversableResolver( defaultTraversableResolver ); } if ( validationBootstrapParameters.getConstraintValidatorFactory() == null ) { validationBootstrapParameters.setConstraintValidatorFactory( defaultConstraintValidatorFactory ); } if ( validationBootstrapParameters.getParameterNameProvider() == null ) { validationBootstrapParameters.setParameterNameProvider( defaultParameterNameProvider ); } } else { ValidationBootstrapParameters xmlParameters = new ValidationBootstrapParameters( getBootstrapConfiguration() ); applyXmlSettings( xmlParameters ); } }
void function() { if ( ignoreXmlConfiguration ) { log.ignoringXmlConfiguration(); if ( validationBootstrapParameters.getMessageInterpolator() == null ) { validationBootstrapParameters.setMessageInterpolator( defaultMessageInterpolator ); } if ( validationBootstrapParameters.getTraversableResolver() == null ) { validationBootstrapParameters.setTraversableResolver( defaultTraversableResolver ); } if ( validationBootstrapParameters.getConstraintValidatorFactory() == null ) { validationBootstrapParameters.setConstraintValidatorFactory( defaultConstraintValidatorFactory ); } if ( validationBootstrapParameters.getParameterNameProvider() == null ) { validationBootstrapParameters.setParameterNameProvider( defaultParameterNameProvider ); } } else { ValidationBootstrapParameters xmlParameters = new ValidationBootstrapParameters( getBootstrapConfiguration() ); applyXmlSettings( xmlParameters ); } }
/** * Tries to check whether a validation.xml file exists and parses it */
Tries to check whether a validation.xml file exists and parses it
parseValidationXml
{ "repo_name": "jmartisk/hibernate-validator", "path": "engine/src/main/java/org/hibernate/validator/internal/engine/ConfigurationImpl.java", "license": "apache-2.0", "size": 14707 }
[ "org.hibernate.validator.internal.xml.ValidationBootstrapParameters" ]
import org.hibernate.validator.internal.xml.ValidationBootstrapParameters;
import org.hibernate.validator.internal.xml.*;
[ "org.hibernate.validator" ]
org.hibernate.validator;
2,912,576
void commit() throws TransactionException;
void commit() throws TransactionException;
/** * Performs an atomic commit of the transaction * * @throws org.exist.storage.txn.TransactionException if an error occurred * during writing any part of the transaction */
Performs an atomic commit of the transaction
commit
{ "repo_name": "windauer/exist", "path": "exist-core/src/main/java/org/exist/Transaction.java", "license": "lgpl-2.1", "size": 1714 }
[ "org.exist.storage.txn.TransactionException" ]
import org.exist.storage.txn.TransactionException;
import org.exist.storage.txn.*;
[ "org.exist.storage" ]
org.exist.storage;
2,635,806
public boolean isJdbc4ValidationSupported(final Connection connection) { if (!isValidChecked) { try { connection.isValid(5); // This will throw various exceptions in the case of a non-JDBC 4.0 compliant driver } catch (Throwable e) { isValidSupported = false; LOGGER.debug("{} - JDBC4 Connection.isValid() not supported", poolName); } isValidChecked = true; } return isValidSupported; }
boolean function(final Connection connection) { if (!isValidChecked) { try { connection.isValid(5); } catch (Throwable e) { isValidSupported = false; LOGGER.debug(STR, poolName); } isValidChecked = true; } return isValidSupported; }
/** * Return true if the driver appears to be JDBC 4.0 compliant. * * @param connection a Connection to check * @return true if JDBC 4.1 compliance, false otherwise */
Return true if the driver appears to be JDBC 4.0 compliant
isJdbc4ValidationSupported
{ "repo_name": "guai/HikariCP", "path": "hikaricp-common/src/main/java/ru/programpark/hikari/pool/PoolUtilities.java", "license": "apache-2.0", "size": 9288 }
[ "java.sql.Connection" ]
import java.sql.Connection;
import java.sql.*;
[ "java.sql" ]
java.sql;
2,490,091
private byte[] tlvBodyAsBytes() { List<Byte> bytes = new ArrayList<>(); for (MacAddress macAddress : this.neighbor) { bytes.addAll(Bytes.asList(macAddress.toBytes())); } return Bytes.toArray(bytes); }
byte[] function() { List<Byte> bytes = new ArrayList<>(); for (MacAddress macAddress : this.neighbor) { bytes.addAll(Bytes.asList(macAddress.toBytes())); } return Bytes.toArray(bytes); }
/** * Returns TLV body of ISIS neighbor TLV. * * @return byteArray TLV body of area address TLV */
Returns TLV body of ISIS neighbor TLV
tlvBodyAsBytes
{ "repo_name": "sdnwiselab/onos", "path": "protocols/isis/isisio/src/main/java/org/onosproject/isis/io/isispacket/tlv/IsisNeighborTlv.java", "license": "apache-2.0", "size": 2997 }
[ "com.google.common.primitives.Bytes", "java.util.ArrayList", "java.util.List", "org.onlab.packet.MacAddress" ]
import com.google.common.primitives.Bytes; import java.util.ArrayList; import java.util.List; import org.onlab.packet.MacAddress;
import com.google.common.primitives.*; import java.util.*; import org.onlab.packet.*;
[ "com.google.common", "java.util", "org.onlab.packet" ]
com.google.common; java.util; org.onlab.packet;
418,110
public MakeList getContainerMakeList(){ return item.getContainerMakeList(); }
MakeList function(){ return item.getContainerMakeList(); }
/** * Return the encapsulate Low Level API object. */
Return the encapsulate Low Level API object
getContainerMakeList
{ "repo_name": "lhillah/pnmlframework", "path": "pnmlFw-HLPN/src/fr/lip6/move/pnml/hlpn/terms/hlapi/UserSortHLAPI.java", "license": "epl-1.0", "size": 19654 }
[ "fr.lip6.move.pnml.hlpn.lists.MakeList" ]
import fr.lip6.move.pnml.hlpn.lists.MakeList;
import fr.lip6.move.pnml.hlpn.lists.*;
[ "fr.lip6.move" ]
fr.lip6.move;
400,503
Date getBefriendDate();
Date getBefriendDate();
/** * Get the date/time that the friend was befriended. */
Get the date/time that the friend was befriended
getBefriendDate
{ "repo_name": "JCThePants/NucleusFramework", "path": "src/com/jcwhatever/nucleus/providers/friends/IFriend.java", "license": "mit", "size": 3579 }
[ "java.util.Date" ]
import java.util.Date;
import java.util.*;
[ "java.util" ]
java.util;
1,703,536
public T caseCallActivity(CallActivity object) { return null; }
T function(CallActivity object) { return null; }
/** * Returns the result of interpreting the object as an instance of '<em>Call Activity</em>'. * <!-- begin-user-doc --> * This implementation returns null; * returning a non-null result will terminate the switch. * <!-- end-user-doc --> * @param object the target of the switch. * @return the result of interpreting the object as an instance of '<em>Call Activity</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */
Returns the result of interpreting the object as an instance of 'Call Activity'. This implementation returns null; returning a non-null result will terminate the switch.
caseCallActivity
{ "repo_name": "romartin/kie-wb-common", "path": "kie-wb-common-stunner/kie-wb-common-stunner-sets/kie-wb-common-stunner-bpmn/kie-wb-common-stunner-bpmn-emf/src/main/java/org/eclipse/bpmn2/util/Bpmn2Switch.java", "license": "apache-2.0", "size": 144865 }
[ "org.eclipse.bpmn2.CallActivity" ]
import org.eclipse.bpmn2.CallActivity;
import org.eclipse.bpmn2.*;
[ "org.eclipse.bpmn2" ]
org.eclipse.bpmn2;
1,340,532
public static ScheduledFuture schedule(long delay, long period, final Runnable runnable) { return schedule(delay, period, TimeUnit.MILLISECONDS, runnable); }
static ScheduledFuture function(long delay, long period, final Runnable runnable) { return schedule(delay, period, TimeUnit.MILLISECONDS, runnable); }
/** * schedule a runnable of the period after delay (in unit milliseconds) * * @param delay delay to post * @param period period * @param runnable */
schedule a runnable of the period after delay (in unit milliseconds)
schedule
{ "repo_name": "KyleCe/MyTestApplication", "path": "app/src/main/java/com/ce/game/myapplication/util/ThreadPoolU.java", "license": "mit", "size": 3510 }
[ "java.util.concurrent.ScheduledFuture", "java.util.concurrent.TimeUnit" ]
import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit;
import java.util.concurrent.*;
[ "java.util" ]
java.util;
546,579
public Collection<TypeGroupInstance> containsAny(Collection<TypeGroupInstance> tgis);
Collection<TypeGroupInstance> function(Collection<TypeGroupInstance> tgis);
/** * Checks if TGIs exist and returns the ones that do. * * @param tgis A collection of TGIs to check. Repeated elements are ignored but discouraged for potential performance reasons (<i>varies on implementation</i>). * @return A Collection containing the TGIs that do exist. */
Checks if TGIs exist and returns the ones that do
containsAny
{ "repo_name": "vincentzhang96/PhoenixAssetDatabase", "path": "src/org/phoenix/assetmanager/PAssetManager.java", "license": "mit", "size": 4137 }
[ "java.util.Collection", "org.phoenix.assetdatabase.TypeGroupInstance" ]
import java.util.Collection; import org.phoenix.assetdatabase.TypeGroupInstance;
import java.util.*; import org.phoenix.assetdatabase.*;
[ "java.util", "org.phoenix.assetdatabase" ]
java.util; org.phoenix.assetdatabase;
2,674,966
public static ByteBuf serializeToBuf(final Object obj) { return serializeToBuf(obj, null); }
static ByteBuf function(final Object obj) { return serializeToBuf(obj, null); }
/** * Serializes the passed object as JSON into a newly created buffer * @param obj The object to serialize * @return The buffer the object was written to */
Serializes the passed object as JSON into a newly created buffer
serializeToBuf
{ "repo_name": "nickman/tsdblite", "path": "src/main/java/com/heliosapm/tsdblite/json/JSON.java", "license": "apache-2.0", "size": 28557 }
[ "io.netty.buffer.ByteBuf" ]
import io.netty.buffer.ByteBuf;
import io.netty.buffer.*;
[ "io.netty.buffer" ]
io.netty.buffer;
507,119
public long[] getVolumeInfo() throws IOException { // Under Java 1.6 and up, use the (new) java.io.File methods if (JavaVersion.JAVA_1_6.isCurrentOrHigher()) { return new long[] { getTotalSpace(), getFreeSpace() }; } // Under Java 1.5 or lower, use native methods return getNativeVolumeInfo(); }
long[] function() throws IOException { if (JavaVersion.JAVA_1_6.isCurrentOrHigher()) { return new long[] { getTotalSpace(), getFreeSpace() }; } return getNativeVolumeInfo(); }
/** * Returns the total and free space on the volume where this file resides. * * <p>Using this method to retrieve both free space and volume space is more efficient than calling * {@link #getFreeSpace()} and {@link #getTotalSpace()} separately -- the underlying method retrieving both * attributes at the same time. * * @return a {totalSpace, freeSpace} long array, both values can be null if the information could not be retrieved * @throws IOException if an I/O error occurred */
Returns the total and free space on the volume where this file resides. Using this method to retrieve both free space and volume space is more efficient than calling <code>#getFreeSpace()</code> and <code>#getTotalSpace()</code> separately -- the underlying method retrieving both attributes at the same time
getVolumeInfo
{ "repo_name": "Keltek/mucommander", "path": "src/main/com/mucommander/commons/file/impl/local/UNCFile.java", "license": "gpl-3.0", "size": 29731 }
[ "com.mucommander.commons.runtime.JavaVersion", "java.io.IOException" ]
import com.mucommander.commons.runtime.JavaVersion; import java.io.IOException;
import com.mucommander.commons.runtime.*; import java.io.*;
[ "com.mucommander.commons", "java.io" ]
com.mucommander.commons; java.io;
2,147,571
public String compose(String s) { return Normalizer.normalize(s, Form.NFC); }
String function(String s) { return Normalizer.normalize(s, Form.NFC); }
/** * Simple composition of a String. */
Simple composition of a String
compose
{ "repo_name": "alejandroarturom/frostwire-desktop", "path": "src/org/limewire/util/I18NConvertICU.java", "license": "gpl-3.0", "size": 3854 }
[ "java.text.Normalizer" ]
import java.text.Normalizer;
import java.text.*;
[ "java.text" ]
java.text;
432,002
public void insertLast(ASTNode node, TextEditGroup editGroup) { if (node == null) { throw new IllegalArgumentException(); } internalInsertAt(node, -1, true, editGroup); }
void function(ASTNode node, TextEditGroup editGroup) { if (node == null) { throw new IllegalArgumentException(); } internalInsertAt(node, -1, true, editGroup); }
/** * Inserts the given node into the list at the end of the list. Equivalent to <code>insertAt(node, -1, editGroup)</code>. * * @param node * the node to insert * @param editGroup * the edit group in which to collect the corresponding text edits, or <code>null</code> if ungrouped * @throws IllegalArgumentException * if the node is null, or if the node is not part of this rewriter's AST, or if the inserted * node is not a new node (or placeholder), or if the described modification is otherwise invalid (not a member of * this node's original list) * @see #insertAt(ASTNode, int, TextEditGroup) */
Inserts the given node into the list at the end of the list. Equivalent to <code>insertAt(node, -1, editGroup)</code>
insertLast
{ "repo_name": "riuvshin/che-plugins", "path": "plugin-java/che-plugin-java-ext-java/src/main/java/org/eclipse/che/ide/ext/java/jdt/core/dom/rewrite/ListRewrite.java", "license": "epl-1.0", "size": 20065 }
[ "org.eclipse.che.ide.ext.java.jdt.core.dom.ASTNode", "org.eclipse.che.ide.ext.java.jdt.text.edits.TextEditGroup" ]
import org.eclipse.che.ide.ext.java.jdt.core.dom.ASTNode; import org.eclipse.che.ide.ext.java.jdt.text.edits.TextEditGroup;
import org.eclipse.che.ide.ext.java.jdt.core.dom.*; import org.eclipse.che.ide.ext.java.jdt.text.edits.*;
[ "org.eclipse.che" ]
org.eclipse.che;
924,829
public static List<IProject> getProjectsFromSelection(final ISelection selection) { final List<IProject> result = new ArrayList<IProject>(); for (final Object o : SelectionUtils.getObjectsFromSelection(selection)) { if (o instanceof IProject) { result.add((IProject) o); } } return result; } /** * Converts the given selection to a list of objects. * * @param selection * the selection * @return The selected objects or an empty list if the selection is not a {@link IStructuredSelection}
static List<IProject> function(final ISelection selection) { final List<IProject> result = new ArrayList<IProject>(); for (final Object o : SelectionUtils.getObjectsFromSelection(selection)) { if (o instanceof IProject) { result.add((IProject) o); } } return result; } /** * Converts the given selection to a list of objects. * * @param selection * the selection * @return The selected objects or an empty list if the selection is not a {@link IStructuredSelection}
/** * Collects the projects from the given selection. * * @param selection * the selection to process. * @return The selected projects or an empty list if the selection is not a {@link IStructuredSelection} or there is no selected project */
Collects the projects from the given selection
getProjectsFromSelection
{ "repo_name": "alovassy/titan.EclipsePlug-ins", "path": "org.eclipse.titan.common/src/org/eclipse/titan/common/utils/SelectionUtils.java", "license": "epl-1.0", "size": 3888 }
[ "java.util.ArrayList", "java.util.List", "org.eclipse.core.resources.IProject", "org.eclipse.jface.viewers.ISelection", "org.eclipse.jface.viewers.IStructuredSelection" ]
import java.util.ArrayList; import java.util.List; import org.eclipse.core.resources.IProject; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection;
import java.util.*; import org.eclipse.core.resources.*; import org.eclipse.jface.viewers.*;
[ "java.util", "org.eclipse.core", "org.eclipse.jface" ]
java.util; org.eclipse.core; org.eclipse.jface;
750,606
public ExecutorShutdown execute() throws Exception { LOG.info("Loading executor tasks " + componentId + ":" + executorId); registerBackpressure(); Utils.SmartThread systemThreads = Utils.asyncLoop(executorTransfer, executorTransfer.getName(), reportErrorDie); String handlerName = componentId + "-executor" + executorId; Utils.SmartThread handlers = Utils.asyncLoop(this, false, reportErrorDie, Thread.NORM_PRIORITY, true, true, handlerName); setupTicks(StatsUtil.SPOUT.equals(type)); LOG.info("Finished loading executor " + componentId + ":" + executorId); return new ExecutorShutdown(this, Lists.newArrayList(systemThreads, handlers), idToTask); }
ExecutorShutdown function() throws Exception { LOG.info(STR + componentId + ":" + executorId); registerBackpressure(); Utils.SmartThread systemThreads = Utils.asyncLoop(executorTransfer, executorTransfer.getName(), reportErrorDie); String handlerName = componentId + STR + executorId; Utils.SmartThread handlers = Utils.asyncLoop(this, false, reportErrorDie, Thread.NORM_PRIORITY, true, true, handlerName); setupTicks(StatsUtil.SPOUT.equals(type)); LOG.info(STR + componentId + ":" + executorId); return new ExecutorShutdown(this, Lists.newArrayList(systemThreads, handlers), idToTask); }
/** * separated from mkExecutor in order to replace executor transfer in executor data for testing */
separated from mkExecutor in order to replace executor transfer in executor data for testing
execute
{ "repo_name": "roshannaik/storm", "path": "storm-client/src/jvm/org/apache/storm/executor/Executor.java", "license": "apache-2.0", "size": 26028 }
[ "com.google.common.collect.Lists", "org.apache.storm.stats.StatsUtil", "org.apache.storm.utils.Utils" ]
import com.google.common.collect.Lists; import org.apache.storm.stats.StatsUtil; import org.apache.storm.utils.Utils;
import com.google.common.collect.*; import org.apache.storm.stats.*; import org.apache.storm.utils.*;
[ "com.google.common", "org.apache.storm" ]
com.google.common; org.apache.storm;
2,105,216
@Test(timeout = 60000) public void testCoordinatorAbort() throws Exception { buildCohortMemberPair();
@Test(timeout = 60000) void function() throws Exception { buildCohortMemberPair();
/** * Fail correctly if coordinator aborts the procedure. The subprocedure will not interrupt a * running {@link Subprocedure#prepare} -- prepare needs to finish first, and the the abort * is checked. Thus, the {@link Subprocedure#prepare} should succeed but later get rolled back * via {@link Subprocedure#cleanup}. */
Fail correctly if coordinator aborts the procedure. The subprocedure will not interrupt a running <code>Subprocedure#prepare</code> -- prepare needs to finish first, and the the abort is checked. Thus, the <code>Subprocedure#prepare</code> should succeed but later get rolled back via <code>Subprocedure#cleanup</code>
testCoordinatorAbort
{ "repo_name": "JichengSong/hbase", "path": "src/test/java/org/apache/hadoop/hbase/procedure/TestProcedureMember.java", "license": "apache-2.0", "size": 17623 }
[ "org.junit.Test" ]
import org.junit.Test;
import org.junit.*;
[ "org.junit" ]
org.junit;
2,792,251
public Map<String, LdapContextFactory> getContextFactories() { if (contextFactories == null) { // Use linked hash map to preserve order contextFactories = new LinkedHashMap<>(); String[] serverKeys = config.getStringArray(LDAP_SERVERS_PROPERTY); if (serverKeys.length > 0) { initMultiLdapConfiguration(serverKeys); } else { initSimpleLdapConfiguration(); } } return contextFactories; }
Map<String, LdapContextFactory> function() { if (contextFactories == null) { contextFactories = new LinkedHashMap<>(); String[] serverKeys = config.getStringArray(LDAP_SERVERS_PROPERTY); if (serverKeys.length > 0) { initMultiLdapConfiguration(serverKeys); } else { initSimpleLdapConfiguration(); } } return contextFactories; }
/** * Get all the @link{LdapContextFactory}s available in the settings. * * @return A @link{Map} with all the @link{LdapContextFactory} objects. * The key is the server key used in the settings (ldap for old single server notation). */
Get all the @link{LdapContextFactory}s available in the settings
getContextFactories
{ "repo_name": "SonarSource/sonarqube", "path": "server/sonar-auth-ldap/src/main/java/org/sonar/auth/ldap/LdapSettingsManager.java", "license": "lgpl-3.0", "size": 8624 }
[ "java.util.LinkedHashMap", "java.util.Map" ]
import java.util.LinkedHashMap; import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
421,559
public synchronized IMAPBodyStructure fetchBodyStructure(int sequenceNumber) throws MessagingException { IMAPCommand command = new IMAPCommand("FETCH"); command.appendInteger(sequenceNumber); command.startList(); command.appendAtom("BODYSTRUCTURE"); command.endList(); // we want all of the envelope information about the message, which involves multiple FETCH chunks. sendCommand(command); // locate the response from this IMAPBodyStructure bodyStructure = (IMAPBodyStructure)extractFetchDataItem(sequenceNumber, IMAPFetchDataItem.BODYSTRUCTURE); if (bodyStructure == null) { throw new MessagingException("No BODYSTRUCTURE information received from IMAP server"); } // and return the body structure directly. return bodyStructure; }
synchronized IMAPBodyStructure function(int sequenceNumber) throws MessagingException { IMAPCommand command = new IMAPCommand("FETCH"); command.appendInteger(sequenceNumber); command.startList(); command.appendAtom(STR); command.endList(); sendCommand(command); IMAPBodyStructure bodyStructure = (IMAPBodyStructure)extractFetchDataItem(sequenceNumber, IMAPFetchDataItem.BODYSTRUCTURE); if (bodyStructure == null) { throw new MessagingException(STR); } return bodyStructure; }
/** * Issue a FETCH command to retrieve the message BODYSTRUCTURE structure. * * @param sequenceNumber The sequence number of the message. * * @return The IMAPBodyStructure item for the message. * All other untagged responses are queued for processing. */
Issue a FETCH command to retrieve the message BODYSTRUCTURE structure
fetchBodyStructure
{ "repo_name": "apache/geronimo-javamail", "path": "geronimo-javamail_1.6/geronimo-javamail_1.6_provider/src/main/java/org/apache/geronimo/javamail/store/imap/connection/IMAPConnection.java", "license": "apache-2.0", "size": 75320 }
[ "javax.mail.MessagingException" ]
import javax.mail.MessagingException;
import javax.mail.*;
[ "javax.mail" ]
javax.mail;
557,997
public static void transferDataObject(Connection c, Object o) { if (LOG_ENABLED) { LOGGER.info(SENDING + OBJECT + Integer.toString(o.hashCode()) + VIA + c + END); } c.sendDataObject(o); c.finishConnection(); }
static void function(Connection c, Object o) { if (LOG_ENABLED) { LOGGER.info(SENDING + OBJECT + Integer.toString(o.hashCode()) + VIA + c + END); } c.sendDataObject(o); c.finishConnection(); }
/** * * Sends an object through an already open connection. * * It ships an object, after serializing it into byte array, through the * connection. Then, the connection is closed. Generally, this method is * called after receiving a Data Transfer Request through the same * connection. * * @param c Open connection * @param o Object to transfer */
Sends an object through an already open connection. It ships an object, after serializing it into byte array, through the connection. Then, the connection is closed. Generally, this method is called after receiving a Data Transfer Request through the same connection
transferDataObject
{ "repo_name": "flordan/COMPSs-Mobile", "path": "code/runtime/commons/src/main/java/es/bsc/mobile/comm/CommunicationManager.java", "license": "apache-2.0", "size": 8117 }
[ "es.bsc.comm.Connection" ]
import es.bsc.comm.Connection;
import es.bsc.comm.*;
[ "es.bsc.comm" ]
es.bsc.comm;
1,663,957
@Message(id = 24, value = "Unknown type %s") RuntimeException unknownType(ModelType type);
@Message(id = 24, value = STR) RuntimeException unknownType(ModelType type);
/** * Creates an exception indicating the type is unknown. * * @param type the unknown type. * * @return a {@link RuntimeException} for the error. */
Creates an exception indicating the type is unknown
unknownType
{ "repo_name": "JiriOndrusek/wildfly-core", "path": "jmx/src/main/java/org/jboss/as/jmx/logging/JmxLogger.java", "license": "lgpl-2.1", "size": 19789 }
[ "org.jboss.dmr.ModelType", "org.jboss.logging.annotations.Message" ]
import org.jboss.dmr.ModelType; import org.jboss.logging.annotations.Message;
import org.jboss.dmr.*; import org.jboss.logging.annotations.*;
[ "org.jboss.dmr", "org.jboss.logging" ]
org.jboss.dmr; org.jboss.logging;
1,223,616
public Graph queryKB(Criteria c, String requestorId) throws KBException;
Graph function(Criteria c, String requestorId) throws KBException;
/** * Makes a query over the KB in a given query language * * @param c * - the actual text of the query/as a criteria * @param requestorId * - Yarta userId of the user performing this action (needed for * access control) * @return the Graph containing all matching triples * @throws KBException * if access control fails */
Makes a query over the KB in a given query language
queryKB
{ "repo_name": "grosca/yarta", "path": "mselib/MSE-Middleware/src/fr/inria/arles/yarta/knowledgebase/interfaces/KnowledgeBase.java", "license": "lgpl-3.0", "size": 4216 }
[ "fr.inria.arles.yarta.Criteria", "fr.inria.arles.yarta.knowledgebase.KBException" ]
import fr.inria.arles.yarta.Criteria; import fr.inria.arles.yarta.knowledgebase.KBException;
import fr.inria.arles.yarta.*; import fr.inria.arles.yarta.knowledgebase.*;
[ "fr.inria.arles" ]
fr.inria.arles;
2,622,837
public void setA_Curr_Dep_Exp (BigDecimal A_Curr_Dep_Exp) { set_Value (COLUMNNAME_A_Curr_Dep_Exp, A_Curr_Dep_Exp); }
void function (BigDecimal A_Curr_Dep_Exp) { set_Value (COLUMNNAME_A_Curr_Dep_Exp, A_Curr_Dep_Exp); }
/** Set A_Curr_Dep_Exp. @param A_Curr_Dep_Exp A_Curr_Dep_Exp */
Set A_Curr_Dep_Exp
setA_Curr_Dep_Exp
{ "repo_name": "TaymourReda/-https-github.com-adempiere-adempiere", "path": "base/src/org/compiere/model/X_A_Depreciation_Workfile.java", "license": "gpl-2.0", "size": 23291 }
[ "java.math.BigDecimal" ]
import java.math.BigDecimal;
import java.math.*;
[ "java.math" ]
java.math;
442,946
private void renormalizeHisto(int[] histo, Object[] objs, Field field, Bounds bounds, int hMax) throws IllegalAccessException { int i, j, n = histo.length, min = (int) bounds.m_min; float[] newBnds = new float[n]; float q = min, pow = .5f, alpha, beta, dq, r, beg, end, qMax = .999f * n; // Hardcoded to .5 now! // if ( pow >= .9999f ) return; // don't remap anything // if ( pow < 0.f ) pow = 0.f; // collapse small values! alpha = 1.f / (1.f - pow); beta = alpha - 1.f; dq = bounds.getWidth() / n; r = dq / (alpha * hMax); beta *= hMax; for (i = 0; i < n; i++) { q += r * (histo[i] + beta); newBnds[i] = q; } log.info("filtering {} using a {} values histogram", bounds, histo.length); bounds.m_max = q; n = objs.length; int val; dq = 1.f / dq; for (i = 0; i < n; i++) { val = field.getInt(objs[i]); q = val <= min ? 0 : dq * (val - min); if (q > qMax) q = qMax; j = (int) q; q -= j; beg = j > 0 ? newBnds[j - 1] : min; end = newBnds[j]; field.setInt(objs[i], (int) EZMath.interLin(q, beg, end)); } log.info("new max bound is {}", bounds.m_max); }
void function(int[] histo, Object[] objs, Field field, Bounds bounds, int hMax) throws IllegalAccessException { int i, j, n = histo.length, min = (int) bounds.m_min; float[] newBnds = new float[n]; float q = min, pow = .5f, alpha, beta, dq, r, beg, end, qMax = .999f * n; alpha = 1.f / (1.f - pow); beta = alpha - 1.f; dq = bounds.getWidth() / n; r = dq / (alpha * hMax); beta *= hMax; for (i = 0; i < n; i++) { q += r * (histo[i] + beta); newBnds[i] = q; } log.info(STR, bounds, histo.length); bounds.m_max = q; n = objs.length; int val; dq = 1.f / dq; for (i = 0; i < n; i++) { val = field.getInt(objs[i]); q = val <= min ? 0 : dq * (val - min); if (q > qMax) q = qMax; j = (int) q; q -= j; beg = j > 0 ? newBnds[j - 1] : min; end = newBnds[j]; field.setInt(objs[i], (int) EZMath.interLin(q, beg, end)); } log.info(STR, bounds.m_max); }
/** * Renormalize an histogram to lessen variations. * * @param histo * An histogram array containing the number of value for each * intervals. * @param objs * An array of Objects holding the value to renormalize matching * that generates histo. * @param field * The value of the Objects to transform. * @param bounds * Min and max of the values to remap. * @param hMax * Maximum number of value in an interval of the histogram. * @throws IllegalAccessException */
Renormalize an histogram to lessen variations
renormalizeHisto
{ "repo_name": "social-computing/jmi-server", "path": "jmi-server/src/main/java/com/socialcomputing/wps/server/generator/ProtoPlan.java", "license": "gpl-3.0", "size": 27227 }
[ "com.socialcomputing.utils.math.Bounds", "com.socialcomputing.utils.math.EZMath", "java.lang.reflect.Field" ]
import com.socialcomputing.utils.math.Bounds; import com.socialcomputing.utils.math.EZMath; import java.lang.reflect.Field;
import com.socialcomputing.utils.math.*; import java.lang.reflect.*;
[ "com.socialcomputing.utils", "java.lang" ]
com.socialcomputing.utils; java.lang;
18,933
static MessageType mergeInto(MessageType toMerge, MessageType mergedSchema) { return mergeInto(toMerge, mergedSchema, true); }
static MessageType mergeInto(MessageType toMerge, MessageType mergedSchema) { return mergeInto(toMerge, mergedSchema, true); }
/** * will return the result of merging toMerge into mergedSchema * @param toMerge the schema to merge into mergedSchema * @param mergedSchema the schema to append the fields to * @return the resulting schema */
will return the result of merging toMerge into mergedSchema
mergeInto
{ "repo_name": "rdblue/parquet-mr", "path": "parquet-hadoop/src/main/java/org/apache/parquet/hadoop/ParquetFileWriter.java", "license": "apache-2.0", "size": 34129 }
[ "org.apache.parquet.schema.MessageType" ]
import org.apache.parquet.schema.MessageType;
import org.apache.parquet.schema.*;
[ "org.apache.parquet" ]
org.apache.parquet;
2,859,363
@Override public Template createTemplate(String uri) { return createTemplateForUri(uri); }
Template function(String uri) { return createTemplateForUri(uri); }
/** * Creates a Template using the given URI. * * @param uri The URI of the page to create the template for * @return The Template instance * @throws CompilationFailedException */
Creates a Template using the given URI
createTemplate
{ "repo_name": "erdi/grails-core", "path": "grails-web/src/main/groovy/org/codehaus/groovy/grails/web/pages/GroovyPagesTemplateEngine.java", "license": "apache-2.0", "size": 33532 }
[ "groovy.text.Template" ]
import groovy.text.Template;
import groovy.text.*;
[ "groovy.text" ]
groovy.text;
1,247,918
public void updateConcurrentList() { if (getItems() != null) { updateConcurrentList((List<FenceAgentModel>) getItems()); } }
void function() { if (getItems() != null) { updateConcurrentList((List<FenceAgentModel>) getItems()); } }
/** * Updates the available concurrent select list in all the {@code FenceAgentModel}s in this list model. * @see updateConcurrentList(List<FenceAgentModel> items) for the algorithm used to update. */
Updates the available concurrent select list in all the FenceAgentModels in this list model
updateConcurrentList
{ "repo_name": "jtux270/translate", "path": "ovirt/3.6_source/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/FenceAgentListModel.java", "license": "gpl-3.0", "size": 17185 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
867,636
public ExternalIdBean getRateIdentifier() { return _rateIdentifier; }
ExternalIdBean function() { return _rateIdentifier; }
/** * Gets the rateIdentifier. * @return the rateIdentifier */
Gets the rateIdentifier
getRateIdentifier
{ "repo_name": "jeorme/OG-Platform", "path": "projects/OG-MasterDB/src/main/java/com/opengamma/masterdb/security/hibernate/swap/SwapLegBean.java", "license": "apache-2.0", "size": 9525 }
[ "com.opengamma.masterdb.security.hibernate.ExternalIdBean" ]
import com.opengamma.masterdb.security.hibernate.ExternalIdBean;
import com.opengamma.masterdb.security.hibernate.*;
[ "com.opengamma.masterdb" ]
com.opengamma.masterdb;
130,253
@Test public void testpathComputationCase9() { Link link1 = addLink(DEVICE1, 10, DEVICE2, 20, false, 50); Link link2 = addLink(DEVICE2, 30, DEVICE4, 40, false, 20); Link link3 = addLink(DEVICE1, 80, DEVICE3, 70, false, 100); Link link4 = addLink(DEVICE3, 60, DEVICE4, 50, false, 80); CostConstraint tecostConst = CostConstraint.of(TE_COST); CapabilityConstraint capabilityConst = CapabilityConstraint .of(CapabilityConstraint.CapabilityType.WITH_SIGNALLING); List<Constraint> constraints = new LinkedList<>(); constraints.add(capabilityConst); constraints.add(tecostConst); //Device1 DefaultAnnotations.Builder builder = DefaultAnnotations.builder(); builder.set(AnnotationKeys.TYPE, L3); builder.set(LSRID, "1.1.1.1"); addDevice(DEVICE1, builder); DeviceCapability device1Cap = netConfigRegistry.addConfig(DeviceId.deviceId("1.1.1.1"), DeviceCapability.class); device1Cap.setLabelStackCap(false) .setLocalLabelCap(false) .setSrCap(false) .apply(); //Device2 builder = DefaultAnnotations.builder(); builder.set(AnnotationKeys.TYPE, L3); builder.set(LSRID, "2.2.2.2"); addDevice(DEVICE2, builder); DeviceCapability device2Cap = netConfigRegistry.addConfig(DeviceId.deviceId("2.2.2.2"), DeviceCapability.class); device2Cap.setLabelStackCap(false) .setLocalLabelCap(false) .setSrCap(false) .apply(); //Device3 builder = DefaultAnnotations.builder(); builder.set(AnnotationKeys.TYPE, L3); builder.set(LSRID, "3.3.3.3"); addDevice(DEVICE3, builder); DeviceCapability device3Cap = netConfigRegistry.addConfig(DeviceId.deviceId("3.3.3.3"), DeviceCapability.class); device3Cap.setLabelStackCap(false) .setLocalLabelCap(false) .setSrCap(false) .apply(); //Device4 builder = DefaultAnnotations.builder(); builder.set(AnnotationKeys.TYPE, L3); builder.set(LSRID, "4.4.4.4"); addDevice(DEVICE4, builder); DeviceCapability device4Cap = netConfigRegistry.addConfig(DeviceId.deviceId("4.4.4.4"), DeviceCapability.class); device4Cap.setLabelStackCap(false) .setLocalLabelCap(false) .setSrCap(false) .apply(); Set<Path> paths = computePath(link1, link2, link3, link4, constraints); List<Link> links = new LinkedList<>(); links.add(link1); links.add(link2); assertThat(paths.iterator().next().links(), is(links)); assertThat(paths.iterator().next().cost(), is((double) 70)); }
void function() { Link link1 = addLink(DEVICE1, 10, DEVICE2, 20, false, 50); Link link2 = addLink(DEVICE2, 30, DEVICE4, 40, false, 20); Link link3 = addLink(DEVICE1, 80, DEVICE3, 70, false, 100); Link link4 = addLink(DEVICE3, 60, DEVICE4, 50, false, 80); CostConstraint tecostConst = CostConstraint.of(TE_COST); CapabilityConstraint capabilityConst = CapabilityConstraint .of(CapabilityConstraint.CapabilityType.WITH_SIGNALLING); List<Constraint> constraints = new LinkedList<>(); constraints.add(capabilityConst); constraints.add(tecostConst); DefaultAnnotations.Builder builder = DefaultAnnotations.builder(); builder.set(AnnotationKeys.TYPE, L3); builder.set(LSRID, STR); addDevice(DEVICE1, builder); DeviceCapability device1Cap = netConfigRegistry.addConfig(DeviceId.deviceId(STR), DeviceCapability.class); device1Cap.setLabelStackCap(false) .setLocalLabelCap(false) .setSrCap(false) .apply(); builder = DefaultAnnotations.builder(); builder.set(AnnotationKeys.TYPE, L3); builder.set(LSRID, STR); addDevice(DEVICE2, builder); DeviceCapability device2Cap = netConfigRegistry.addConfig(DeviceId.deviceId(STR), DeviceCapability.class); device2Cap.setLabelStackCap(false) .setLocalLabelCap(false) .setSrCap(false) .apply(); builder = DefaultAnnotations.builder(); builder.set(AnnotationKeys.TYPE, L3); builder.set(LSRID, STR); addDevice(DEVICE3, builder); DeviceCapability device3Cap = netConfigRegistry.addConfig(DeviceId.deviceId(STR), DeviceCapability.class); device3Cap.setLabelStackCap(false) .setLocalLabelCap(false) .setSrCap(false) .apply(); builder = DefaultAnnotations.builder(); builder.set(AnnotationKeys.TYPE, L3); builder.set(LSRID, STR); addDevice(DEVICE4, builder); DeviceCapability device4Cap = netConfigRegistry.addConfig(DeviceId.deviceId(STR), DeviceCapability.class); device4Cap.setLabelStackCap(false) .setLocalLabelCap(false) .setSrCap(false) .apply(); Set<Path> paths = computePath(link1, link2, link3, link4, constraints); List<Link> links = new LinkedList<>(); links.add(link1); links.add(link2); assertThat(paths.iterator().next().links(), is(links)); assertThat(paths.iterator().next().cost(), is((double) 70)); }
/** * With device supporting RSVP capability as a constraints. */
With device supporting RSVP capability as a constraints
testpathComputationCase9
{ "repo_name": "paradisecr/ONOS-OXP", "path": "apps/pce/app/src/test/java/org/onosproject/pce/pceservice/PathComputationTest.java", "license": "apache-2.0", "size": 50156 }
[ "com.google.common.collect.ImmutableSet", "java.util.LinkedList", "java.util.List", "java.util.Set", "org.hamcrest.MatcherAssert", "org.hamcrest.core.Is", "org.onosproject.net.AnnotationKeys", "org.onosproject.net.DefaultAnnotations", "org.onosproject.net.DeviceId", "org.onosproject.net.Link", "org.onosproject.net.Path", "org.onosproject.net.intent.Constraint", "org.onosproject.pce.pceservice.constraint.CapabilityConstraint", "org.onosproject.pce.pceservice.constraint.CostConstraint", "org.onosproject.pcep.api.DeviceCapability" ]
import com.google.common.collect.ImmutableSet; import java.util.LinkedList; import java.util.List; import java.util.Set; import org.hamcrest.MatcherAssert; import org.hamcrest.core.Is; import org.onosproject.net.AnnotationKeys; import org.onosproject.net.DefaultAnnotations; import org.onosproject.net.DeviceId; import org.onosproject.net.Link; import org.onosproject.net.Path; import org.onosproject.net.intent.Constraint; import org.onosproject.pce.pceservice.constraint.CapabilityConstraint; import org.onosproject.pce.pceservice.constraint.CostConstraint; import org.onosproject.pcep.api.DeviceCapability;
import com.google.common.collect.*; import java.util.*; import org.hamcrest.*; import org.hamcrest.core.*; import org.onosproject.net.*; import org.onosproject.net.intent.*; import org.onosproject.pce.pceservice.constraint.*; import org.onosproject.pcep.api.*;
[ "com.google.common", "java.util", "org.hamcrest", "org.hamcrest.core", "org.onosproject.net", "org.onosproject.pce", "org.onosproject.pcep" ]
com.google.common; java.util; org.hamcrest; org.hamcrest.core; org.onosproject.net; org.onosproject.pce; org.onosproject.pcep;
468,135
void init(OData odata);
void init(OData odata);
/** * Initializes the debug support implementation. * Is called before {@link #isUserAuthorized()} and * {@link #createDebugResponse(String, DebugInformation)}. * @param odata */
Initializes the debug support implementation. Is called before <code>#isUserAuthorized()</code> and <code>#createDebugResponse(String, DebugInformation)</code>
init
{ "repo_name": "AperIati/olingo-odata4", "path": "lib/server-api/src/main/java/org/apache/olingo/server/api/debug/DebugSupport.java", "license": "apache-2.0", "size": 2146 }
[ "org.apache.olingo.server.api.OData" ]
import org.apache.olingo.server.api.OData;
import org.apache.olingo.server.api.*;
[ "org.apache.olingo" ]
org.apache.olingo;
1,080,012
protected Object lookupWithFallback() throws NamingException { try { return lookup(); } catch (TypeMismatchNamingException ex) { // Always let TypeMismatchNamingException through - // we don't want to fall back to the defaultObject in this case. throw ex; } catch (NamingException ex) { if (this.defaultObject != null) { if (logger.isDebugEnabled()) { logger.debug("JNDI lookup failed - returning specified default object instead", ex); } else if (logger.isInfoEnabled()) { logger.debug("JNDI lookup failed - returning specified default object instead: " + ex); } return this.defaultObject; } throw ex; } }
Object function() throws NamingException { try { return lookup(); } catch (TypeMismatchNamingException ex) { throw ex; } catch (NamingException ex) { if (this.defaultObject != null) { if (logger.isDebugEnabled()) { logger.debug(STR, ex); } else if (logger.isInfoEnabled()) { logger.debug(STR + ex); } return this.defaultObject; } throw ex; } }
/** * Lookup variant that that returns the specified "defaultObject" * (if any) in case of lookup failure. * @return the located object, or the "defaultObject" as fallback * @throws NamingException in case of lookup failure without fallback * @see #setDefaultObject */
Lookup variant that that returns the specified "defaultObject" (if any) in case of lookup failure
lookupWithFallback
{ "repo_name": "raedle/univis", "path": "lib/springframework-1.2.8/src/org/springframework/jndi/JndiObjectFactoryBean.java", "license": "lgpl-2.1", "size": 8083 }
[ "javax.naming.NamingException" ]
import javax.naming.NamingException;
import javax.naming.*;
[ "javax.naming" ]
javax.naming;
635,821
Context context();
Context context();
/** * Get a {@link Context}. */
Get a <code>Context</code>
context
{ "repo_name": "axellebot/Tub-Android", "path": "presentation/src/main/java/fr/bourgmapper/tub/presentation/view/HomeView.java", "license": "apache-2.0", "size": 711 }
[ "android.content.Context" ]
import android.content.Context;
import android.content.*;
[ "android.content" ]
android.content;
1,609,258
public List<RelDataTypeField> getJoinFields( LoptJoinTree left, LoptJoinTree right) { RelDataType rowType = factory.createJoinType( left.getJoinTree().getRowType(), right.getJoinTree().getRowType()); return rowType.getFieldList(); }
List<RelDataTypeField> function( LoptJoinTree left, LoptJoinTree right) { RelDataType rowType = factory.createJoinType( left.getJoinTree().getRowType(), right.getJoinTree().getRowType()); return rowType.getFieldList(); }
/** * Retrieves the fields corresponding to a join between a left and right * tree * * @param left left hand side of the join * @param right right hand side of the join * * @return fields of the join */
Retrieves the fields corresponding to a join between a left and right tree
getJoinFields
{ "repo_name": "mehant/incubator-calcite", "path": "core/src/main/java/org/apache/calcite/rel/rules/LoptMultiJoin.java", "license": "apache-2.0", "size": 27392 }
[ "java.util.List", "org.apache.calcite.rel.type.RelDataType", "org.apache.calcite.rel.type.RelDataTypeField" ]
import java.util.List; import org.apache.calcite.rel.type.RelDataType; import org.apache.calcite.rel.type.RelDataTypeField;
import java.util.*; import org.apache.calcite.rel.type.*;
[ "java.util", "org.apache.calcite" ]
java.util; org.apache.calcite;
1,199,443
@Override public Matrix derivative(final Point2D point) { return derivative((DirectPosition) null); }
Matrix function(final Point2D point) { return derivative((DirectPosition) null); }
/** * Gets the derivative of this transform at a point. For a matrix transform, the derivative is * the same everywhere. */
Gets the derivative of this transform at a point. For a matrix transform, the derivative is the same everywhere
derivative
{ "repo_name": "geotools/geotools", "path": "modules/library/referencing/src/main/java/org/geotools/referencing/operation/transform/ProjectiveTransform.java", "license": "lgpl-2.1", "size": 27828 }
[ "java.awt.geom.Point2D", "org.opengis.geometry.DirectPosition", "org.opengis.referencing.operation.Matrix" ]
import java.awt.geom.Point2D; import org.opengis.geometry.DirectPosition; import org.opengis.referencing.operation.Matrix;
import java.awt.geom.*; import org.opengis.geometry.*; import org.opengis.referencing.operation.*;
[ "java.awt", "org.opengis.geometry", "org.opengis.referencing" ]
java.awt; org.opengis.geometry; org.opengis.referencing;
819,878
@Test public void testNormalDelete() throws Exception { LdapConnection conn = getAdminConnection( getLdapServer() ); // delete success conn.delete( "ou=computers,uid=akarasulu,ou=users,ou=system" ); // delete failure non-existant entry try { conn.delete( "uid=elecharny,ou=users,ou=system" ); fail(); } catch ( LdapNoSuchObjectException lnsoe ) { assertTrue( true ); } conn.unBind(); conn.close(); }
void function() throws Exception { LdapConnection conn = getAdminConnection( getLdapServer() ); conn.delete( STR ); try { conn.delete( STR ); fail(); } catch ( LdapNoSuchObjectException lnsoe ) { assertTrue( true ); } conn.unBind(); conn.close(); }
/** * Tests normal delete operation on normal non-referral entries without * the ManageDsaIT control. */
Tests normal delete operation on normal non-referral entries without the ManageDsaIT control
testNormalDelete
{ "repo_name": "apache/directory-server", "path": "server-integ/src/test/java/org/apache/directory/server/operations/ldapsdk/DeleteIT.java", "license": "apache-2.0", "size": 10816 }
[ "org.apache.directory.api.ldap.model.exception.LdapNoSuchObjectException", "org.apache.directory.ldap.client.api.LdapConnection", "org.apache.directory.server.integ.ServerIntegrationUtils", "org.junit.jupiter.api.Assertions" ]
import org.apache.directory.api.ldap.model.exception.LdapNoSuchObjectException; import org.apache.directory.ldap.client.api.LdapConnection; import org.apache.directory.server.integ.ServerIntegrationUtils; import org.junit.jupiter.api.Assertions;
import org.apache.directory.api.ldap.model.exception.*; import org.apache.directory.ldap.client.api.*; import org.apache.directory.server.integ.*; import org.junit.jupiter.api.*;
[ "org.apache.directory", "org.junit.jupiter" ]
org.apache.directory; org.junit.jupiter;
1,535,009
public SyndElement getSecondTag() { SyndElement top = tagstack.pop(); SyndElement second = tagstack.peek(); tagstack.push(top); return second; }
SyndElement function() { SyndElement top = tagstack.pop(); SyndElement second = tagstack.peek(); tagstack.push(top); return second; }
/** * Returns the SyndElement that comes after the top element of the tagstack. */
Returns the SyndElement that comes after the top element of the tagstack
getSecondTag
{ "repo_name": "mfietz/AntennaPod", "path": "core/src/main/java/de/danoeh/antennapod/core/syndication/handler/HandlerState.java", "license": "mit", "size": 2870 }
[ "de.danoeh.antennapod.core.syndication.namespace.SyndElement" ]
import de.danoeh.antennapod.core.syndication.namespace.SyndElement;
import de.danoeh.antennapod.core.syndication.namespace.*;
[ "de.danoeh.antennapod" ]
de.danoeh.antennapod;
2,568,024
public static WaveId waveIdFromIndexWavelet(WaveletName indexWaveletName) { WaveId waveId = indexWaveletName.waveId; Preconditions.checkArgument(isIndexWave(waveId), waveId + " is not an index wave"); try { return ModernIdSerialiser.INSTANCE.deserialiseWaveId( ModernIdSerialiser.INSTANCE.serialiseWaveletId(indexWaveletName.waveletId)); } catch (InvalidIdException e) { throw new IllegalStateException(e); } }
static WaveId function(WaveletName indexWaveletName) { WaveId waveId = indexWaveletName.waveId; Preconditions.checkArgument(isIndexWave(waveId), waveId + STR); try { return ModernIdSerialiser.INSTANCE.deserialiseWaveId( ModernIdSerialiser.INSTANCE.serialiseWaveletId(indexWaveletName.waveletId)); } catch (InvalidIdException e) { throw new IllegalStateException(e); } }
/** * Extracts the wave id referred to by an index wavelet name. * * @param indexWaveletName of the index wavelet. * @return the wave id. * @throws IllegalArgumentException if the wavelet is not from an index wave. */
Extracts the wave id referred to by an index wavelet name
waveIdFromIndexWavelet
{ "repo_name": "vega113/WaveInCloud", "path": "src/org/waveprotocol/box/common/IndexWave.java", "license": "apache-2.0", "size": 11885 }
[ "com.google.common.base.Preconditions", "org.waveprotocol.wave.model.id.InvalidIdException", "org.waveprotocol.wave.model.id.ModernIdSerialiser", "org.waveprotocol.wave.model.id.WaveId", "org.waveprotocol.wave.model.id.WaveletName" ]
import com.google.common.base.Preconditions; import org.waveprotocol.wave.model.id.InvalidIdException; import org.waveprotocol.wave.model.id.ModernIdSerialiser; import org.waveprotocol.wave.model.id.WaveId; import org.waveprotocol.wave.model.id.WaveletName;
import com.google.common.base.*; import org.waveprotocol.wave.model.id.*;
[ "com.google.common", "org.waveprotocol.wave" ]
com.google.common; org.waveprotocol.wave;
921,978
private double computeRate(double rate) { if (this.getSize() < FullMembershipSet.samplingSizeMinimum) return 1; if (rate <= FullMembershipSet.samplingThreshold) return rate; else return 1; } private static class FullSampledRowIterator implements ISampledRowIterator { private int cursor = 0; private final int range; private final double rate; private final Randomness prg; FullSampledRowIterator(final int range, double rate, long seed) { this.rate = rate; this.range = range; this.prg = new Randomness(seed); } @Override public double rate() { return this.rate; }
double function(double rate) { if (this.getSize() < FullMembershipSet.samplingSizeMinimum) return 1; if (rate <= FullMembershipSet.samplingThreshold) return rate; else return 1; } private static class FullSampledRowIterator implements ISampledRowIterator { private int cursor = 0; private final int range; private final double rate; private final Randomness prg; FullSampledRowIterator(final int range, double rate, long seed) { this.rate = rate; this.range = range; this.prg = new Randomness(seed); } public double rate() { return this.rate; }
/** * Returns the best rate to sample the data given the rate the user asked for * @return the actual rate to sample the data */
Returns the best rate to sample the data given the rate the user asked for
computeRate
{ "repo_name": "mbudiu-vmw/hiero", "path": "platform/src/main/java/org/hillview/table/membership/FullMembershipSet.java", "license": "apache-2.0", "size": 5653 }
[ "org.hillview.table.api.ISampledRowIterator", "org.hillview.utils.Randomness" ]
import org.hillview.table.api.ISampledRowIterator; import org.hillview.utils.Randomness;
import org.hillview.table.api.*; import org.hillview.utils.*;
[ "org.hillview.table", "org.hillview.utils" ]
org.hillview.table; org.hillview.utils;
729,558
public static Date addTimeToDate( Date input, String time, String dateFormat ) throws Exception { if ( Utils.isEmpty( time ) ) { return input; } if ( input == null ) { return null; } String dateformatString = NVL( dateFormat, "HH:mm:ss" ); int t = decodeTime( time, dateformatString ); return new Date( input.getTime() + t ); }
static Date function( Date input, String time, String dateFormat ) throws Exception { if ( Utils.isEmpty( time ) ) { return input; } if ( input == null ) { return null; } String dateformatString = NVL( dateFormat, STR ); int t = decodeTime( time, dateformatString ); return new Date( input.getTime() + t ); }
/** * Add time to an input date * * @param input * the date * @param time * the time to add (in string) * @param dateFormat * the time format * @return date = input + time */
Add time to an input date
addTimeToDate
{ "repo_name": "pedrofvteixeira/pentaho-kettle", "path": "core/src/main/java/org/pentaho/di/core/Const.java", "license": "apache-2.0", "size": 131745 }
[ "java.util.Date", "org.pentaho.di.core.util.Utils" ]
import java.util.Date; import org.pentaho.di.core.util.Utils;
import java.util.*; import org.pentaho.di.core.util.*;
[ "java.util", "org.pentaho.di" ]
java.util; org.pentaho.di;
1,890,490
public static Long getLong(JSONObject jsonObject, String key, Long defaultValue) { if (jsonObject == null || StringUtils.isEmpty(key)) { return defaultValue; } try { return jsonObject.getLong(key); } catch (JSONException e) { if (isPrintException) { e.printStackTrace(); } return defaultValue; } }
static Long function(JSONObject jsonObject, String key, Long defaultValue) { if (jsonObject == null StringUtils.isEmpty(key)) { return defaultValue; } try { return jsonObject.getLong(key); } catch (JSONException e) { if (isPrintException) { e.printStackTrace(); } return defaultValue; } }
/** * get Long from jsonObject * * @param jsonObject * @param key * @param defaultValue * @return <ul> * <li>if jsonObject is null, return defaultValue</li> * <li>if key is null or empty, return defaultValue</li> * <li>if {@link JSONObject#getLong(String)} exception, return * defaultValue</li> * <li>return {@link JSONObject#getLong(String)}</li> * </ul> */
get Long from jsonObject
getLong
{ "repo_name": "TechshinoEyeKey/android_sdk", "path": "app/src/main/java/com/techshino/eyekeydemo/utils/JSONUtils.java", "license": "apache-2.0", "size": 19673 }
[ "org.json.JSONException", "org.json.JSONObject" ]
import org.json.JSONException; import org.json.JSONObject;
import org.json.*;
[ "org.json" ]
org.json;
1,402,550
@Test @WithMockUser public void logoutWhenUsingVariousCustomizationsMatchesNamespace() throws Exception { this.spring.register(CustomHttpLogoutConfig.class).autowire(); // @formatter:off this.mvc.perform(post("/custom-logout").with(csrf())) .andExpect(authenticated(false)) .andExpect(redirectedUrl("/logout-success")) .andExpect((result) -> assertThat(result.getResponse().getCookies()).hasSize(1)) .andExpect(cookie().maxAge("remove", 0)) .andExpect(session(Objects::nonNull)); // @formatter:on }
void function() throws Exception { this.spring.register(CustomHttpLogoutConfig.class).autowire(); this.mvc.perform(post(STR).with(csrf())) .andExpect(authenticated(false)) .andExpect(redirectedUrl(STR)) .andExpect((result) -> assertThat(result.getResponse().getCookies()).hasSize(1)) .andExpect(cookie().maxAge(STR, 0)) .andExpect(session(Objects::nonNull)); }
/** * http/logout custom */
http/logout custom
logoutWhenUsingVariousCustomizationsMatchesNamespace
{ "repo_name": "djechelon/spring-security", "path": "config/src/test/java/org/springframework/security/config/annotation/web/configurers/NamespaceHttpLogoutTests.java", "license": "apache-2.0", "size": 8932 }
[ "java.util.Objects", "org.assertj.core.api.Assertions" ]
import java.util.Objects; import org.assertj.core.api.Assertions;
import java.util.*; import org.assertj.core.api.*;
[ "java.util", "org.assertj.core" ]
java.util; org.assertj.core;
1,655,329
private void writeMatrix(DataOutputStream output, MLArray array) throws IOException { OSArrayTag tag; ByteArrayOutputStream buffer; DataOutputStream bufferDOS; ByteArrayOutputStream baos = new ByteArrayOutputStream(); DataOutputStream dos = new DataOutputStream(baos); //flags writeFlags(dos, array); //dimensions writeDimensions(dos, array); //array name writeName(dos, array); switch ( array.getType() ) { case MLArray.mxCHAR_CLASS: //write char data buffer = new ByteArrayOutputStream(); bufferDOS = new DataOutputStream(buffer); Character[] ac = ((MLChar)array).exportChar(); for ( int i = 0; i < ac.length; i++ ) { bufferDOS.writeByte( (byte)ac[i].charValue() ); } tag = new OSArrayTag(MatDataTypes.miUTF8, buffer.toByteArray() ); tag.writeTo( dos ); break; case MLArray.mxDOUBLE_CLASS: tag = new OSArrayTag(MatDataTypes.miDOUBLE, ((MLNumericArray<?>)array).getRealByteBuffer() ); tag.writeTo( dos ); //write real imaginary if ( array.isComplex() ) { tag = new OSArrayTag(MatDataTypes.miDOUBLE, ((MLNumericArray<?>)array).getImaginaryByteBuffer() ); tag.writeTo( dos ); } break; case MLArray.mxSINGLE_CLASS: tag = new OSArrayTag(MatDataTypes.miSINGLE, ((MLNumericArray<?>)array).getRealByteBuffer() ); tag.writeTo( dos ); //write real imaginary if ( array.isComplex() ) { tag = new OSArrayTag(MatDataTypes.miSINGLE, ((MLNumericArray<?>)array).getImaginaryByteBuffer() ); tag.writeTo( dos ); } break; case MLArray.mxUINT8_CLASS: tag = new OSArrayTag(MatDataTypes.miUINT8, ((MLNumericArray<?>)array).getRealByteBuffer() ); tag.writeTo( dos ); //write real imaginary if ( array.isComplex() ) { tag = new OSArrayTag(MatDataTypes.miUINT8, ((MLNumericArray<?>)array).getImaginaryByteBuffer() ); tag.writeTo( dos ); } break; case MLArray.mxINT8_CLASS: tag = new OSArrayTag(MatDataTypes.miINT8, ((MLNumericArray<?>)array).getRealByteBuffer() ); tag.writeTo( dos ); //write real imaginary if ( array.isComplex() ) { tag = new OSArrayTag(MatDataTypes.miINT8, ((MLNumericArray<?>)array).getImaginaryByteBuffer() ); tag.writeTo( dos ); } break; case MLArray.mxINT64_CLASS: tag = new OSArrayTag(MatDataTypes.miINT64, ((MLNumericArray<?>)array).getRealByteBuffer() ); tag.writeTo( dos ); //write real imaginary if ( array.isComplex() ) { tag = new OSArrayTag(MatDataTypes.miINT64, ((MLNumericArray<?>)array).getImaginaryByteBuffer() ); tag.writeTo( dos ); } break; case MLArray.mxUINT64_CLASS: tag = new OSArrayTag(MatDataTypes.miUINT64, ((MLNumericArray<?>)array).getRealByteBuffer() ); tag.writeTo( dos ); //write real imaginary if ( array.isComplex() ) { tag = new OSArrayTag(MatDataTypes.miUINT64, ((MLNumericArray<?>)array).getImaginaryByteBuffer() ); tag.writeTo( dos ); } break; case MLArray.mxSTRUCT_CLASS: //field name length int itag = 4 << 16 | MatDataTypes.miINT32 & 0xffff; dos.writeInt( itag ); dos.writeInt( ((MLStructure)array).getMaxFieldLenth() ); //get field names tag = new OSArrayTag(MatDataTypes.miINT8, ((MLStructure)array).getKeySetToByteArray() ); tag.writeTo( dos ); for ( MLArray a : ((MLStructure)array).getAllFields() ) { writeMatrix(dos, a); } break; case MLArray.mxCELL_CLASS: for ( MLArray a : ((MLCell)array).cells() ) { writeMatrix(dos, a); } break; case MLArray.mxSPARSE_CLASS: int[] ai; //write ir buffer = new ByteArrayOutputStream(); bufferDOS = new DataOutputStream(buffer); ai = ((MLSparse)array).getIR(); for ( int i : ai ) { bufferDOS.writeInt( i ); } tag = new OSArrayTag(MatDataTypes.miINT32, buffer.toByteArray() ); tag.writeTo( dos ); //write jc buffer = new ByteArrayOutputStream(); bufferDOS = new DataOutputStream(buffer); ai = ((MLSparse)array).getJC(); for ( int i : ai ) { bufferDOS.writeInt( i ); } tag = new OSArrayTag(MatDataTypes.miINT32, buffer.toByteArray() ); tag.writeTo( dos ); //write real buffer = new ByteArrayOutputStream(); bufferDOS = new DataOutputStream(buffer); Double[] ad = ((MLSparse)array).exportReal(); for ( int i = 0; i < ad.length; i++ ) { bufferDOS.writeDouble( ad[i].doubleValue() ); } tag = new OSArrayTag(MatDataTypes.miDOUBLE, buffer.toByteArray() ); tag.writeTo( dos ); //write real imaginary if ( array.isComplex() ) { buffer = new ByteArrayOutputStream(); bufferDOS = new DataOutputStream(buffer); ad = ((MLSparse)array).exportImaginary(); for ( int i = 0; i < ad.length; i++ ) { bufferDOS.writeDouble( ad[i].doubleValue() ); } tag = new OSArrayTag(MatDataTypes.miDOUBLE, buffer.toByteArray() ); tag.writeTo( dos ); } break; default: throw new MatlabIOException("Cannot write matrix of type: " + MLArray.typeToString( array.getType() )); } //write matrix output.writeInt(MatDataTypes.miMATRIX); //matrix tag output.writeInt( baos.size() ); //size of matrix output.write( baos.toByteArray() ); //matrix data }
void function(DataOutputStream output, MLArray array) throws IOException { OSArrayTag tag; ByteArrayOutputStream buffer; DataOutputStream bufferDOS; ByteArrayOutputStream baos = new ByteArrayOutputStream(); DataOutputStream dos = new DataOutputStream(baos); writeFlags(dos, array); writeDimensions(dos, array); writeName(dos, array); switch ( array.getType() ) { case MLArray.mxCHAR_CLASS: buffer = new ByteArrayOutputStream(); bufferDOS = new DataOutputStream(buffer); Character[] ac = ((MLChar)array).exportChar(); for ( int i = 0; i < ac.length; i++ ) { bufferDOS.writeByte( (byte)ac[i].charValue() ); } tag = new OSArrayTag(MatDataTypes.miUTF8, buffer.toByteArray() ); tag.writeTo( dos ); break; case MLArray.mxDOUBLE_CLASS: tag = new OSArrayTag(MatDataTypes.miDOUBLE, ((MLNumericArray<?>)array).getRealByteBuffer() ); tag.writeTo( dos ); if ( array.isComplex() ) { tag = new OSArrayTag(MatDataTypes.miDOUBLE, ((MLNumericArray<?>)array).getImaginaryByteBuffer() ); tag.writeTo( dos ); } break; case MLArray.mxSINGLE_CLASS: tag = new OSArrayTag(MatDataTypes.miSINGLE, ((MLNumericArray<?>)array).getRealByteBuffer() ); tag.writeTo( dos ); if ( array.isComplex() ) { tag = new OSArrayTag(MatDataTypes.miSINGLE, ((MLNumericArray<?>)array).getImaginaryByteBuffer() ); tag.writeTo( dos ); } break; case MLArray.mxUINT8_CLASS: tag = new OSArrayTag(MatDataTypes.miUINT8, ((MLNumericArray<?>)array).getRealByteBuffer() ); tag.writeTo( dos ); if ( array.isComplex() ) { tag = new OSArrayTag(MatDataTypes.miUINT8, ((MLNumericArray<?>)array).getImaginaryByteBuffer() ); tag.writeTo( dos ); } break; case MLArray.mxINT8_CLASS: tag = new OSArrayTag(MatDataTypes.miINT8, ((MLNumericArray<?>)array).getRealByteBuffer() ); tag.writeTo( dos ); if ( array.isComplex() ) { tag = new OSArrayTag(MatDataTypes.miINT8, ((MLNumericArray<?>)array).getImaginaryByteBuffer() ); tag.writeTo( dos ); } break; case MLArray.mxINT64_CLASS: tag = new OSArrayTag(MatDataTypes.miINT64, ((MLNumericArray<?>)array).getRealByteBuffer() ); tag.writeTo( dos ); if ( array.isComplex() ) { tag = new OSArrayTag(MatDataTypes.miINT64, ((MLNumericArray<?>)array).getImaginaryByteBuffer() ); tag.writeTo( dos ); } break; case MLArray.mxUINT64_CLASS: tag = new OSArrayTag(MatDataTypes.miUINT64, ((MLNumericArray<?>)array).getRealByteBuffer() ); tag.writeTo( dos ); if ( array.isComplex() ) { tag = new OSArrayTag(MatDataTypes.miUINT64, ((MLNumericArray<?>)array).getImaginaryByteBuffer() ); tag.writeTo( dos ); } break; case MLArray.mxSTRUCT_CLASS: int itag = 4 << 16 MatDataTypes.miINT32 & 0xffff; dos.writeInt( itag ); dos.writeInt( ((MLStructure)array).getMaxFieldLenth() ); tag = new OSArrayTag(MatDataTypes.miINT8, ((MLStructure)array).getKeySetToByteArray() ); tag.writeTo( dos ); for ( MLArray a : ((MLStructure)array).getAllFields() ) { writeMatrix(dos, a); } break; case MLArray.mxCELL_CLASS: for ( MLArray a : ((MLCell)array).cells() ) { writeMatrix(dos, a); } break; case MLArray.mxSPARSE_CLASS: int[] ai; buffer = new ByteArrayOutputStream(); bufferDOS = new DataOutputStream(buffer); ai = ((MLSparse)array).getIR(); for ( int i : ai ) { bufferDOS.writeInt( i ); } tag = new OSArrayTag(MatDataTypes.miINT32, buffer.toByteArray() ); tag.writeTo( dos ); buffer = new ByteArrayOutputStream(); bufferDOS = new DataOutputStream(buffer); ai = ((MLSparse)array).getJC(); for ( int i : ai ) { bufferDOS.writeInt( i ); } tag = new OSArrayTag(MatDataTypes.miINT32, buffer.toByteArray() ); tag.writeTo( dos ); buffer = new ByteArrayOutputStream(); bufferDOS = new DataOutputStream(buffer); Double[] ad = ((MLSparse)array).exportReal(); for ( int i = 0; i < ad.length; i++ ) { bufferDOS.writeDouble( ad[i].doubleValue() ); } tag = new OSArrayTag(MatDataTypes.miDOUBLE, buffer.toByteArray() ); tag.writeTo( dos ); if ( array.isComplex() ) { buffer = new ByteArrayOutputStream(); bufferDOS = new DataOutputStream(buffer); ad = ((MLSparse)array).exportImaginary(); for ( int i = 0; i < ad.length; i++ ) { bufferDOS.writeDouble( ad[i].doubleValue() ); } tag = new OSArrayTag(MatDataTypes.miDOUBLE, buffer.toByteArray() ); tag.writeTo( dos ); } break; default: throw new MatlabIOException(STR + MLArray.typeToString( array.getType() )); } output.writeInt(MatDataTypes.miMATRIX); output.writeInt( baos.size() ); output.write( baos.toByteArray() ); }
/** * Writes MATRIX into <code>OutputStream</code>. * * @param os - <code>OutputStream</code> * @param array - a <code>MLArray</code> * @throws IOException */
Writes MATRIX into <code>OutputStream</code>
writeMatrix
{ "repo_name": "kasemir/org.csstudio.display.builder", "path": "databrowser3/databrowser-plugins/org.csstudio.trends.databrowser3/src/com/jmatio/io/MatFileWriter.java", "license": "epl-1.0", "size": 17217 }
[ "com.jmatio.common.MatDataTypes", "com.jmatio.types.MLArray", "com.jmatio.types.MLCell", "com.jmatio.types.MLChar", "com.jmatio.types.MLNumericArray", "com.jmatio.types.MLSparse", "com.jmatio.types.MLStructure", "java.io.ByteArrayOutputStream", "java.io.DataOutputStream", "java.io.IOException" ]
import com.jmatio.common.MatDataTypes; import com.jmatio.types.MLArray; import com.jmatio.types.MLCell; import com.jmatio.types.MLChar; import com.jmatio.types.MLNumericArray; import com.jmatio.types.MLSparse; import com.jmatio.types.MLStructure; import java.io.ByteArrayOutputStream; import java.io.DataOutputStream; import java.io.IOException;
import com.jmatio.common.*; import com.jmatio.types.*; import java.io.*;
[ "com.jmatio.common", "com.jmatio.types", "java.io" ]
com.jmatio.common; com.jmatio.types; java.io;
1,491,416
boolean differentSettings(int filterId, Settings settings, int width) { return this.filterId != filterId || fractionPositives != settings.fractionPositives || fractionNegativesAfterAllPositives != settings.fractionNegativesAfterAllPositives || negativesAfterAllPositives != settings.negativesAfterAllPositives || this.width != width; } } private static class Settings { static final MultiPathFilter defaultMultiFilter; static final double[] defaultParameters; static { // Add a filter to use for storing the slice results: // Use the standard configuration to ensure sensible fits are stored as the current slice // results. final FitConfiguration tmp = new FitConfiguration(); final PrecisionMethod precisionMethod = PrecisionMethod.MORTENSEN_LOCAL_BACKGROUND; tmp.setPrecisionMethod(precisionMethod); final DirectFilter primaryFilter = tmp.getDefaultSmartFilter(); // We might as well use the doublet fits given we will compute them. final double residualsThreshold = 0.4; defaultMultiFilter = new MultiPathFilter(primaryFilter, FitWorker.createMinimalFilter(precisionMethod), residualsThreshold); defaultParameters = createParameters(createDefaultConfig()); } private static final AtomicReference<Settings> lastSettings = new AtomicReference<>(new Settings()); FitEngineConfiguration config; MultiPathFilter multiFilter; double fractionPositives; double fractionNegativesAfterAllPositives; int negativesAfterAllPositives; double distance; double lowerDistance; double signalFactor; double lowerSignalFactor; boolean computeDoublets; boolean showFilterScoreHistograms; boolean saveFilterRange; boolean showCorrelation; boolean rankByIntensity; Settings() { // Set defaults config = createDefaultConfig(); multiFilter = defaultMultiFilter.copy(); fractionPositives = 100; fractionNegativesAfterAllPositives = 50; negativesAfterAllPositives = 10; distance = 1.5; lowerDistance = 1.5; signalFactor = 2; lowerSignalFactor = 1; computeDoublets = true; saveFilterRange = true; } Settings(Settings source) { config = source.config.createCopy(); multiFilter = source.multiFilter.copy(); fractionPositives = source.fractionPositives; fractionNegativesAfterAllPositives = source.fractionNegativesAfterAllPositives; negativesAfterAllPositives = source.negativesAfterAllPositives; distance = source.distance; lowerDistance = source.lowerDistance; signalFactor = source.signalFactor; lowerSignalFactor = source.lowerSignalFactor; computeDoublets = source.computeDoublets; showFilterScoreHistograms = source.showFilterScoreHistograms; saveFilterRange = source.saveFilterRange; showCorrelation = source.showCorrelation; rankByIntensity = source.rankByIntensity; }
boolean differentSettings(int filterId, Settings settings, int width) { return this.filterId != filterId fractionPositives != settings.fractionPositives fractionNegativesAfterAllPositives != settings.fractionNegativesAfterAllPositives negativesAfterAllPositives != settings.negativesAfterAllPositives this.width != width; } } private static class Settings { static final MultiPathFilter defaultMultiFilter; static final double[] defaultParameters; static { final FitConfiguration tmp = new FitConfiguration(); final PrecisionMethod precisionMethod = PrecisionMethod.MORTENSEN_LOCAL_BACKGROUND; tmp.setPrecisionMethod(precisionMethod); final DirectFilter primaryFilter = tmp.getDefaultSmartFilter(); final double residualsThreshold = 0.4; defaultMultiFilter = new MultiPathFilter(primaryFilter, FitWorker.createMinimalFilter(precisionMethod), residualsThreshold); defaultParameters = createParameters(createDefaultConfig()); } private static final AtomicReference<Settings> lastSettings = new AtomicReference<>(new Settings()); FitEngineConfiguration config; MultiPathFilter multiFilter; double fractionPositives; double fractionNegativesAfterAllPositives; int negativesAfterAllPositives; double distance; double lowerDistance; double signalFactor; double lowerSignalFactor; boolean computeDoublets; boolean showFilterScoreHistograms; boolean saveFilterRange; boolean showCorrelation; boolean rankByIntensity; Settings() { config = createDefaultConfig(); multiFilter = defaultMultiFilter.copy(); fractionPositives = 100; fractionNegativesAfterAllPositives = 50; negativesAfterAllPositives = 10; distance = 1.5; lowerDistance = 1.5; signalFactor = 2; lowerSignalFactor = 1; computeDoublets = true; saveFilterRange = true; } Settings(Settings source) { config = source.config.createCopy(); multiFilter = source.multiFilter.copy(); fractionPositives = source.fractionPositives; fractionNegativesAfterAllPositives = source.fractionNegativesAfterAllPositives; negativesAfterAllPositives = source.negativesAfterAllPositives; distance = source.distance; lowerDistance = source.lowerDistance; signalFactor = source.signalFactor; lowerSignalFactor = source.lowerSignalFactor; computeDoublets = source.computeDoublets; showFilterScoreHistograms = source.showFilterScoreHistograms; saveFilterRange = source.saveFilterRange; showCorrelation = source.showCorrelation; rankByIntensity = source.rankByIntensity; }
/** * Return true if the settings used in the candidate data are different. * * @param filterId the filter id * @param settings the settings * @param width the width * @return true if different */
Return true if the settings used in the candidate data are different
differentSettings
{ "repo_name": "aherbert/GDSC-SMLM", "path": "src/main/java/uk/ac/sussex/gdsc/smlm/ij/plugins/benchmark/BenchmarkSpotFit.java", "license": "gpl-3.0", "size": 116030 }
[ "java.util.concurrent.atomic.AtomicReference", "uk.ac.sussex.gdsc.smlm.data.config.FitProtos", "uk.ac.sussex.gdsc.smlm.engine.FitConfiguration", "uk.ac.sussex.gdsc.smlm.engine.FitEngineConfiguration", "uk.ac.sussex.gdsc.smlm.engine.FitWorker", "uk.ac.sussex.gdsc.smlm.results.filter.DirectFilter", "uk.ac.sussex.gdsc.smlm.results.filter.MultiPathFilter" ]
import java.util.concurrent.atomic.AtomicReference; import uk.ac.sussex.gdsc.smlm.data.config.FitProtos; import uk.ac.sussex.gdsc.smlm.engine.FitConfiguration; import uk.ac.sussex.gdsc.smlm.engine.FitEngineConfiguration; import uk.ac.sussex.gdsc.smlm.engine.FitWorker; import uk.ac.sussex.gdsc.smlm.results.filter.DirectFilter; import uk.ac.sussex.gdsc.smlm.results.filter.MultiPathFilter;
import java.util.concurrent.atomic.*; import uk.ac.sussex.gdsc.smlm.data.config.*; import uk.ac.sussex.gdsc.smlm.engine.*; import uk.ac.sussex.gdsc.smlm.results.filter.*;
[ "java.util", "uk.ac.sussex" ]
java.util; uk.ac.sussex;
2,280,285
public void onEntityPropertiesSelectionChanged(LevelEditorEntity entity) { entityPropertyName.getController().setDisabled(true); entityPropertyName.getController().setValue(TEXT_EMPTY); entityPropertyValue.getController().setDisabled(true); entityPropertyValue.getController().setValue(TEXT_EMPTY); entityPropertySave.getController().setDisabled(true); entityPropertyRemove.getController().setDisabled(true); PropertyModelClass entityProperty = entity.getProperty(entityPropertiesList.getController().getValue().toString()); if (entityProperty != null) { entityPropertyName.getController().setValue(value.set(entityProperty.getName())); entityPropertyValue.getController().setValue(value.set(entityProperty.getValue())); entityPropertyName.getController().setDisabled(false); entityPropertyValue.getController().setDisabled(false); entityPropertySave.getController().setDisabled(false); entityPropertyRemove.getController().setDisabled(false); } }
void function(LevelEditorEntity entity) { entityPropertyName.getController().setDisabled(true); entityPropertyName.getController().setValue(TEXT_EMPTY); entityPropertyValue.getController().setDisabled(true); entityPropertyValue.getController().setValue(TEXT_EMPTY); entityPropertySave.getController().setDisabled(true); entityPropertyRemove.getController().setDisabled(true); PropertyModelClass entityProperty = entity.getProperty(entityPropertiesList.getController().getValue().toString()); if (entityProperty != null) { entityPropertyName.getController().setValue(value.set(entityProperty.getName())); entityPropertyValue.getController().setValue(value.set(entityProperty.getValue())); entityPropertyName.getController().setDisabled(false); entityPropertyValue.getController().setDisabled(false); entityPropertySave.getController().setDisabled(false); entityPropertyRemove.getController().setDisabled(false); } }
/** * Event callback for entity properties selection * @pafam entity */
Event callback for entity properties selection
onEntityPropertiesSelectionChanged
{ "repo_name": "andreasdr/tdme", "path": "src/net/drewke/tdme/tools/shared/controller/EntityBaseSubScreenController.java", "license": "mit", "size": 12581 }
[ "net.drewke.tdme.tools.shared.model.LevelEditorEntity", "net.drewke.tdme.tools.shared.model.PropertyModelClass" ]
import net.drewke.tdme.tools.shared.model.LevelEditorEntity; import net.drewke.tdme.tools.shared.model.PropertyModelClass;
import net.drewke.tdme.tools.shared.model.*;
[ "net.drewke.tdme" ]
net.drewke.tdme;
675,024