method
stringlengths
13
441k
clean_method
stringlengths
7
313k
doc
stringlengths
17
17.3k
comment
stringlengths
3
1.42k
method_name
stringlengths
1
273
extra
dict
imports
list
imports_info
stringlengths
19
34.8k
cluster_imports_info
stringlengths
15
3.66k
libraries
list
libraries_info
stringlengths
6
661
id
int64
0
2.92M
public static DefaultFuture newFuture(Channel channel, Request request, int timeout) { final DefaultFuture future = new DefaultFuture(channel, request, timeout); // timeout check timeoutCheck(future); return future; }
static DefaultFuture function(Channel channel, Request request, int timeout) { final DefaultFuture future = new DefaultFuture(channel, request, timeout); timeoutCheck(future); return future; }
/** * init a DefaultFuture * 1.init a DefaultFuture * 2.timeout check * * @param channel channel * @param request the request * @param timeout timeout * @return a new DefaultFuture */
init a DefaultFuture 1.init a DefaultFuture 2.timeout check
newFuture
{ "repo_name": "alibaba/dubbo", "path": "dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/exchange/support/DefaultFuture.java", "license": "apache-2.0", "size": 12455 }
[ "org.apache.dubbo.remoting.Channel", "org.apache.dubbo.remoting.exchange.Request" ]
import org.apache.dubbo.remoting.Channel; import org.apache.dubbo.remoting.exchange.Request;
import org.apache.dubbo.remoting.*; import org.apache.dubbo.remoting.exchange.*;
[ "org.apache.dubbo" ]
org.apache.dubbo;
1,257,623
class LastExceptionInStreamer extends ExceptionLastSeen { @Override synchronized void check(boolean resetToNull) throws IOException { final IOException thrown = get(); if (thrown != null) { if (LOG.isTraceEnabled()) { // wrap and print the exception to know when the check is called LOG.trace("Got Exception while checking, " + DataStreamer.this, new Throwable(thrown)); } super.check(resetToNull); } } } enum ErrorType { NONE, INTERNAL, EXTERNAL } static class ErrorState { ErrorType error = ErrorType.NONE; private int badNodeIndex = -1; private boolean waitForRestart = true; private int restartingNodeIndex = -1; private long restartingNodeDeadline = 0; private final long datanodeRestartTimeout; ErrorState(long datanodeRestartTimeout) { this.datanodeRestartTimeout = datanodeRestartTimeout; }
class LastExceptionInStreamer extends ExceptionLastSeen { synchronized void check(boolean resetToNull) throws IOException { final IOException thrown = get(); if (thrown != null) { if (LOG.isTraceEnabled()) { LOG.trace(STR + DataStreamer.this, new Throwable(thrown)); } super.check(resetToNull); } } } enum ErrorType { NONE, INTERNAL, EXTERNAL } static class ErrorState { ErrorType error = ErrorType.NONE; private int badNodeIndex = -1; private boolean waitForRestart = true; private int restartingNodeIndex = -1; private long restartingNodeDeadline = 0; private final long datanodeRestartTimeout; ErrorState(long datanodeRestartTimeout) { this.datanodeRestartTimeout = datanodeRestartTimeout; }
/** * Check if there already is an exception. */
Check if there already is an exception
check
{ "repo_name": "JingchengDu/hadoop", "path": "hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DataStreamer.java", "license": "apache-2.0", "size": 77567 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
1,601,057
@Test public void testNoSpaceArchive() throws Exception { LOG.info("testNoSpaceArchive"); final PathPolicyMap pathPolicyMap = new PathPolicyMap(0); final NamespaceScheme nsScheme = pathPolicyMap.newNamespaceScheme(); final ClusterScheme clusterScheme = new ClusterScheme(DEFAULT_CONF, NUM_DATANODES, REPL, genStorageTypes(NUM_DATANODES), null); final MigrationTest test = new MigrationTest(clusterScheme, nsScheme); try { test.runBasicTest(false); // create 2 hot files with replication 3 final short replication = 3; for (int i = 0; i < 2; i++) { final Path p = new Path(pathPolicyMap.cold, "file" + i); DFSTestUtil.createFile(test.dfs, p, BLOCK_SIZE, replication, 0L); waitForAllReplicas(replication, p, test.dfs); } // set all the ARCHIVE volume to full for (DataNode dn : test.cluster.getDataNodes()) { setVolumeFull(dn, StorageType.ARCHIVE); DataNodeTestUtils.triggerHeartbeat(dn); } { // test increasing replication but new replicas cannot be created // since no more ARCHIVE space. final Path file0 = new Path(pathPolicyMap.cold, "file0"); final Replication r = test.getReplication(file0); Assert.assertEquals(0, r.disk); final short newReplication = (short) 5; test.dfs.setReplication(file0, newReplication); Thread.sleep(10000); test.verifyReplication(file0, 0, r.archive); } { // test creating a hot file final Path p = new Path(pathPolicyMap.hot, "foo"); DFSTestUtil.createFile(test.dfs, p, BLOCK_SIZE, (short) 3, 0L); } { //test move a cold file to warm final Path file1 = new Path(pathPolicyMap.cold, "file1"); test.dfs.rename(file1, pathPolicyMap.warm); test.migrate(); test.verify(true); } } finally { test.shutdownCluster(); } }
void function() throws Exception { LOG.info(STR); final PathPolicyMap pathPolicyMap = new PathPolicyMap(0); final NamespaceScheme nsScheme = pathPolicyMap.newNamespaceScheme(); final ClusterScheme clusterScheme = new ClusterScheme(DEFAULT_CONF, NUM_DATANODES, REPL, genStorageTypes(NUM_DATANODES), null); final MigrationTest test = new MigrationTest(clusterScheme, nsScheme); try { test.runBasicTest(false); final short replication = 3; for (int i = 0; i < 2; i++) { final Path p = new Path(pathPolicyMap.cold, "file" + i); DFSTestUtil.createFile(test.dfs, p, BLOCK_SIZE, replication, 0L); waitForAllReplicas(replication, p, test.dfs); } for (DataNode dn : test.cluster.getDataNodes()) { setVolumeFull(dn, StorageType.ARCHIVE); DataNodeTestUtils.triggerHeartbeat(dn); } { final Path file0 = new Path(pathPolicyMap.cold, "file0"); final Replication r = test.getReplication(file0); Assert.assertEquals(0, r.disk); final short newReplication = (short) 5; test.dfs.setReplication(file0, newReplication); Thread.sleep(10000); test.verifyReplication(file0, 0, r.archive); } { final Path p = new Path(pathPolicyMap.hot, "foo"); DFSTestUtil.createFile(test.dfs, p, BLOCK_SIZE, (short) 3, 0L); } { final Path file1 = new Path(pathPolicyMap.cold, "file1"); test.dfs.rename(file1, pathPolicyMap.warm); test.migrate(); test.verify(true); } } finally { test.shutdownCluster(); } }
/** * Test ARCHIVE is running out of spaces. */
Test ARCHIVE is running out of spaces
testNoSpaceArchive
{ "repo_name": "ZhangXFeng/hadoop", "path": "src/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/mover/TestStorageMover.java", "license": "apache-2.0", "size": 27758 }
[ "org.apache.hadoop.fs.Path", "org.apache.hadoop.hdfs.DFSTestUtil", "org.apache.hadoop.hdfs.StorageType", "org.apache.hadoop.hdfs.server.datanode.DataNode", "org.apache.hadoop.hdfs.server.datanode.DataNodeTestUtils", "org.junit.Assert" ]
import org.apache.hadoop.fs.Path; import org.apache.hadoop.hdfs.DFSTestUtil; import org.apache.hadoop.hdfs.StorageType; import org.apache.hadoop.hdfs.server.datanode.DataNode; import org.apache.hadoop.hdfs.server.datanode.DataNodeTestUtils; import org.junit.Assert;
import org.apache.hadoop.fs.*; import org.apache.hadoop.hdfs.*; import org.apache.hadoop.hdfs.server.datanode.*; import org.junit.*;
[ "org.apache.hadoop", "org.junit" ]
org.apache.hadoop; org.junit;
2,164,489
public void testCommutative() { //System.out.println("table = " + ring.table.toString(vars)); //System.out.println("table = " + ring.table.toScript()); //System.out.println("ring = " + ring); //System.out.println("ring.table = " + ring.table.toScript()); //assertEquals("table == ring.table: ", table, ring.table); // ? assertTrue("# relations == 2", ring.table.size() == 2); cring = new GenSolvablePolynomialRing<BigRational>(cfac, tord, cvars); List<GenSolvablePolynomial<BigRational>> il = new ArrayList<GenSolvablePolynomial<BigRational>>(); GenSolvablePolynomial<BigRational> p1 = cring.parse("b - a^2"); il.add(p1); sideal = new SolvableIdeal<BigRational>(cring, il); qcring = new SolvableLocalRing<BigRational>(sideal); ring = new LocalSolvablePolynomialRing<BigRational>(qcring, ring); //table = ring.table; //System.out.println("table = " + table.toString(vars)); //System.out.println("ring = " + ring); assertTrue("isCommutative()", ring.isCommutative()); assertTrue("isAssociative()", ring.isAssociative()); a = ring.random(kl, ll, el, q); //a = ring.parse(" b x y z + a w z "); //System.out.println("a = " + a); b = ring.random(kl, ll, el, q); //b = ring.parse(" w y z - b x "); //System.out.println("b = " + b); // commutative c = b.multiply(a); //System.out.println("c = " + c); d = a.multiply(b); //d = ring.getONE(); //System.out.println("d = " + d); assertEquals("b*a == a*b: ", c, d); }
void function() { assertTrue(STR, ring.table.size() == 2); cring = new GenSolvablePolynomialRing<BigRational>(cfac, tord, cvars); List<GenSolvablePolynomial<BigRational>> il = new ArrayList<GenSolvablePolynomial<BigRational>>(); GenSolvablePolynomial<BigRational> p1 = cring.parse(STR); il.add(p1); sideal = new SolvableIdeal<BigRational>(cring, il); qcring = new SolvableLocalRing<BigRational>(sideal); ring = new LocalSolvablePolynomialRing<BigRational>(qcring, ring); assertTrue(STR, ring.isCommutative()); assertTrue(STR, ring.isAssociative()); a = ring.random(kl, ll, el, q); b = ring.random(kl, ll, el, q); c = b.multiply(a); d = a.multiply(b); assertEquals(STR, c, d); }
/** * Test commutative ring. */
Test commutative ring
testCommutative
{ "repo_name": "breandan/java-algebra-system", "path": "trc/edu/jas/application/LocalSolvablePolynomialTest.java", "license": "gpl-2.0", "size": 23050 }
[ "edu.jas.arith.BigRational", "edu.jas.poly.GenSolvablePolynomial", "edu.jas.poly.GenSolvablePolynomialRing", "java.util.ArrayList", "java.util.List" ]
import edu.jas.arith.BigRational; import edu.jas.poly.GenSolvablePolynomial; import edu.jas.poly.GenSolvablePolynomialRing; import java.util.ArrayList; import java.util.List;
import edu.jas.arith.*; import edu.jas.poly.*; import java.util.*;
[ "edu.jas.arith", "edu.jas.poly", "java.util" ]
edu.jas.arith; edu.jas.poly; java.util;
2,378,386
public static void sort(Object[] a, Comparator c) { int N = a.length; for (int i = 0; i < N; i++) { int min = i; for (int j = i+1; j < N; j++) { if (less(c, a[j], a[min])) min = j; } exch(a, i, min); assert isSorted(a, c, 0, i); } assert isSorted(a, c); }
static void function(Object[] a, Comparator c) { int N = a.length; for (int i = 0; i < N; i++) { int min = i; for (int j = i+1; j < N; j++) { if (less(c, a[j], a[min])) min = j; } exch(a, i, min); assert isSorted(a, c, 0, i); } assert isSorted(a, c); }
/** * Rearranges the array in ascending order, using a comparator. * @param a the array * @param c the comparator specifying the order */
Rearranges the array in ascending order, using a comparator
sort
{ "repo_name": "sinlaputa/algorithms", "path": "algs4/Selection.java", "license": "apache-2.0", "size": 4434 }
[ "java.util.Comparator" ]
import java.util.Comparator;
import java.util.*;
[ "java.util" ]
java.util;
2,257,882
StackContainer<Integer> stack = new StackContainer<Integer>(); for (int i = 0; i < 6; i++) { stack.push(i); } stack.pop(); Integer result = stack.pop(); Integer expected = 4; assertThat(result, is(expected)); }
StackContainer<Integer> stack = new StackContainer<Integer>(); for (int i = 0; i < 6; i++) { stack.push(i); } stack.pop(); Integer result = stack.pop(); Integer expected = 4; assertThat(result, is(expected)); }
/** * Test Push and Pop. */
Test Push and Pop
whenPushValueToStackContainerAndThenPop
{ "repo_name": "Malamut54/dbobrov", "path": "chapter_005/src/test/java/ru/job4j/list/StackContainerTest.java", "license": "apache-2.0", "size": 662 }
[ "org.hamcrest.core.Is", "org.junit.Assert" ]
import org.hamcrest.core.Is; import org.junit.Assert;
import org.hamcrest.core.*; import org.junit.*;
[ "org.hamcrest.core", "org.junit" ]
org.hamcrest.core; org.junit;
2,152,349
public static ModelResponse delete(ModelRequest req, String model, Object id) throws ModelException { Properties props = new Properties(); props.put(Delete.SYSTEM_DELETE, Boolean.TRUE); props.put("id", id); return ModelTools.callModel(req, model, props); }
static ModelResponse function(ModelRequest req, String model, Object id) throws ModelException { Properties props = new Properties(); props.put(Delete.SYSTEM_DELETE, Boolean.TRUE); props.put("id", id); return ModelTools.callModel(req, model, props); }
/** * Call this method to perform a system internal delete process. * * @param req A model request. * @param model The delete model to call. * @param id The id of the persistent to delete. * @return The formular descriptor. */
Call this method to perform a system internal delete process
delete
{ "repo_name": "iritgo/iritgo-aktera", "path": "aktera-ui/src/main/java/de/iritgo/aktera/ui/form/Edit.java", "license": "apache-2.0", "size": 18112 }
[ "de.iritgo.aktera.model.ModelException", "de.iritgo.aktera.model.ModelRequest", "de.iritgo.aktera.model.ModelResponse", "de.iritgo.aktera.tools.ModelTools", "java.util.Properties" ]
import de.iritgo.aktera.model.ModelException; import de.iritgo.aktera.model.ModelRequest; import de.iritgo.aktera.model.ModelResponse; import de.iritgo.aktera.tools.ModelTools; import java.util.Properties;
import de.iritgo.aktera.model.*; import de.iritgo.aktera.tools.*; import java.util.*;
[ "de.iritgo.aktera", "java.util" ]
de.iritgo.aktera; java.util;
807,722
@JsonProperty("dst_port") public void setDstPort(Integer dstPort) { this.dstPort = dstPort; }
@JsonProperty(STR) void function(Integer dstPort) { this.dstPort = dstPort; }
/** * Sets the dst port. * * @param dstPort the new dst port */
Sets the dst port
setDstPort
{ "repo_name": "carmine/open-kilda", "path": "services/src/openkilda-gui/src/main/java/org/openkilda/integration/model/response/FlowPathInfoData.java", "license": "apache-2.0", "size": 9322 }
[ "com.fasterxml.jackson.annotation.JsonProperty" ]
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.*;
[ "com.fasterxml.jackson" ]
com.fasterxml.jackson;
1,493,993
@UiHandler("resultLimitInput") void handleResultLimitChange(final ChangeEvent event) { getDelegate().resultLimitChanged(this.resultLimitInput.getValue()); }
@UiHandler(STR) void handleResultLimitChange(final ChangeEvent event) { getDelegate().resultLimitChanged(this.resultLimitInput.getValue()); }
/** * Change handler on the result limit input. * * @param event the change event */
Change handler on the result limit input
handleResultLimitChange
{ "repo_name": "sunix/che-plugins", "path": "plugin-datasource/che-plugin-datasource-ext-client/src/main/java/org/eclipse/che/ide/ext/datasource/client/sqllauncher/SqlRequestLauncherViewImpl.java", "license": "epl-1.0", "size": 10659 }
[ "com.google.gwt.event.dom.client.ChangeEvent", "com.google.gwt.uibinder.client.UiHandler" ]
import com.google.gwt.event.dom.client.ChangeEvent; import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.event.dom.client.*; import com.google.gwt.uibinder.client.*;
[ "com.google.gwt" ]
com.google.gwt;
1,565,103
@Test public void renameOnAmazonClientException() throws IOException { Mockito.when(mClient.listObjectsV2(Matchers.any(ListObjectsV2Request.class))) .thenThrow(AmazonClientException.class); boolean result = mS3UnderFileSystem.renameFile(SRC, DST); Assert.assertFalse(result); }
void function() throws IOException { Mockito.when(mClient.listObjectsV2(Matchers.any(ListObjectsV2Request.class))) .thenThrow(AmazonClientException.class); boolean result = mS3UnderFileSystem.renameFile(SRC, DST); Assert.assertFalse(result); }
/** * Test case for {@link S3AUnderFileSystem#renameFile(String, String)}. */
Test case for <code>S3AUnderFileSystem#renameFile(String, String)</code>
renameOnAmazonClientException
{ "repo_name": "Reidddddd/mo-alluxio", "path": "underfs/s3a/src/test/java/alluxio/underfs/s3a/S3AUnderFileSystemTest.java", "license": "apache-2.0", "size": 3414 }
[ "com.amazonaws.AmazonClientException", "com.amazonaws.services.s3.model.ListObjectsV2Request", "java.io.IOException", "org.junit.Assert", "org.mockito.Matchers", "org.mockito.Mockito" ]
import com.amazonaws.AmazonClientException; import com.amazonaws.services.s3.model.ListObjectsV2Request; import java.io.IOException; import org.junit.Assert; import org.mockito.Matchers; import org.mockito.Mockito;
import com.amazonaws.*; import com.amazonaws.services.s3.model.*; import java.io.*; import org.junit.*; import org.mockito.*;
[ "com.amazonaws", "com.amazonaws.services", "java.io", "org.junit", "org.mockito" ]
com.amazonaws; com.amazonaws.services; java.io; org.junit; org.mockito;
1,083,013
public static boolean hasAnyAccount(Context context) { if (getAllAccounts(context).size() > 0) return true; return false; }
static boolean function(Context context) { if (getAllAccounts(context).size() > 0) return true; return false; }
/** * Check for any account availability * * @param context * @return true, if any account found */
Check for any account availability
hasAnyAccount
{ "repo_name": "js-superion/framework-master", "path": "app/src/main/java/com/odoo/core/auth/OdooAccountManager.java", "license": "agpl-3.0", "size": 8310 }
[ "android.content.Context" ]
import android.content.Context;
import android.content.*;
[ "android.content" ]
android.content;
2,005,928
public void useTextColorFromTheme(Context context) { if (context instanceof ContextThemeWrapper) { TypedArray array = ((ContextThemeWrapper) context).getTheme().obtainStyledAttributes(new int[] {android.R.attr.textColorPrimary}); int color = array.getColor(0, getVerticalLabelsColor()); array.recycle(); setVerticalLabelsColor(color); setHorizontalLabelsColor(color); } } public enum GridStyle { BOTH, VERTICAL, HORIZONTAL }
void function(Context context) { if (context instanceof ContextThemeWrapper) { TypedArray array = ((ContextThemeWrapper) context).getTheme().obtainStyledAttributes(new int[] {android.R.attr.textColorPrimary}); int color = array.getColor(0, getVerticalLabelsColor()); array.recycle(); setVerticalLabelsColor(color); setHorizontalLabelsColor(color); } } public enum GridStyle { BOTH, VERTICAL, HORIZONTAL }
/** * tries to get the theme's font color and use it for labels * @param context must be instance of ContextThemeWrapper */
tries to get the theme's font color and use it for labels
useTextColorFromTheme
{ "repo_name": "nma83/SDCardTrac", "path": "GraphView/src/main/java/com/jjoe64/graphview/GraphViewStyle.java", "license": "gpl-3.0", "size": 4949 }
[ "android.content.Context", "android.content.res.TypedArray", "android.view.ContextThemeWrapper" ]
import android.content.Context; import android.content.res.TypedArray; import android.view.ContextThemeWrapper;
import android.content.*; import android.content.res.*; import android.view.*;
[ "android.content", "android.view" ]
android.content; android.view;
63,226
private DocumentBuilder createDocumentBuilder(DocumentBuilderFactory factory) throws ParserConfigurationException { DocumentBuilder docBuilder = factory.newDocumentBuilder(); docBuilder.setErrorHandler(new DozerDefaultHandler()); docBuilder.setEntityResolver(new DozerResolver(beanContainer)); return docBuilder; } private static class DozerDefaultHandler extends DefaultHandler { private final Logger log = LoggerFactory.getLogger(DozerDefaultHandler.class);
DocumentBuilder function(DocumentBuilderFactory factory) throws ParserConfigurationException { DocumentBuilder docBuilder = factory.newDocumentBuilder(); docBuilder.setErrorHandler(new DozerDefaultHandler()); docBuilder.setEntityResolver(new DozerResolver(beanContainer)); return docBuilder; } private static class DozerDefaultHandler extends DefaultHandler { private final Logger log = LoggerFactory.getLogger(DozerDefaultHandler.class);
/** * Create a JAXP DocumentBuilder that this bean definition reader will use for parsing XML documents. Can be * overridden in subclasses, adding further initialization of the builder. * * @param factory the JAXP DocumentBuilderFactory that the DocumentBuilder should be created with * @return the JAXP DocumentBuilder * @throws javax.xml.parsers.ParserConfigurationException if thrown by JAXP methods */
Create a JAXP DocumentBuilder that this bean definition reader will use for parsing XML documents. Can be overridden in subclasses, adding further initialization of the builder
createDocumentBuilder
{ "repo_name": "orange-buffalo/dozer", "path": "core/src/main/java/com/github/dozermapper/core/loader/xml/XMLParserFactory.java", "license": "apache-2.0", "size": 4691 }
[ "javax.xml.parsers.DocumentBuilder", "javax.xml.parsers.DocumentBuilderFactory", "javax.xml.parsers.ParserConfigurationException", "org.slf4j.Logger", "org.slf4j.LoggerFactory", "org.xml.sax.helpers.DefaultHandler" ]
import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.xml.sax.helpers.DefaultHandler;
import javax.xml.parsers.*; import org.slf4j.*; import org.xml.sax.helpers.*;
[ "javax.xml", "org.slf4j", "org.xml.sax" ]
javax.xml; org.slf4j; org.xml.sax;
1,043,006
@Nonnull public java.util.concurrent.CompletableFuture<BookingCustomer> putAsync(@Nonnull final BookingCustomer newBookingCustomer) { return sendAsync(HttpMethod.PUT, newBookingCustomer); }
java.util.concurrent.CompletableFuture<BookingCustomer> function(@Nonnull final BookingCustomer newBookingCustomer) { return sendAsync(HttpMethod.PUT, newBookingCustomer); }
/** * Creates a BookingCustomer with a new object * * @param newBookingCustomer the object to create/update * @return a future with the result */
Creates a BookingCustomer with a new object
putAsync
{ "repo_name": "microsoftgraph/msgraph-sdk-java", "path": "src/main/java/com/microsoft/graph/requests/BookingCustomerRequest.java", "license": "mit", "size": 5937 }
[ "com.microsoft.graph.http.HttpMethod", "com.microsoft.graph.models.BookingCustomer", "javax.annotation.Nonnull" ]
import com.microsoft.graph.http.HttpMethod; import com.microsoft.graph.models.BookingCustomer; import javax.annotation.Nonnull;
import com.microsoft.graph.http.*; import com.microsoft.graph.models.*; import javax.annotation.*;
[ "com.microsoft.graph", "javax.annotation" ]
com.microsoft.graph; javax.annotation;
1,123,537
protected void removeLinkFromStorage(Link lt) { String id = getLinkId(lt); storageSourceService.deleteRowAsync(LINK_TABLE_NAME, id); }
void function(Link lt) { String id = getLinkId(lt); storageSourceService.deleteRowAsync(LINK_TABLE_NAME, id); }
/** * Removes a link from storage using an asynchronous call. * * @param lt * The LinkTuple to delete. */
Removes a link from storage using an asynchronous call
removeLinkFromStorage
{ "repo_name": "cbarrin/EAGERFloodlight", "path": "src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManager.java", "license": "apache-2.0", "size": 73310 }
[ "net.floodlightcontroller.linkdiscovery.Link" ]
import net.floodlightcontroller.linkdiscovery.Link;
import net.floodlightcontroller.linkdiscovery.*;
[ "net.floodlightcontroller.linkdiscovery" ]
net.floodlightcontroller.linkdiscovery;
1,480,920
@Nullable public UpdateRecordingStatusOperation post(@Nonnull final UpdateRecordingStatusOperation newUpdateRecordingStatusOperation) throws ClientException { return send(HttpMethod.POST, newUpdateRecordingStatusOperation); }
UpdateRecordingStatusOperation function(@Nonnull final UpdateRecordingStatusOperation newUpdateRecordingStatusOperation) throws ClientException { return send(HttpMethod.POST, newUpdateRecordingStatusOperation); }
/** * Creates a UpdateRecordingStatusOperation with a new object * * @param newUpdateRecordingStatusOperation the new object to create * @return the created UpdateRecordingStatusOperation * @throws ClientException this exception occurs if the request was unable to complete for any reason */
Creates a UpdateRecordingStatusOperation with a new object
post
{ "repo_name": "microsoftgraph/msgraph-sdk-java", "path": "src/main/java/com/microsoft/graph/requests/UpdateRecordingStatusOperationRequest.java", "license": "mit", "size": 6764 }
[ "com.microsoft.graph.core.ClientException", "com.microsoft.graph.http.HttpMethod", "com.microsoft.graph.models.UpdateRecordingStatusOperation", "javax.annotation.Nonnull" ]
import com.microsoft.graph.core.ClientException; import com.microsoft.graph.http.HttpMethod; import com.microsoft.graph.models.UpdateRecordingStatusOperation; import javax.annotation.Nonnull;
import com.microsoft.graph.core.*; import com.microsoft.graph.http.*; import com.microsoft.graph.models.*; import javax.annotation.*;
[ "com.microsoft.graph", "javax.annotation" ]
com.microsoft.graph; javax.annotation;
1,809,929
MatcherAssert.assertThat( new PsByFlag( new PsByFlag.Pair( "some-key", new PsFake(true) ) ).enter(new RqFake("GET", "/?PsByFlag=x")).hasNext(), Matchers.is(false) ); }
MatcherAssert.assertThat( new PsByFlag( new PsByFlag.Pair( STR, new PsFake(true) ) ).enter(new RqFake("GET", STR)).hasNext(), Matchers.is(false) ); }
/** * PsByFlag can skip if nothing found. * @throws IOException If some problem inside */
PsByFlag can skip if nothing found
skipsIfNothingFound
{ "repo_name": "ekondrashev/takes", "path": "src/test/java/org/takes/facets/auth/PsByFlagTest.java", "license": "mit", "size": 1939 }
[ "org.hamcrest.MatcherAssert", "org.hamcrest.Matchers", "org.takes.rq.RqFake" ]
import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; import org.takes.rq.RqFake;
import org.hamcrest.*; import org.takes.rq.*;
[ "org.hamcrest", "org.takes.rq" ]
org.hamcrest; org.takes.rq;
352,827
protected void addNamePropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_BranchInfo_name_feature"), getString("_UI_PropertyDescriptor_description", "_UI_BranchInfo_name_feature", "_UI_BranchInfo_type"), VersioningPackage.Literals.BRANCH_INFO__NAME, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); }
void function(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString(STR), getString(STR, STR, STR), VersioningPackage.Literals.BRANCH_INFO__NAME, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); }
/** * This adds a property descriptor for the Name feature. * <!-- begin-user-doc * --> <!-- end-user-doc --> * * @generated */
This adds a property descriptor for the Name feature.
addNamePropertyDescriptor
{ "repo_name": "edgarmueller/emfstore-rest", "path": "bundles/org.eclipse.emf.emfstore.server.model.edit/src/org/eclipse/emf/emfstore/internal/server/model/versioning/provider/BranchInfoItemProvider.java", "license": "epl-1.0", "size": 7812 }
[ "org.eclipse.emf.edit.provider.ComposeableAdapterFactory", "org.eclipse.emf.edit.provider.ItemPropertyDescriptor", "org.eclipse.emf.emfstore.internal.server.model.versioning.VersioningPackage" ]
import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; import org.eclipse.emf.emfstore.internal.server.model.versioning.VersioningPackage;
import org.eclipse.emf.edit.provider.*; import org.eclipse.emf.emfstore.internal.server.model.versioning.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
712,906
protected void init() { status = STATUS_OK; frameCount = 0; framePointer = -1; frames = new ArrayList<GifFrame>(); gct = null; }
void function() { status = STATUS_OK; frameCount = 0; framePointer = -1; frames = new ArrayList<GifFrame>(); gct = null; }
/** * Initializes or re-initializes reader */
Initializes or re-initializes reader
init
{ "repo_name": "yuvraaz/soul-sex", "path": "library/src/main/java/com/felipecsl/gifimageview/library/GifDecoder.java", "license": "mit", "size": 23405 }
[ "java.util.ArrayList" ]
import java.util.ArrayList;
import java.util.*;
[ "java.util" ]
java.util;
1,360,279
protected FxMatrixMarketDataBuilder fxMatrixBuilder() { return new FxMatrixMarketDataBuilder(); }
FxMatrixMarketDataBuilder function() { return new FxMatrixMarketDataBuilder(); }
/** * Creates a builder that provides FX matrices. * * @return a builder that provides FX matrices. */
Creates a builder that provides FX matrices
fxMatrixBuilder
{ "repo_name": "nssales/OG-Platform", "path": "sesame/sesame-component/src/main/java/com/opengamma/sesame/component/MarketDataEnvironmentComponentFactory.java", "license": "apache-2.0", "size": 25940 }
[ "com.opengamma.sesame.marketdata.FxMatrixMarketDataBuilder" ]
import com.opengamma.sesame.marketdata.FxMatrixMarketDataBuilder;
import com.opengamma.sesame.marketdata.*;
[ "com.opengamma.sesame" ]
com.opengamma.sesame;
620,036
public final void loadConfig() { config.load(); BackEndType bet = config.getBackEndType(); if (bet == BackEndType.YAML) { backEnd = new YAMLBackEnd(); } else if (bet == BackEndType.MySQL) { backEnd = new MySQLBackEnd(); } else if (bet == BackEndType.MySQL2) { backEnd = new MySQL2BackEnd(); } UUIDPlayerDBType updbt = config.getUUIDPlayerDBType(); if (updbt == UUIDPlayerDBType.None) { UUIDPlayerDB = new NoneUUIDPlayerDB(); } else if (updbt == UUIDPlayerDBType.YAML) { UUIDPlayerDB = new YAMLUUIDPlayerDB(); } else if (updbt == UUIDPlayerDBType.MySQL) { UUIDPlayerDB = new MySQLUUIDPlayerDB(); } }
final void function() { config.load(); BackEndType bet = config.getBackEndType(); if (bet == BackEndType.YAML) { backEnd = new YAMLBackEnd(); } else if (bet == BackEndType.MySQL) { backEnd = new MySQLBackEnd(); } else if (bet == BackEndType.MySQL2) { backEnd = new MySQL2BackEnd(); } UUIDPlayerDBType updbt = config.getUUIDPlayerDBType(); if (updbt == UUIDPlayerDBType.None) { UUIDPlayerDB = new NoneUUIDPlayerDB(); } else if (updbt == UUIDPlayerDBType.YAML) { UUIDPlayerDB = new YAMLUUIDPlayerDB(); } else if (updbt == UUIDPlayerDBType.MySQL) { UUIDPlayerDB = new MySQLUUIDPlayerDB(); } }
/** * Loads the configuration of the plugin from the config.yml file. */
Loads the configuration of the plugin from the config.yml file
loadConfig
{ "repo_name": "jimmikaelkael/BungeePerms", "path": "src/main/java/net/alpenblock/bungeeperms/PermissionsManager.java", "license": "mit", "size": 48824 }
[ "net.alpenblock.bungeeperms.io.BackEndType", "net.alpenblock.bungeeperms.io.MySQL2BackEnd", "net.alpenblock.bungeeperms.io.MySQLBackEnd", "net.alpenblock.bungeeperms.io.MySQLUUIDPlayerDB", "net.alpenblock.bungeeperms.io.NoneUUIDPlayerDB", "net.alpenblock.bungeeperms.io.UUIDPlayerDB", "net.alpenblock.bungeeperms.io.UUIDPlayerDBType", "net.alpenblock.bungeeperms.io.YAMLBackEnd", "net.alpenblock.bungeeperms.io.YAMLUUIDPlayerDB" ]
import net.alpenblock.bungeeperms.io.BackEndType; import net.alpenblock.bungeeperms.io.MySQL2BackEnd; import net.alpenblock.bungeeperms.io.MySQLBackEnd; import net.alpenblock.bungeeperms.io.MySQLUUIDPlayerDB; import net.alpenblock.bungeeperms.io.NoneUUIDPlayerDB; import net.alpenblock.bungeeperms.io.UUIDPlayerDB; import net.alpenblock.bungeeperms.io.UUIDPlayerDBType; import net.alpenblock.bungeeperms.io.YAMLBackEnd; import net.alpenblock.bungeeperms.io.YAMLUUIDPlayerDB;
import net.alpenblock.bungeeperms.io.*;
[ "net.alpenblock.bungeeperms" ]
net.alpenblock.bungeeperms;
458,432
@Test public void testGrantPermissionsToRole() { Collection<Permission> perms; final MapDbAuthorizingRealm realm = new MapDbAuthorizingRealm( realmDbDir); realm.init(); realm.addRole("role", new String[] { "perm1", "perm2", "perm3" }); perms = realm.getRolePermissionResolver().resolvePermissionsInRole( "role"); assertEquals(3, perms.size()); assertTrue(realm.isPermitted("role", "perm1")); assertTrue(realm.isPermitted("role", "perm2")); assertTrue(realm.isPermitted("role", "perm3")); // grant the same permissions again realm.grantPermissionsToRole("role", new String[] { "perm1", "perm2", "perm3" }); perms = realm.getRolePermissionResolver().resolvePermissionsInRole( "role"); assertEquals(3, perms.size()); assertTrue(realm.isPermitted("role", "perm1")); assertTrue(realm.isPermitted("role", "perm2")); assertTrue(realm.isPermitted("role", "perm3")); // grant new once realm.grantPermissionsToRole("role", new String[] { "perm4", "perm2", "perm3" }); perms = realm.getRolePermissionResolver().resolvePermissionsInRole( "role"); assertEquals(4, perms.size()); assertTrue(realm.isPermitted("role", "perm1")); assertTrue(realm.isPermitted("role", "perm2")); assertTrue(realm.isPermitted("role", "perm3")); assertTrue(realm.isPermitted("role", "perm4")); // cleanUp realm.release(); }
void function() { Collection<Permission> perms; final MapDbAuthorizingRealm realm = new MapDbAuthorizingRealm( realmDbDir); realm.init(); realm.addRole("role", new String[] { "perm1", "perm2", "perm3" }); perms = realm.getRolePermissionResolver().resolvePermissionsInRole( "role"); assertEquals(3, perms.size()); assertTrue(realm.isPermitted("role", "perm1")); assertTrue(realm.isPermitted("role", "perm2")); assertTrue(realm.isPermitted("role", "perm3")); realm.grantPermissionsToRole("role", new String[] { "perm1", "perm2", "perm3" }); perms = realm.getRolePermissionResolver().resolvePermissionsInRole( "role"); assertEquals(3, perms.size()); assertTrue(realm.isPermitted("role", "perm1")); assertTrue(realm.isPermitted("role", "perm2")); assertTrue(realm.isPermitted("role", "perm3")); realm.grantPermissionsToRole("role", new String[] { "perm4", "perm2", "perm3" }); perms = realm.getRolePermissionResolver().resolvePermissionsInRole( "role"); assertEquals(4, perms.size()); assertTrue(realm.isPermitted("role", "perm1")); assertTrue(realm.isPermitted("role", "perm2")); assertTrue(realm.isPermitted("role", "perm3")); assertTrue(realm.isPermitted("role", "perm4")); realm.release(); }
/** * Tests the implementation of * {@link MapDbAuthorizingRealm#grantPermissionsToRole(String, String[])}. */
Tests the implementation of <code>MapDbAuthorizingRealm#grantPermissionsToRole(String, String[])</code>
testGrantPermissionsToRole
{ "repo_name": "pmeisen/dis-timeintervaldataanalyzer", "path": "test/net/meisen/dissertation/impl/auth/shiro/TestMapDbAuthorizingRealm.java", "license": "bsd-3-clause", "size": 26800 }
[ "java.util.Collection", "org.apache.shiro.authz.Permission", "org.junit.Assert" ]
import java.util.Collection; import org.apache.shiro.authz.Permission; import org.junit.Assert;
import java.util.*; import org.apache.shiro.authz.*; import org.junit.*;
[ "java.util", "org.apache.shiro", "org.junit" ]
java.util; org.apache.shiro; org.junit;
2,172,349
int colorMain = TextRenderer.RED; int colorSub = TextRenderer.GREEN; if (videoMessage.seen) { colorMain = TextRenderer.GRAY; colorSub = TextRenderer.GRAY; } commons.text().paintTo(g2, x0 + 2, y0 + 2, 10, colorMain, get(videoMessage.title)); commons.text().paintTo(g2, x0 + 2, y0 + 16, 7, colorSub, get(this.videoMessage.description)); } }
int colorMain = TextRenderer.RED; int colorSub = TextRenderer.GREEN; if (videoMessage.seen) { colorMain = TextRenderer.GRAY; colorSub = TextRenderer.GRAY; } commons.text().paintTo(g2, x0 + 2, y0 + 2, 10, colorMain, get(videoMessage.title)); commons.text().paintTo(g2, x0 + 2, y0 + 16, 7, colorSub, get(this.videoMessage.description)); } }
/** * Draw this entry. * @param g2 the graphics context * @param x0 the base X * @param y0 the base Y */
Draw this entry
draw
{ "repo_name": "akarnokd/open-ig", "path": "src/hu/openig/screen/items/BridgeScreen.java", "license": "lgpl-3.0", "size": 42213 }
[ "hu.openig.render.TextRenderer" ]
import hu.openig.render.TextRenderer;
import hu.openig.render.*;
[ "hu.openig.render" ]
hu.openig.render;
159,832
@Generated @Selector("depthWeight") public native float depthWeight();
@Selector(STR) native float function();
/** * Controls how samples' depths are compared during reprojection, variance estimation, and * bilateral filtering. The final weight is given by exp(-abs(Z1 - Z2) / depthWeight). Must be * greater than zero. Defaults to 1.0. */
Controls how samples' depths are compared during reprojection, variance estimation, and bilateral filtering. The final weight is given by exp(-abs(Z1 - Z2) / depthWeight). Must be greater than zero. Defaults to 1.0
depthWeight
{ "repo_name": "multi-os-engine/moe-core", "path": "moe.apple/moe.platform.ios/src/main/java/apple/metalperformanceshaders/MPSSVGF.java", "license": "apache-2.0", "size": 51099 }
[ "org.moe.natj.objc.ann.Selector" ]
import org.moe.natj.objc.ann.Selector;
import org.moe.natj.objc.ann.*;
[ "org.moe.natj" ]
org.moe.natj;
2,364,507
@Override public void enterFormalParameter(@NotNull PJParser.FormalParameterContext ctx) { }
@Override public void enterFormalParameter(@NotNull PJParser.FormalParameterContext ctx) { }
/** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */
The default implementation does nothing
exitResources
{ "repo_name": "Diolor/PJ", "path": "src/main/java/com/lorentzos/pj/PJBaseListener.java", "license": "mit", "size": 73292 }
[ "org.antlr.v4.runtime.misc.NotNull" ]
import org.antlr.v4.runtime.misc.NotNull;
import org.antlr.v4.runtime.misc.*;
[ "org.antlr.v4" ]
org.antlr.v4;
782,470
private Collection<City> uniqueCities(City[] cityList) { final Set<City> unique = new HashSet<City>(); for (City c : cityList) { unique.add(c); } return unique; }
Collection<City> function(City[] cityList) { final Set<City> unique = new HashSet<City>(); for (City c : cityList) { unique.add(c); } return unique; }
/** * Compute the distance covered by the salesman, including * the trip back (from the last to first city). * * @param cityList List of cities visited during the travel. * @return the total distance. */
Compute the distance covered by the salesman, including the trip back (from the last to first city)
uniqueCities
{ "repo_name": "tknandu/CommonsMath_Modifed", "path": "math (trunk)/src/test/java/org/apache/commons/math3/ml/neuralnet/sofm/KohonenTrainingTaskTest.java", "license": "apache-2.0", "size": 7826 }
[ "java.util.Collection", "java.util.HashSet", "java.util.Set" ]
import java.util.Collection; import java.util.HashSet; import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
1,265,385
@Override public void exitQualifiedNameList(@NotNull JavaParser.QualifiedNameListContext ctx) { }
@Override public void exitQualifiedNameList(@NotNull JavaParser.QualifiedNameListContext ctx) { }
/** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */
The default implementation does nothing
enterQualifiedNameList
{ "repo_name": "martinaguero/deep", "path": "src/org/trimatek/deep/lexer/JavaBaseListener.java", "license": "apache-2.0", "size": 39286 }
[ "org.antlr.v4.runtime.misc.NotNull" ]
import org.antlr.v4.runtime.misc.NotNull;
import org.antlr.v4.runtime.misc.*;
[ "org.antlr.v4" ]
org.antlr.v4;
1,030,589
public final String replacePlayerVars(String string, Player player) { string = string.replaceAll("%p", player.getName()); string = string.replaceAll("%player", player.getName()); string = string.replaceAll("@p", player.getName()); string = string.replaceAll("@player", player.getName()); string = string.replaceAll("&p", player.getName()); string = string.replaceAll("&player", player.getName()); return string; } private List<String> extraHelp;
final String function(String string, Player player) { string = string.replaceAll("%p", player.getName()); string = string.replaceAll(STR, player.getName()); string = string.replaceAll("@p", player.getName()); string = string.replaceAll(STR, player.getName()); string = string.replaceAll("&p", player.getName()); string = string.replaceAll(STR, player.getName()); return string; } private List<String> extraHelp;
/** * Replaces variables for player names * * @param string Base string to format * @param player {@link Player} to replace vars for */
Replaces variables for player names
replacePlayerVars
{ "repo_name": "dmulloy2/TeamSparkle", "path": "src/main/java/net/dmulloy2/teamsparkle/TeamSparkle.java", "license": "gpl-3.0", "size": 10088 }
[ "java.util.List", "org.bukkit.entity.Player" ]
import java.util.List; import org.bukkit.entity.Player;
import java.util.*; import org.bukkit.entity.*;
[ "java.util", "org.bukkit.entity" ]
java.util; org.bukkit.entity;
1,597,278
public JTextField getCampoOidoIzquierdo() { if (campoOidoIzquierdo == null) { campoOidoIzquierdo = new JTextField(); campoOidoIzquierdo.setMinimumSize(new Dimension(500, 20)); campoOidoIzquierdo.setPreferredSize(new Dimension(500, 20)); } return campoOidoIzquierdo; }
JTextField function() { if (campoOidoIzquierdo == null) { campoOidoIzquierdo = new JTextField(); campoOidoIzquierdo.setMinimumSize(new Dimension(500, 20)); campoOidoIzquierdo.setPreferredSize(new Dimension(500, 20)); } return campoOidoIzquierdo; }
/** * This method initializes campoOidoIzquierdo * * @return javax.swing.JTextField */
This method initializes campoOidoIzquierdo
getCampoOidoIzquierdo
{ "repo_name": "lucianait10/BasicVet", "path": "source_basicvet/cuGestionarFichaClinica/PanelPiel.java", "license": "gpl-3.0", "size": 16608 }
[ "java.awt.Dimension", "javax.swing.JTextField" ]
import java.awt.Dimension; import javax.swing.JTextField;
import java.awt.*; import javax.swing.*;
[ "java.awt", "javax.swing" ]
java.awt; javax.swing;
152,638
EList<Connector> getConnectors();
EList<Connector> getConnectors();
/** * Returns the value of the '<em><b>Connectors</b></em>' containment reference list. * The list contents are of type {@link de.cooperateproject.modeling.textual.cls.cls.Connector}. * It is bidirectional and its opposite is '{@link de.cooperateproject.modeling.textual.cls.cls.Connector#getOwningPackage <em>Owning Package</em>}'. * <!-- begin-user-doc --> * <p> * If the meaning of the '<em>Connectors</em>' containment reference list isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @return the value of the '<em>Connectors</em>' containment reference list. * @see de.cooperateproject.modeling.textual.cls.cls.ClsPackage#getPackage_Connectors() * @see de.cooperateproject.modeling.textual.cls.cls.Connector#getOwningPackage * @model opposite="owningPackage" containment="true" * @generated */
Returns the value of the 'Connectors' containment reference list. The list contents are of type <code>de.cooperateproject.modeling.textual.cls.cls.Connector</code>. It is bidirectional and its opposite is '<code>de.cooperateproject.modeling.textual.cls.cls.Connector#getOwningPackage Owning Package</code>'. If the meaning of the 'Connectors' containment reference list isn't clear, there really should be more of a description here...
getConnectors
{ "repo_name": "Cooperate-Project/Cooperate", "path": "bundles/de.cooperateproject.modeling.textual.cls.metamodel/src-gen/de/cooperateproject/modeling/textual/cls/cls/Package.java", "license": "epl-1.0", "size": 3088 }
[ "org.eclipse.emf.common.util.EList" ]
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
627,341
public static final Uri getContentUriByProvider(long providerId) { Uri.Builder builder = CONTENT_URI_MESSAGES_BY_PROVIDER.buildUpon(); ContentUris.appendId(builder, providerId); return builder.build(); }
static final Uri function(long providerId) { Uri.Builder builder = CONTENT_URI_MESSAGES_BY_PROVIDER.buildUpon(); ContentUris.appendId(builder, providerId); return builder.build(); }
/** * Gets the Uri to query messages by provider. * * @param providerId the service provider id. * @return the Uri */
Gets the Uri to query messages by provider
getContentUriByProvider
{ "repo_name": "joechen2010/Gibberbot", "path": "src/info/guardianproject/otr/app/im/provider/Imps.java", "license": "apache-2.0", "size": 92941 }
[ "android.content.ContentUris", "android.net.Uri" ]
import android.content.ContentUris; import android.net.Uri;
import android.content.*; import android.net.*;
[ "android.content", "android.net" ]
android.content; android.net;
2,783,449
public void setInitialFile(File initialFile);
void function(File initialFile);
/** * Set an initial value for the file element. Optional. Use this to preload * your file element with a previously submitted file. * * @param initialFile */
Set an initial value for the file element. Optional. Use this to preload your file element with a previously submitted file
setInitialFile
{ "repo_name": "stevenhva/InfoLearn_OpenOLAT", "path": "src/main/java/org/olat/core/gui/components/form/flexible/elements/FileElement.java", "license": "apache-2.0", "size": 5430 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
1,927,476
public static MozuClient<com.mozu.api.contracts.productruntime.Category> getCategoryClient(Integer categoryId, Boolean allowInactive, String responseFields) throws Exception { MozuUrl url = com.mozu.api.urls.commerce.catalog.storefront.CategoryUrl.getCategoryUrl(allowInactive, categoryId, responseFields); String verb = "GET"; Class<?> clz = com.mozu.api.contracts.productruntime.Category.class; MozuClient<com.mozu.api.contracts.productruntime.Category> mozuClient = (MozuClient<com.mozu.api.contracts.productruntime.Category>) MozuClientFactory.getInstance(clz); mozuClient.setVerb(verb); mozuClient.setResourceUrl(url); return mozuClient; }
static MozuClient<com.mozu.api.contracts.productruntime.Category> function(Integer categoryId, Boolean allowInactive, String responseFields) throws Exception { MozuUrl url = com.mozu.api.urls.commerce.catalog.storefront.CategoryUrl.getCategoryUrl(allowInactive, categoryId, responseFields); String verb = "GET"; Class<?> clz = com.mozu.api.contracts.productruntime.Category.class; MozuClient<com.mozu.api.contracts.productruntime.Category> mozuClient = (MozuClient<com.mozu.api.contracts.productruntime.Category>) MozuClientFactory.getInstance(clz); mozuClient.setVerb(verb); mozuClient.setResourceUrl(url); return mozuClient; }
/** * Retrieves the details of a single category. * <p><pre><code> * MozuClient<com.mozu.api.contracts.productruntime.Category> mozuClient=GetCategoryClient( categoryId, allowInactive, responseFields); * client.setBaseAddress(url); * client.executeRequest(); * Category category = client.Result(); * </code></pre></p> * @param allowInactive If true, allow inactive categories to be retrieved in the category list response. If false, the categories retrieved will not include ones marked inactive. * @param categoryId Unique identifier for the storefront container used to organize products. * @param responseFields A list or array of fields returned for a call. These fields may be customized and may be used for various types of data calls in Mozu. For example, responseFields are returned for retrieving or updating attributes, carts, and messages in Mozu. * @return Mozu.Api.MozuClient <com.mozu.api.contracts.productruntime.Category> * @see com.mozu.api.contracts.productruntime.Category */
Retrieves the details of a single category. <code><code> MozuClient mozuClient=GetCategoryClient( categoryId, allowInactive, responseFields); client.setBaseAddress(url); client.executeRequest(); Category category = client.Result(); </code></code>
getCategoryClient
{ "repo_name": "sanjaymandadi/mozu-java", "path": "mozu-javaasync-core/src/main/java/com/mozu/api/clients/commerce/catalog/storefront/CategoryClient.java", "license": "mit", "size": 8411 }
[ "com.mozu.api.MozuClient", "com.mozu.api.MozuClientFactory", "com.mozu.api.MozuUrl" ]
import com.mozu.api.MozuClient; import com.mozu.api.MozuClientFactory; import com.mozu.api.MozuUrl;
import com.mozu.api.*;
[ "com.mozu.api" ]
com.mozu.api;
2,202,618
private void reload() throws IOException { if (styleFile != null) { this.styleFileModificationTime = styleFile.lastModified(); try (InputStream stream = new FileInputStream(styleFile)) { initialize(stream); } } }
void function() throws IOException { if (styleFile != null) { this.styleFileModificationTime = styleFile.lastModified(); try (InputStream stream = new FileInputStream(styleFile)) { initialize(stream); } } }
/** * If this style was initialized from a file on disk, reload the style * information. * * @throws IOException */
If this style was initialized from a file on disk, reload the style information
reload
{ "repo_name": "tobiasdiez/jabref", "path": "src/main/java/org/jabref/logic/openoffice/OOBibStyle.java", "license": "mit", "size": 37749 }
[ "java.io.FileInputStream", "java.io.IOException", "java.io.InputStream" ]
import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream;
import java.io.*;
[ "java.io" ]
java.io;
172,480
@RestrictedApi(explanation = "Should only be called in tests", link = "", allowedOnPath = ".*(/src/test/.*|StochasticLoadBalancer).java") void updateMetricsSize(int size) { if (metricsBalancer instanceof MetricsStochasticBalancer) { ((MetricsStochasticBalancer) metricsBalancer).updateMetricsSize(size); } }
@RestrictedApi(explanation = STR, link = STR.*(/src/test/.* StochasticLoadBalancer).java") void updateMetricsSize(int size) { if (metricsBalancer instanceof MetricsStochasticBalancer) { ((MetricsStochasticBalancer) metricsBalancer).updateMetricsSize(size); } }
/** * Update the number of metrics that are reported to JMX */
Update the number of metrics that are reported to JMX
updateMetricsSize
{ "repo_name": "mahak/hbase", "path": "hbase-balancer/src/main/java/org/apache/hadoop/hbase/master/balancer/StochasticLoadBalancer.java", "license": "apache-2.0", "size": 32039 }
[ "com.google.errorprone.annotations.RestrictedApi" ]
import com.google.errorprone.annotations.RestrictedApi;
import com.google.errorprone.annotations.*;
[ "com.google.errorprone" ]
com.google.errorprone;
2,632,773
public Enumeration<K> keys() { return new KeyIterator(); }
Enumeration<K> function() { return new KeyIterator(); }
/** * Returns an enumeration of the keys in this table. * * @return an enumeration of the keys in this table * @see #keySet() */
Returns an enumeration of the keys in this table
keys
{ "repo_name": "xuse/ef-orm", "path": "common-core/src/main/java/jef/concurrent/ConcurrentIdentityHashMap.java", "license": "apache-2.0", "size": 44266 }
[ "java.util.Enumeration" ]
import java.util.Enumeration;
import java.util.*;
[ "java.util" ]
java.util;
1,612,452
public String newSessionId(HttpServletRequest request, long created) { synchronized (this) { if (request!=null) { // A requested session ID can only be used if it is in use already. String requested_id=request.getRequestedSessionId(); if (requested_id!=null) { String cluster_id=getClusterId(requested_id); if (idInUse(cluster_id)) return cluster_id; } // Else reuse any new session ID already defined for this request. String new_id=(String)request.getAttribute(__NEW_SESSION_ID); if (new_id!=null&&idInUse(new_id)) return new_id; } // pick a new unique ID! String id=null; while (id==null||id.length()==0||idInUse(id)) { long r0=_weakRandom ?(hashCode()^Runtime.getRuntime().freeMemory()^_random.nextInt()^(((long)request.hashCode())<<32)) :_random.nextLong(); if (r0<0) r0=-r0; long r1=_weakRandom ?(hashCode()^Runtime.getRuntime().freeMemory()^_random.nextInt()^(((long)request.hashCode())<<32)) :_random.nextLong(); if (r1<0) r1=-r1; id=Long.toString(r0,36)+Long.toString(r1,36); //add in the id of the node to ensure unique id across cluster //NOTE this is different to the node suffix which denotes which node the request was received on if (_workerName!=null) id=_workerName + id; } request.setAttribute(__NEW_SESSION_ID,id); return id; } }
String function(HttpServletRequest request, long created) { synchronized (this) { if (request!=null) { String requested_id=request.getRequestedSessionId(); if (requested_id!=null) { String cluster_id=getClusterId(requested_id); if (idInUse(cluster_id)) return cluster_id; } String new_id=(String)request.getAttribute(__NEW_SESSION_ID); if (new_id!=null&&idInUse(new_id)) return new_id; } String id=null; while (id==null id.length()==0 idInUse(id)) { long r0=_weakRandom ?(hashCode()^Runtime.getRuntime().freeMemory()^_random.nextInt()^(((long)request.hashCode())<<32)) :_random.nextLong(); if (r0<0) r0=-r0; long r1=_weakRandom ?(hashCode()^Runtime.getRuntime().freeMemory()^_random.nextInt()^(((long)request.hashCode())<<32)) :_random.nextLong(); if (r1<0) r1=-r1; id=Long.toString(r0,36)+Long.toString(r1,36); if (_workerName!=null) id=_workerName + id; } request.setAttribute(__NEW_SESSION_ID,id); return id; } }
/** * Create a new session id if necessary. * * @see org.eclipse.jetty.server.SessionIdManager#newSessionId(javax.servlet.http.HttpServletRequest, long) */
Create a new session id if necessary
newSessionId
{ "repo_name": "leoleegit/jetty-8.0.4.v20111024", "path": "jetty-server/src/main/java/org/eclipse/jetty/server/session/AbstractSessionIdManager.java", "license": "apache-2.0", "size": 6159 }
[ "javax.servlet.http.HttpServletRequest" ]
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.*;
[ "javax.servlet" ]
javax.servlet;
49,038
public void putDelete(CharSequence columnFamily, CharSequence columnQualifier, ColumnVisibility columnVisibility, long timestamp) { put(columnFamily, columnQualifier, columnVisibility.getExpression(), true, timestamp, true, EMPTY_BYTES); }
void function(CharSequence columnFamily, CharSequence columnQualifier, ColumnVisibility columnVisibility, long timestamp) { put(columnFamily, columnQualifier, columnVisibility.getExpression(), true, timestamp, true, EMPTY_BYTES); }
/** * Puts a deletion in this mutation. All appropriate parameters are * defensively copied. * * @param columnFamily column family * @param columnQualifier column qualifier * @param columnVisibility column visibility * @param timestamp timestamp */
Puts a deletion in this mutation. All appropriate parameters are defensively copied
putDelete
{ "repo_name": "joshelser/accumulo", "path": "core/src/main/java/org/apache/accumulo/core/data/Mutation.java", "license": "apache-2.0", "size": 30290 }
[ "org.apache.accumulo.core.security.ColumnVisibility" ]
import org.apache.accumulo.core.security.ColumnVisibility;
import org.apache.accumulo.core.security.*;
[ "org.apache.accumulo" ]
org.apache.accumulo;
1,390,945
private void verifyInsertAndSelect(PGTimestamp timestamp, boolean useSetObject) throws SQLException { // Construct the INSERT statement of a casted timestamp string. String sql; if (timestamp.getCalendar() != null) { sql = "INSERT INTO " + TEST_TABLE + " VALUES (?::timestamp with time zone, ?::timestamp with time zone)"; } else { sql = "INSERT INTO " + TEST_TABLE + " VALUES (?::timestamp, ?::timestamp)"; } SimpleDateFormat sdf = createSimpleDateFormat(timestamp); // Insert the timestamps as casted strings. PreparedStatement pstmt1 = con.prepareStatement(sql); pstmt1.setString(1, sdf.format(timestamp)); pstmt1.setString(2, sdf.format(timestamp)); assertEquals(1, pstmt1.executeUpdate()); // Insert the timestamps as PGTimestamp objects. PreparedStatement pstmt2 = con.prepareStatement("INSERT INTO " + TEST_TABLE + " VALUES (?, ?)"); if (useSetObject) { pstmt2.setObject(1, timestamp); pstmt2.setObject(2, timestamp); } else { pstmt2.setTimestamp(1, timestamp); pstmt2.setTimestamp(2, timestamp); } assertEquals(1, pstmt2.executeUpdate()); // Query the values back out. Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery(TestUtil.selectSQL(TEST_TABLE, "ts,tz")); assertNotNull(rs); // Read the casted string values. assertTrue(rs.next()); Timestamp ts1 = rs.getTimestamp(1); Timestamp tz1 = rs.getTimestamp(2); // System.out.println(pstmt1 + " -> " + ts1 + ", " + sdf.format(tz1)); // Read the PGTimestamp values. assertTrue(rs.next()); Timestamp ts2 = rs.getTimestamp(1); Timestamp tz2 = rs.getTimestamp(2); // System.out.println(pstmt2 + " -> " + ts2 + ", " + sdf.format(tz2)); // Verify that the first and second versions match. assertEquals(ts1, ts2); assertEquals(tz1, tz2); // Clean up. assertEquals(2, stmt.executeUpdate("DELETE FROM " + TEST_TABLE)); stmt.close(); pstmt2.close(); pstmt1.close(); }
void function(PGTimestamp timestamp, boolean useSetObject) throws SQLException { String sql; if (timestamp.getCalendar() != null) { sql = STR + TEST_TABLE + STR; } else { sql = STR + TEST_TABLE + STR; } SimpleDateFormat sdf = createSimpleDateFormat(timestamp); PreparedStatement pstmt1 = con.prepareStatement(sql); pstmt1.setString(1, sdf.format(timestamp)); pstmt1.setString(2, sdf.format(timestamp)); assertEquals(1, pstmt1.executeUpdate()); PreparedStatement pstmt2 = con.prepareStatement(STR + TEST_TABLE + STR); if (useSetObject) { pstmt2.setObject(1, timestamp); pstmt2.setObject(2, timestamp); } else { pstmt2.setTimestamp(1, timestamp); pstmt2.setTimestamp(2, timestamp); } assertEquals(1, pstmt2.executeUpdate()); Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery(TestUtil.selectSQL(TEST_TABLE, "ts,tz")); assertNotNull(rs); assertTrue(rs.next()); Timestamp ts1 = rs.getTimestamp(1); Timestamp tz1 = rs.getTimestamp(2); assertTrue(rs.next()); Timestamp ts2 = rs.getTimestamp(1); Timestamp tz2 = rs.getTimestamp(2); assertEquals(ts1, ts2); assertEquals(tz1, tz2); assertEquals(2, stmt.executeUpdate(STR + TEST_TABLE)); stmt.close(); pstmt2.close(); pstmt1.close(); }
/** * Verifies that inserting the given <code>PGTimestamp</code> as a timestamp * string and an object produces the same results. * * @param timestamp * the timestamp to test. * @param useSetObject * <code>true</code> if the setObject method should be used instead * of setTimestamp. * @throws SQLException * if a JDBC or database problem occurs. */
Verifies that inserting the given <code>PGTimestamp</code> as a timestamp string and an object produces the same results
verifyInsertAndSelect
{ "repo_name": "bocap/pgjdbc", "path": "org/postgresql/test/jdbc2/PGTimestampTest.java", "license": "bsd-3-clause", "size": 8821 }
[ "java.sql.PreparedStatement", "java.sql.ResultSet", "java.sql.SQLException", "java.sql.Statement", "java.sql.Timestamp", "java.text.SimpleDateFormat", "org.postgresql.test.TestUtil", "org.postgresql.util.PGTimestamp" ]
import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.sql.Timestamp; import java.text.SimpleDateFormat; import org.postgresql.test.TestUtil; import org.postgresql.util.PGTimestamp;
import java.sql.*; import java.text.*; import org.postgresql.test.*; import org.postgresql.util.*;
[ "java.sql", "java.text", "org.postgresql.test", "org.postgresql.util" ]
java.sql; java.text; org.postgresql.test; org.postgresql.util;
719,308
@Test public void testReleaseLabel() { // Release tunnels assertThat(pceccHandler.allocateLabel(tunnel), is(true)); pceccHandler.releaseLabel(tunnel); // Retrieve from store. Store should not contain this tunnel info. lspLocalLabelInfoList = pceStore.getTunnelInfo(tunnel.tunnelId()); assertThat(lspLocalLabelInfoList, is(nullValue())); } private class MockDevice extends DefaultDevice { MockDevice(DeviceId id, Annotations annotations) { super(null, id, null, null, null, null, null, null, annotations); } }
void function() { assertThat(pceccHandler.allocateLabel(tunnel), is(true)); pceccHandler.releaseLabel(tunnel); lspLocalLabelInfoList = pceStore.getTunnelInfo(tunnel.tunnelId()); assertThat(lspLocalLabelInfoList, is(nullValue())); } private class MockDevice extends DefaultDevice { MockDevice(DeviceId id, Annotations annotations) { super(null, id, null, null, null, null, null, null, annotations); } }
/** * Checks the operation of releaseLabel() method. */
Checks the operation of releaseLabel() method
testReleaseLabel
{ "repo_name": "osinstom/onos", "path": "protocols/pcep/server/ctl/src/test/java/org/onosproject/pcelabelstore/label/BasicPceccHandlerTest.java", "license": "apache-2.0", "size": 13270 }
[ "org.hamcrest.MatcherAssert", "org.hamcrest.Matchers", "org.onosproject.net.Annotations", "org.onosproject.net.DefaultDevice", "org.onosproject.net.DeviceId" ]
import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; import org.onosproject.net.Annotations; import org.onosproject.net.DefaultDevice; import org.onosproject.net.DeviceId;
import org.hamcrest.*; import org.onosproject.net.*;
[ "org.hamcrest", "org.onosproject.net" ]
org.hamcrest; org.onosproject.net;
345,746
@Deprecated public void setCellFormat(CellType cellType) { this.setCellFormat(new SchemaCellFormat(cellType)); }
void function(CellType cellType) { this.setCellFormat(new SchemaCellFormat(cellType)); }
/** * Sets format of this schema cell using a type that needs no format pattern * * Deprecated. Should not be changed after creation * @param cellType The type of the cell */
Sets format of this schema cell using a type that needs no format pattern Deprecated. Should not be changed after creation
setCellFormat
{ "repo_name": "org-tigris-jsapar/jsapar", "path": "src/main/java/org/jsapar/schema/SchemaCell.java", "license": "apache-2.0", "size": 25755 }
[ "org.jsapar.model.CellType" ]
import org.jsapar.model.CellType;
import org.jsapar.model.*;
[ "org.jsapar.model" ]
org.jsapar.model;
935,813
EReference getDocumentRoot_EnvironmentProperty();
EReference getDocumentRoot_EnvironmentProperty();
/** * Returns the meta object for the containment reference '{@link es.itecban.deployment.model.configuration.DocumentRoot#getEnvironmentProperty <em>Environment Property</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the containment reference '<em>Environment Property</em>'. * @see es.itecban.deployment.model.configuration.DocumentRoot#getEnvironmentProperty() * @see #getDocumentRoot() * @generated */
Returns the meta object for the containment reference '<code>es.itecban.deployment.model.configuration.DocumentRoot#getEnvironmentProperty Environment Property</code>'.
getDocumentRoot_EnvironmentProperty
{ "repo_name": "iLabrys/iLabrysOSGi", "path": "es.itecban.deployment.model.configuration/src/es/itecban/deployment/model/configuration/ConfigurationPackage.java", "license": "apache-2.0", "size": 38571 }
[ "org.eclipse.emf.ecore.EReference" ]
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
2,241,110
public void setPlaybackParams(PlaybackParams playbackParams) { throw new UnsupportedOperationException(); }
void function(PlaybackParams playbackParams) { throw new UnsupportedOperationException(); }
/** * Sets the Playback Parameters to be used by the underlying {@link android.media.AudioTrack}. * * @param playbackParams The playback parameters to be used by the * {@link android.media.AudioTrack}. * @throws UnsupportedOperationException If Playback Parameters are not supported * (i.e. {@link Util#SDK_INT} &lt; 23). */
Sets the Playback Parameters to be used by the underlying <code>android.media.AudioTrack</code>
setPlaybackParams
{ "repo_name": "shazangroup/Mobograph", "path": "TMessagesProj/src/main/java/org/telegram/messenger/exoplayer2/audio/AudioTrack.java", "license": "gpl-2.0", "size": 53431 }
[ "android.media.PlaybackParams" ]
import android.media.PlaybackParams;
import android.media.*;
[ "android.media" ]
android.media;
2,711,880
public static Font getFont() { return font; }
static Font function() { return font; }
/** * Returns the current font. * * @return the current font */
Returns the current font
getFont
{ "repo_name": "gjgj821/fortress", "path": "src/main/java/stdlib/StdDraw.java", "license": "mit", "size": 70938 }
[ "java.awt.Font" ]
import java.awt.Font;
import java.awt.*;
[ "java.awt" ]
java.awt;
2,184,478
public MetadataChild getEmbeddedMetadataChild() { return embeddedMetadataChild; }
MetadataChild function() { return embeddedMetadataChild; }
/** * Gets the metadata from the child * * @return embedded metadata */
Gets the metadata from the child
getEmbeddedMetadataChild
{ "repo_name": "ricepanda/rice-git3", "path": "rice-framework/krad-data/src/main/java/org/kuali/rice/krad/data/metadata/impl/MetadataChildBase.java", "license": "apache-2.0", "size": 6175 }
[ "org.kuali.rice.krad.data.metadata.MetadataChild" ]
import org.kuali.rice.krad.data.metadata.MetadataChild;
import org.kuali.rice.krad.data.metadata.*;
[ "org.kuali.rice" ]
org.kuali.rice;
536,587
public final Map<String, String> getAttributesForElement( String elementName) throws NullPointerException { if (elementName == null) throw new NullPointerException("Cannot retrieve attributes using a null element name."); return elementAttributes.get(elementName); }
final Map<String, String> function( String elementName) throws NullPointerException { if (elementName == null) throw new NullPointerException(STR); return elementAttributes.get(elementName); }
/** * <p>Returns the attributes of a child data element or child sub element, or <code>null</code> * if the element name does not match a known element name and/or no attribute values are available * for that element.</p> * * @param elementName Name of the element to retrieve the attributes of. * @return Attributes of the data element with the given name, or <code>null</code> if an * associated mao of attribute values is not available. * * @throws NullPointerException The element name argument is <code>null</code>. */
Returns the attributes of a child data element or child sub element, or <code>null</code> if the element name does not match a known element name and/or no attribute values are available for that element
getAttributesForElement
{ "repo_name": "AMWA-TV/maj", "path": "src/main/java/tv/amwa/maj/io/xml/LocalHandler.java", "license": "apache-2.0", "size": 34719 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
2,125,589
public List<RemoteRepository> getRepositories(List<RemoteRepository> repositories) { int size = additionalRepositories.size() + repositories.size() + 1; List<RemoteRepository> remoteRepositories = new ArrayList<RemoteRepository>( size); HashSet<RemoteRepository> set = new HashSet<RemoteRepository>(size); set.add(centralRepository); remoteRepositories.add(centralRepository); for(RemoteRepository repository : additionalRepositories) { if(set.add(repository)) { remoteRepositories.add(repository); } } for(RemoteRepository repository : repositories) { if(set.add(repository)) { remoteRepositories.add(repository); } } set.clear(); return Collections.unmodifiableList(remoteRepositories); }
List<RemoteRepository> function(List<RemoteRepository> repositories) { int size = additionalRepositories.size() + repositories.size() + 1; List<RemoteRepository> remoteRepositories = new ArrayList<RemoteRepository>( size); HashSet<RemoteRepository> set = new HashSet<RemoteRepository>(size); set.add(centralRepository); remoteRepositories.add(centralRepository); for(RemoteRepository repository : additionalRepositories) { if(set.add(repository)) { remoteRepositories.add(repository); } } for(RemoteRepository repository : repositories) { if(set.add(repository)) { remoteRepositories.add(repository); } } set.clear(); return Collections.unmodifiableList(remoteRepositories); }
/** * Get all configured repositories. * * @param repositories additional repositories to include. * @return an unmodifyable list of repositories. */
Get all configured repositories
getRepositories
{ "repo_name": "nethad/clustermeister", "path": "provisioning/src/main/java/com/github/nethad/clustermeister/provisioning/dependencymanager/MavenRepositorySystem.java", "license": "apache-2.0", "size": 17014 }
[ "java.util.ArrayList", "java.util.Collections", "java.util.HashSet", "java.util.List", "org.sonatype.aether.repository.RemoteRepository" ]
import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; import java.util.List; import org.sonatype.aether.repository.RemoteRepository;
import java.util.*; import org.sonatype.aether.repository.*;
[ "java.util", "org.sonatype.aether" ]
java.util; org.sonatype.aether;
2,095,376
public SubResource loadBalancerFrontendIpConfiguration() { return this.loadBalancerFrontendIpConfiguration; }
SubResource function() { return this.loadBalancerFrontendIpConfiguration; }
/** * Get the reference to load balancer frontend IP configuration associated with the public IP prefix. * * @return the loadBalancerFrontendIpConfiguration value */
Get the reference to load balancer frontend IP configuration associated with the public IP prefix
loadBalancerFrontendIpConfiguration
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/network/mgmt-v2019_11_01/src/main/java/com/microsoft/azure/management/network/v2019_11_01/implementation/PublicIPPrefixInner.java", "license": "mit", "size": 7853 }
[ "com.microsoft.azure.SubResource" ]
import com.microsoft.azure.SubResource;
import com.microsoft.azure.*;
[ "com.microsoft.azure" ]
com.microsoft.azure;
1,008,561
public void destroySharedConfiguration() { try { Region<String, Configuration> configRegion = getConfigurationRegion(); if (configRegion != null) { configRegion.destroyRegion(); } DiskStore configDiskStore = cache.findDiskStore(CLUSTER_CONFIG_ARTIFACTS_DIR_NAME); if (configDiskStore != null) { configDiskStore.destroy(); } FileUtils.deleteDirectory(configDirPath.toFile()); } catch (Exception exception) { throw new AssertionError(exception); } }
void function() { try { Region<String, Configuration> configRegion = getConfigurationRegion(); if (configRegion != null) { configRegion.destroyRegion(); } DiskStore configDiskStore = cache.findDiskStore(CLUSTER_CONFIG_ARTIFACTS_DIR_NAME); if (configDiskStore != null) { configDiskStore.destroy(); } FileUtils.deleteDirectory(configDirPath.toFile()); } catch (Exception exception) { throw new AssertionError(exception); } }
/** * For tests only. TODO: clean this up and remove from production code * <p> * Throws {@code AssertionError} wrapping any exception thrown by operation. */
Throws AssertionError wrapping any exception thrown by operation
destroySharedConfiguration
{ "repo_name": "smgoller/geode", "path": "geode-core/src/main/java/org/apache/geode/distributed/internal/InternalConfigurationPersistenceService.java", "license": "apache-2.0", "size": 37758 }
[ "org.apache.commons.io.FileUtils", "org.apache.geode.cache.DiskStore", "org.apache.geode.cache.Region", "org.apache.geode.management.internal.configuration.domain.Configuration" ]
import org.apache.commons.io.FileUtils; import org.apache.geode.cache.DiskStore; import org.apache.geode.cache.Region; import org.apache.geode.management.internal.configuration.domain.Configuration;
import org.apache.commons.io.*; import org.apache.geode.cache.*; import org.apache.geode.management.internal.configuration.domain.*;
[ "org.apache.commons", "org.apache.geode" ]
org.apache.commons; org.apache.geode;
1,423,013
@Test public void testInstructionExpectionManagment() { InstructionsResult result = new InstructionsResult(); assertNotNull("Expecting min an empty List of InstructionExpectation", result.getInstructionExpectations()); assertTrue("Expecting an empty list as init value ", result.getInstructionExpectations().isEmpty()); result.addExpectation(new InstructionExpectation()); assertFalse("Expecting an empty list as init value ", result.getInstructionExpectations().isEmpty()); }
void function() { InstructionsResult result = new InstructionsResult(); assertNotNull(STR, result.getInstructionExpectations()); assertTrue(STR, result.getInstructionExpectations().isEmpty()); result.addExpectation(new InstructionExpectation()); assertFalse(STR, result.getInstructionExpectations().isEmpty()); }
/** * Tests the adding and accessing of InstructionExpectation. */
Tests the adding and accessing of InstructionExpectation
testInstructionExpectionManagment
{ "repo_name": "test-editor/test-editor", "path": "core/org.testeditor.core/src/test/java/org/testeditor/core/model/testresult/InstructionsResultTest.java", "license": "epl-1.0", "size": 1820 }
[ "org.junit.Assert" ]
import org.junit.Assert;
import org.junit.*;
[ "org.junit" ]
org.junit;
1,071,028
@Test public void testSetCompletedDate() { Date now = new Date(); statusReport.setCompletedDate(now); assertEquals(now, statusReport.getCompletedDate()); assertEquals(State.COMPLETED, statusReport.getState()); }
void function() { Date now = new Date(); statusReport.setCompletedDate(now); assertEquals(now, statusReport.getCompletedDate()); assertEquals(State.COMPLETED, statusReport.getState()); }
/** * Test method for {@link org.apache.taverna.platform.report.StatusReport#setCompletedDate(java.util.Date)}. */
Test method for <code>org.apache.taverna.platform.report.StatusReport#setCompletedDate(java.util.Date)</code>
testSetCompletedDate
{ "repo_name": "apache/incubator-taverna-engine", "path": "taverna-report-api/src/test/java/org/apache/taverna/platform/report/StatusReportTest.java", "license": "apache-2.0", "size": 7208 }
[ "java.util.Date", "org.junit.Assert" ]
import java.util.Date; import org.junit.Assert;
import java.util.*; import org.junit.*;
[ "java.util", "org.junit" ]
java.util; org.junit;
1,234,396
Date getDueDate();
Date getDueDate();
/** * Due date of the task. */
Due date of the task
getDueDate
{ "repo_name": "roberthafner/flowable-engine", "path": "modules/flowable5-engine/src/main/java/org/activiti5/engine/task/TaskInfo.java", "license": "apache-2.0", "size": 2529 }
[ "java.util.Date" ]
import java.util.Date;
import java.util.*;
[ "java.util" ]
java.util;
732,657
protected Connection doCreateConnection() throws JMSException { return this.targetConnectionFactory.createConnection(); }
Connection function() throws JMSException { return this.targetConnectionFactory.createConnection(); }
/** * Create a JMS Connection via this template's ConnectionFactory. * <p>This implementation uses JMS 1.1 API. * @return the new JMS Connection * @throws javax.jms.JMSException if thrown by JMS API methods */
Create a JMS Connection via this template's ConnectionFactory. This implementation uses JMS 1.1 API
doCreateConnection
{ "repo_name": "raedle/univis", "path": "lib/springframework-1.2.8/src/org/springframework/jms/connection/SingleConnectionFactory.java", "license": "lgpl-2.1", "size": 8679 }
[ "javax.jms.Connection", "javax.jms.JMSException" ]
import javax.jms.Connection; import javax.jms.JMSException;
import javax.jms.*;
[ "javax.jms" ]
javax.jms;
766,305
public Alias writeIndex(@Nullable Boolean writeIndex) { this.writeIndex = writeIndex; return this; }
Alias function(@Nullable Boolean writeIndex) { this.writeIndex = writeIndex; return this; }
/** * Sets whether an alias is pointing to a write-index */
Sets whether an alias is pointing to a write-index
writeIndex
{ "repo_name": "strapdata/elassandra", "path": "server/src/main/java/org/elasticsearch/action/admin/indices/alias/Alias.java", "license": "apache-2.0", "size": 9767 }
[ "org.elasticsearch.common.Nullable" ]
import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.*;
[ "org.elasticsearch.common" ]
org.elasticsearch.common;
739,822
public ServiceFuture<Void> beginDeleteAsync(String resourceGroupName, String virtualNetworkName, String virtualNetworkPeeringName, final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, virtualNetworkName, virtualNetworkPeeringName), serviceCallback); }
ServiceFuture<Void> function(String resourceGroupName, String virtualNetworkName, String virtualNetworkPeeringName, final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, virtualNetworkName, virtualNetworkPeeringName), serviceCallback); }
/** * Deletes the specified virtual network peering. * * @param resourceGroupName The name of the resource group. * @param virtualNetworkName The name of the virtual network. * @param virtualNetworkPeeringName The name of the virtual network peering. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */
Deletes the specified virtual network peering
beginDeleteAsync
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/network/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/network/v2020_04_01/implementation/VirtualNetworkPeeringsInner.java", "license": "mit", "size": 48368 }
[ "com.microsoft.rest.ServiceCallback", "com.microsoft.rest.ServiceFuture" ]
import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceFuture;
import com.microsoft.rest.*;
[ "com.microsoft.rest" ]
com.microsoft.rest;
2,382,635
Observable<JsonObject> continueScroll(String scrollId, String timeout); /** * Perform a search. The result set might not contain all documents. If you * want to scroll over all results use * {@link #beginScroll(String, JsonObject, JsonObject, String)}
Observable<JsonObject> continueScroll(String scrollId, String timeout); /** * Perform a search. The result set might not contain all documents. If you * want to scroll over all results use * {@link #beginScroll(String, JsonObject, JsonObject, String)}
/** * Continue scrolling through search results. Call * {@link #beginScroll(String, JsonObject, JsonObject, String)} to get a scroll id * @param scrollId the scroll id * @param timeout the time after which the scroll id becomes invalid * @return an object containing new search hits and possibly a new scroll id */
Continue scrolling through search results. Call <code>#beginScroll(String, JsonObject, JsonObject, String)</code> to get a scroll id
continueScroll
{ "repo_name": "andrej-sajenko/georocket", "path": "georocket-server/src/main/java/io/georocket/index/elasticsearch/ElasticsearchClient.java", "license": "apache-2.0", "size": 12248 }
[ "io.vertx.core.json.JsonObject" ]
import io.vertx.core.json.JsonObject;
import io.vertx.core.json.*;
[ "io.vertx.core" ]
io.vertx.core;
704,635
protected void loadKeys() throws InterruptedException { if ( log.isDebugEnabled() ) { log.debug( logCacheName + "Loading keys for " + keyFile.toString() ); } storageLock.writeLock().lock(); try { // create a key map to use. initializeKeyMap(); HashMap<K, IndexedDiskElementDescriptor> keys = keyFile.readObject( new IndexedDiskElementDescriptor( 0, (int) keyFile.length() - IndexedDisk.HEADER_SIZE_BYTES ) ); if ( keys != null ) { if ( log.isDebugEnabled() ) { log.debug( logCacheName + "Found " + keys.size() + " in keys file." ); } keyHash.putAll( keys ); if ( log.isInfoEnabled() ) { log.info( logCacheName + "Loaded keys from [" + fileName + "], key count: " + keyHash.size() + "; up to " + maxKeySize + " will be available." ); } } if ( log.isDebugEnabled() ) { dump( false ); } } catch ( Exception e ) { log.error( logCacheName + "Problem loading keys for file " + fileName, e ); } finally { storageLock.writeLock().unlock(); } }
void function() throws InterruptedException { if ( log.isDebugEnabled() ) { log.debug( logCacheName + STR + keyFile.toString() ); } storageLock.writeLock().lock(); try { initializeKeyMap(); HashMap<K, IndexedDiskElementDescriptor> keys = keyFile.readObject( new IndexedDiskElementDescriptor( 0, (int) keyFile.length() - IndexedDisk.HEADER_SIZE_BYTES ) ); if ( keys != null ) { if ( log.isDebugEnabled() ) { log.debug( logCacheName + STR + keys.size() + STR ); } keyHash.putAll( keys ); if ( log.isInfoEnabled() ) { log.info( logCacheName + STR + fileName + STR + keyHash.size() + STR + maxKeySize + STR ); } } if ( log.isDebugEnabled() ) { dump( false ); } } catch ( Exception e ) { log.error( logCacheName + STR + fileName, e ); } finally { storageLock.writeLock().unlock(); } }
/** * Loads the keys from the .key file. The keys are stored in a HashMap on disk. This is * converted into a LRUMap. * <p> * @throws InterruptedException */
Loads the keys from the .key file. The keys are stored in a HashMap on disk. This is converted into a LRUMap.
loadKeys
{ "repo_name": "mohanaraosv/commons-jcs", "path": "commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexedDiskCache.java", "license": "apache-2.0", "size": 55582 }
[ "java.util.HashMap" ]
import java.util.HashMap;
import java.util.*;
[ "java.util" ]
java.util;
1,047,745
public Date getUpdateTime() { return updateTime; }
Date function() { return updateTime; }
/** * This method was generated by MyBatis Generator. * This method returns the value of the database column lottery_info.update_time * * @return the value of lottery_info.update_time * * @mbggenerated Sun Apr 15 17:33:13 CST 2018 */
This method was generated by MyBatis Generator. This method returns the value of the database column lottery_info.update_time
getUpdateTime
{ "repo_name": "guhanjie/wine", "path": "src/main/java/top/guhanjie/wine/model/LotteryInfo.java", "license": "apache-2.0", "size": 5602 }
[ "java.util.Date" ]
import java.util.Date;
import java.util.*;
[ "java.util" ]
java.util;
1,812,679
public static void i(String tag, String msg) { if (sLevel > LEVEL_INFO) { return; } Log.i(tag, msg); }
static void function(String tag, String msg) { if (sLevel > LEVEL_INFO) { return; } Log.i(tag, msg); }
/** * Send an INFO log message * * @param tag * @param msg */
Send an INFO log message
i
{ "repo_name": "hubcarl/smart-hybrid-app-framework", "path": "src/com/smart/app/vendor/pulldownrefresh/util/PtrCLog.java", "license": "mit", "size": 6155 }
[ "android.util.Log" ]
import android.util.Log;
import android.util.*;
[ "android.util" ]
android.util;
894,438
ServiceBuilder.ConfigSetupHelper configSetupHelper = new ServiceBuilder.ConfigSetupHelper(getCommandArgs().getState().getConfigBuilder().build()); StorageLoader loader = new StorageLoader(); return loader.load(configSetupHelper, getServiceConfig().getStorageImplementation(), getServiceConfig().getStorageLayout(), executorService); }
ServiceBuilder.ConfigSetupHelper configSetupHelper = new ServiceBuilder.ConfigSetupHelper(getCommandArgs().getState().getConfigBuilder().build()); StorageLoader loader = new StorageLoader(); return loader.load(configSetupHelper, getServiceConfig().getStorageImplementation(), getServiceConfig().getStorageLayout(), executorService); }
/** * Creates the {@link StorageFactory} instance by reading the config values. * * @param executorService A thread pool for execution. * @return A newly created {@link StorageFactory} instance. */
Creates the <code>StorageFactory</code> instance by reading the config values
createStorageFactory
{ "repo_name": "pravega/pravega", "path": "cli/admin/src/main/java/io/pravega/cli/admin/dataRecovery/DataRecoveryCommand.java", "license": "apache-2.0", "size": 2068 }
[ "io.pravega.segmentstore.server.host.StorageLoader", "io.pravega.segmentstore.server.store.ServiceBuilder" ]
import io.pravega.segmentstore.server.host.StorageLoader; import io.pravega.segmentstore.server.store.ServiceBuilder;
import io.pravega.segmentstore.server.host.*; import io.pravega.segmentstore.server.store.*;
[ "io.pravega.segmentstore" ]
io.pravega.segmentstore;
2,692,845
public static List<String> getLineageNamesByDescription(String queriedDescription) { queriedDescription = queriedDescription.toLowerCase(); final Set<String> lineageNamesSet = new HashSet<>(); for (int i = 0; i < descriptions.size(); i++) { if (descriptions.get(i).toLowerCase().contains(queriedDescription)) { lineageNamesSet.add(getLineageNameByIndex(i)); } } final List<String> lineageNamesList = new ArrayList<>(lineageNamesSet); sort(lineageNamesList); return lineageNamesList; }
static List<String> function(String queriedDescription) { queriedDescription = queriedDescription.toLowerCase(); final Set<String> lineageNamesSet = new HashSet<>(); for (int i = 0; i < descriptions.size(); i++) { if (descriptions.get(i).toLowerCase().contains(queriedDescription)) { lineageNamesSet.add(getLineageNameByIndex(i)); } } final List<String> lineageNamesList = new ArrayList<>(lineageNamesSet); sort(lineageNamesList); return lineageNamesList; }
/** * Retrieves the lineage names of cells with a description. No duplicates are returned and results are sorted. * * @param queriedDescription * the lineage name * * @return lineage name for that description */
Retrieves the lineage names of cells with a description. No duplicates are returned and results are sorted
getLineageNamesByDescription
{ "repo_name": "zhirongbaolab/WormGUIDES", "path": "src/application_src/application_model/data/CElegansData/PartsList/PartsList.java", "license": "gpl-3.0", "size": 8854 }
[ "java.util.ArrayList", "java.util.Collections", "java.util.HashSet", "java.util.List", "java.util.Set" ]
import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
428,292
private boolean isAlwaysNavigable(PageAnchor anchor) { if(anchor != null) { switch(anchor) { case HELP: return true; } } return false; }
boolean function(PageAnchor anchor) { if(anchor != null) { switch(anchor) { case HELP: return true; } } return false; }
/** * Returns whether navigation always should work for the actual page */
Returns whether navigation always should work for the actual page
isAlwaysNavigable
{ "repo_name": "deefactorial/omlets", "path": "omlets/src/org/openmoney/omlets/mobile/client/Navigation.java", "license": "gpl-2.0", "size": 12928 }
[ "org.openmoney.omlets.mobile.client.ui.PageAnchor" ]
import org.openmoney.omlets.mobile.client.ui.PageAnchor;
import org.openmoney.omlets.mobile.client.ui.*;
[ "org.openmoney.omlets" ]
org.openmoney.omlets;
845,183
@Override protected File getConfigTemplateFile() { // Instrumentation in this test's output log to show custom configuration file used for template. System.out.println("This test case overrides default configuration with " + TEST_CONF_FILE.getPath()); return TEST_CONF_FILE; }
File function() { System.out.println(STR + TEST_CONF_FILE.getPath()); return TEST_CONF_FILE; }
/** * Override default configuration with custom test configuration to ensure * scratch space and local temporary directory locations are also updated. */
Override default configuration with custom test configuration to ensure scratch space and local temporary directory locations are also updated
getConfigTemplateFile
{ "repo_name": "asurve/arvind-sysml2", "path": "src/test/java/org/apache/sysml/test/integration/functions/compress/CompressedLinregCG.java", "license": "apache-2.0", "size": 5862 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
2,417,486
public Set<Set<Term>> getSynchronousSet();
Set<Set<Term>> function();
/** * Get synchronous set of variables. * * @return map with synchronous information. */
Get synchronous set of variables
getSynchronousSet
{ "repo_name": "kasperdokter/Reo-compiler", "path": "reo-semantics/src/main/java/nl/cwi/reo/semantics/predicates/Formula.java", "license": "mit", "size": 2621 }
[ "java.util.Set" ]
import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
794,622
@PUT public Response createFedoraWebacAcl(@HeaderParam(CONTENT_TYPE) final MediaType requestContentType, final InputStream requestBodyStream) throws ConstraintViolationException { if (resource().isAcl() || resource().isMemento()) { throw new BadRequestException("ACL resource creation is not allowed for resource " + resource().getPath()); } final boolean created; final FedoraResource aclResource; final String path = toPath(translator(), externalPath); final AcquiredLock lock = lockManager.lockForWrite(path, session.getFedoraSession(), nodeService); try { LOGGER.info("PUT acl resource '{}'", externalPath); aclResource = resource().findOrCreateAcl(); created = aclResource.isNew(); final MediaType contentType = getSimpleContentType(requestContentType == null ? RDFMediaType.TURTLE_TYPE : requestContentType); if (isRdfContentType(contentType.toString())) { try (final RdfStream resourceTriples = created ? new DefaultRdfStream(asNode(aclResource)) : getResourceTriples(aclResource)) { replaceResourceWithStream(aclResource, requestBodyStream, contentType, resourceTriples); } } else { throw new BadRequestException("Content-Type (" + requestContentType + ") is invalid. Try text/turtle " + "or other RDF compatible type."); } session.commit(); } finally { lock.release(); } addCacheControlHeaders(servletResponse, aclResource, session); final URI location = getUri(aclResource); if (created) { return created(location).build(); } else { return noContent().location(location).build(); } }
Response function(@HeaderParam(CONTENT_TYPE) final MediaType requestContentType, final InputStream requestBodyStream) throws ConstraintViolationException { if (resource().isAcl() resource().isMemento()) { throw new BadRequestException(STR + resource().getPath()); } final boolean created; final FedoraResource aclResource; final String path = toPath(translator(), externalPath); final AcquiredLock lock = lockManager.lockForWrite(path, session.getFedoraSession(), nodeService); try { LOGGER.info(STR, externalPath); aclResource = resource().findOrCreateAcl(); created = aclResource.isNew(); final MediaType contentType = getSimpleContentType(requestContentType == null ? RDFMediaType.TURTLE_TYPE : requestContentType); if (isRdfContentType(contentType.toString())) { try (final RdfStream resourceTriples = created ? new DefaultRdfStream(asNode(aclResource)) : getResourceTriples(aclResource)) { replaceResourceWithStream(aclResource, requestBodyStream, contentType, resourceTriples); } } else { throw new BadRequestException(STR + requestContentType + STR + STR); } session.commit(); } finally { lock.release(); } addCacheControlHeaders(servletResponse, aclResource, session); final URI location = getUri(aclResource); if (created) { return created(location).build(); } else { return noContent().location(location).build(); } }
/** * PUT to create FedoraWebacACL resource. * @param requestContentType The content type of the resource body * @param requestBodyStream The request body as stream * @return the response for a request to create a Fedora WebAc acl * @throws ConstraintViolationException in case this action would violate a constraint on repository structure */
PUT to create FedoraWebacACL resource
createFedoraWebacAcl
{ "repo_name": "yinlinchen/fcrepo4", "path": "fcrepo-http-api/src/main/java/org/fcrepo/http/api/FedoraAcl.java", "license": "apache-2.0", "size": 14489 }
[ "java.io.InputStream", "javax.jcr.nodetype.ConstraintViolationException", "javax.ws.rs.BadRequestException", "javax.ws.rs.HeaderParam", "javax.ws.rs.core.MediaType", "javax.ws.rs.core.Response", "org.fcrepo.http.api.PathLockManager", "org.fcrepo.http.commons.domain.RDFMediaType", "org.fcrepo.kernel.api.RdfStream", "org.fcrepo.kernel.api.models.FedoraResource", "org.fcrepo.kernel.api.rdf.DefaultRdfStream" ]
import java.io.InputStream; import javax.jcr.nodetype.ConstraintViolationException; import javax.ws.rs.BadRequestException; import javax.ws.rs.HeaderParam; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import org.fcrepo.http.api.PathLockManager; import org.fcrepo.http.commons.domain.RDFMediaType; import org.fcrepo.kernel.api.RdfStream; import org.fcrepo.kernel.api.models.FedoraResource; import org.fcrepo.kernel.api.rdf.DefaultRdfStream;
import java.io.*; import javax.jcr.nodetype.*; import javax.ws.rs.*; import javax.ws.rs.core.*; import org.fcrepo.http.api.*; import org.fcrepo.http.commons.domain.*; import org.fcrepo.kernel.api.*; import org.fcrepo.kernel.api.models.*; import org.fcrepo.kernel.api.rdf.*;
[ "java.io", "javax.jcr", "javax.ws", "org.fcrepo.http", "org.fcrepo.kernel" ]
java.io; javax.jcr; javax.ws; org.fcrepo.http; org.fcrepo.kernel;
509,401
@Test public final void testCreatePacketValidPayload() { // Setup the resources for the test. int frameType = APIFrameType.MODEM_STATUS.getValue(); ModemStatusEvent modemStatusEvent = ModemStatusEvent.STATUS_JOINED_NETWORK; byte[] payload = new byte[2]; payload[0] = (byte)frameType; payload[1] = (byte)modemStatusEvent.getId(); // Call the method under test. ModemStatusPacket packet = ModemStatusPacket.createPacket(payload); // Verify the result. assertThat("Returned length is not the expected one", packet.getPacketLength(), is(equalTo(payload.length))); assertThat("Returned Modem Status is not the expected one", packet.getStatus(), is(equalTo(modemStatusEvent))); }
final void function() { int frameType = APIFrameType.MODEM_STATUS.getValue(); ModemStatusEvent modemStatusEvent = ModemStatusEvent.STATUS_JOINED_NETWORK; byte[] payload = new byte[2]; payload[0] = (byte)frameType; payload[1] = (byte)modemStatusEvent.getId(); ModemStatusPacket packet = ModemStatusPacket.createPacket(payload); assertThat(STR, packet.getPacketLength(), is(equalTo(payload.length))); assertThat(STR, packet.getStatus(), is(equalTo(modemStatusEvent))); }
/** * Test method for {@link com.digi.xbee.api.packet.common.ModemStatusPacket#createPacket(byte[])}. * * <p>A valid Modem Status packet is created.</p> */
Test method for <code>com.digi.xbee.api.packet.common.ModemStatusPacket#createPacket(byte[])</code>. A valid Modem Status packet is created
testCreatePacketValidPayload
{ "repo_name": "GUBotDev/XBeeJavaLibrary", "path": "library/src/test/java/com/digi/xbee/api/packet/common/ModemStatusPacketTest.java", "license": "mpl-2.0", "size": 9119 }
[ "com.digi.xbee.api.models.ModemStatusEvent", "com.digi.xbee.api.packet.APIFrameType", "org.hamcrest.core.Is", "org.junit.Assert" ]
import com.digi.xbee.api.models.ModemStatusEvent; import com.digi.xbee.api.packet.APIFrameType; import org.hamcrest.core.Is; import org.junit.Assert;
import com.digi.xbee.api.models.*; import com.digi.xbee.api.packet.*; import org.hamcrest.core.*; import org.junit.*;
[ "com.digi.xbee", "org.hamcrest.core", "org.junit" ]
com.digi.xbee; org.hamcrest.core; org.junit;
2,250,672
private static double[] loadData(String fname) { consoleLogger.info("reading from " + fname); long lineCounter = 0; double ts[] = new double[1]; Path path = Paths.get(fname); ArrayList<Double> data = new ArrayList<Double>(); try { BufferedReader reader = Files.newBufferedReader(path, DEFAULT_CHARSET); String line = null; while ((line = reader.readLine()) != null) { String[] lineSplit = line.trim().split("\\s+"); for (int i = 0; i < lineSplit.length; i++) { double value = new BigDecimal(lineSplit[i]).doubleValue(); data.add(value); } lineCounter++; } reader.close(); } catch (Exception e) { System.err.println(StackTrace.toString(e)); } finally { assert true; } if (!(data.isEmpty())) { ts = new double[data.size()]; for (int i = 0; i < data.size(); i++) { ts[i] = data.get(i); } } consoleLogger.info("loaded " + data.size() + " points from " + lineCounter + " lines in " + fname); return ts; }
static double[] function(String fname) { consoleLogger.info(STR + fname); long lineCounter = 0; double ts[] = new double[1]; Path path = Paths.get(fname); ArrayList<Double> data = new ArrayList<Double>(); try { BufferedReader reader = Files.newBufferedReader(path, DEFAULT_CHARSET); String line = null; while ((line = reader.readLine()) != null) { String[] lineSplit = line.trim().split("\\s+"); for (int i = 0; i < lineSplit.length; i++) { double value = new BigDecimal(lineSplit[i]).doubleValue(); data.add(value); } lineCounter++; } reader.close(); } catch (Exception e) { System.err.println(StackTrace.toString(e)); } finally { assert true; } if (!(data.isEmpty())) { ts = new double[data.size()]; for (int i = 0; i < data.size(); i++) { ts[i] = data.get(i); } } consoleLogger.info(STR + data.size() + STR + lineCounter + STR + fname); return ts; }
/** * This reads the data * * @param fname The filename. * @return */
This reads the data
loadData
{ "repo_name": "RaynorJim/grammarviz2_src", "path": "src/main/java/net/seninp/tinker/ParamsSearchExperiment.java", "license": "gpl-2.0", "size": 8205 }
[ "java.io.BufferedReader", "java.math.BigDecimal", "java.nio.file.Files", "java.nio.file.Path", "java.nio.file.Paths", "java.util.ArrayList", "net.seninp.util.StackTrace" ]
import java.io.BufferedReader; import java.math.BigDecimal; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.ArrayList; import net.seninp.util.StackTrace;
import java.io.*; import java.math.*; import java.nio.file.*; import java.util.*; import net.seninp.util.*;
[ "java.io", "java.math", "java.nio", "java.util", "net.seninp.util" ]
java.io; java.math; java.nio; java.util; net.seninp.util;
910,145
public void addFlightPathPoint(Coord2D coord);
void function(Coord2D coord);
/** * Adds a coordinate to the drone's flight path. * * @param coord * drone's coordinate */
Adds a coordinate to the drone's flight path
addFlightPathPoint
{ "repo_name": "TShapinsky/droidplanner", "path": "Android/src/org/droidplanner/android/maps/DPMap.java", "license": "gpl-3.0", "size": 8603 }
[ "org.droidplanner.core.helpers.coordinates.Coord2D" ]
import org.droidplanner.core.helpers.coordinates.Coord2D;
import org.droidplanner.core.helpers.coordinates.*;
[ "org.droidplanner.core" ]
org.droidplanner.core;
1,948,626
public static String getDateTimeString(final Date date) { // Declare our formatter java.text.SimpleDateFormat formatter = new java.text.SimpleDateFormat("MM/dd/yyyy HH:mm:ss"); // Return the date/time as a string return formatter.format(date); }
static String function(final Date date) { java.text.SimpleDateFormat formatter = new java.text.SimpleDateFormat(STR); return formatter.format(date); }
/** * Format the date and time as a string, using a standard format. * * @return the date as a string */
Format the date and time as a string, using a standard format
getDateTimeString
{ "repo_name": "argonium/codeman", "path": "src/io/miti/codeman/util/Utility.java", "license": "mit", "size": 24545 }
[ "java.util.Date" ]
import java.util.Date;
import java.util.*;
[ "java.util" ]
java.util;
1,324,943
@Override protected void formatCookieAsVer(final CharArrayBuffer buffer, final Cookie cookie, int version) { super.formatCookieAsVer(buffer, cookie, version); // format port attribute if (cookie instanceof ClientCookie) { // Test if the port attribute as set by the origin server is not blank String s = ((ClientCookie) cookie).getAttribute(ClientCookie.PORT_ATTR); if (s != null) { buffer.append("; $Port"); buffer.append("=\""); if (s.trim().length() > 0) { int[] ports = cookie.getPorts(); if (ports != null) { for (int i = 0, len = ports.length; i < len; i++) { if (i > 0) { buffer.append(","); } buffer.append(Integer.toString(ports[i])); } } } buffer.append("\""); } } }
void function(final CharArrayBuffer buffer, final Cookie cookie, int version) { super.formatCookieAsVer(buffer, cookie, version); if (cookie instanceof ClientCookie) { String s = ((ClientCookie) cookie).getAttribute(ClientCookie.PORT_ATTR); if (s != null) { buffer.append(STR); buffer.append("=\"STR,STR\""); } } }
/** * Adds valid Port attribute value, e.g. "8000,8001,8002" */
Adds valid Port attribute value, e.g. "8000,8001,8002"
formatCookieAsVer
{ "repo_name": "haikuowuya/android_system_code", "path": "src/org/apache/http/impl/cookie/RFC2965Spec.java", "license": "apache-2.0", "size": 9683 }
[ "org.apache.http.cookie.ClientCookie", "org.apache.http.cookie.Cookie", "org.apache.http.util.CharArrayBuffer" ]
import org.apache.http.cookie.ClientCookie; import org.apache.http.cookie.Cookie; import org.apache.http.util.CharArrayBuffer;
import org.apache.http.cookie.*; import org.apache.http.util.*;
[ "org.apache.http" ]
org.apache.http;
2,723,730
int getChildrenSkipCount(View child, int index) { return 0; }
int getChildrenSkipCount(View child, int index) { return 0; }
/** * <p>Returns the number of children to skip after measuring/laying out * the specified child.</p> * * @param child the child after which we want to skip children * @param index the index of the child after which we want to skip children * @return the number of children to skip, 0 by default */
Returns the number of children to skip after measuring/laying out the specified child
getChildrenSkipCount
{ "repo_name": "OmniEvo/android_frameworks_base", "path": "core/java/android/widget/LinearLayout.java", "license": "gpl-3.0", "size": 79067 }
[ "android.view.View" ]
import android.view.View;
import android.view.*;
[ "android.view" ]
android.view;
2,417,020
@Reference( name = "carbon.runtime.service", service = CarbonRuntime.class, cardinality = ReferenceCardinality.MANDATORY, policy = ReferencePolicy.DYNAMIC, unbind = "unregisterCarbonRuntime" ) protected void registerCarbonRuntime(CarbonRuntime carbonRuntime) { DataHolder.getInstance().setCarbonRuntime(carbonRuntime); }
@Reference( name = STR, service = CarbonRuntime.class, cardinality = ReferenceCardinality.MANDATORY, policy = ReferencePolicy.DYNAMIC, unbind = STR ) void function(CarbonRuntime carbonRuntime) { DataHolder.getInstance().setCarbonRuntime(carbonRuntime); }
/** * Get the CarbonRuntime service. * This is the bind method that gets called for CarbonRuntime service registration that satisfy the policy. * * @param carbonRuntime the CarbonRuntime service that is registered as a service. */
Get the CarbonRuntime service. This is the bind method that gets called for CarbonRuntime service registration that satisfy the policy
registerCarbonRuntime
{ "repo_name": "jsdjayanga/carbon-deployment", "path": "components/org.wso2.carbon.deployment.engine/src/main/java/org/wso2/carbon/deployment/engine/internal/DeploymentEngineListenerComponent.java", "license": "apache-2.0", "size": 8292 }
[ "org.osgi.service.component.annotations.Reference", "org.osgi.service.component.annotations.ReferenceCardinality", "org.osgi.service.component.annotations.ReferencePolicy", "org.wso2.carbon.kernel.CarbonRuntime" ]
import org.osgi.service.component.annotations.Reference; import org.osgi.service.component.annotations.ReferenceCardinality; import org.osgi.service.component.annotations.ReferencePolicy; import org.wso2.carbon.kernel.CarbonRuntime;
import org.osgi.service.component.annotations.*; import org.wso2.carbon.kernel.*;
[ "org.osgi.service", "org.wso2.carbon" ]
org.osgi.service; org.wso2.carbon;
606,612
public static void configurePeriodicSync(Context context, int syncInterval, int flexTime) { Account account = getSyncAccount(context); String authority = context.getString(R.string.content_authority); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { // we can enable inexact timers in our periodic sync SyncRequest request = new SyncRequest.Builder(). syncPeriodic(syncInterval, flexTime). setSyncAdapter(account, authority). setExtras(new Bundle()).build(); ContentResolver.requestSync(request); } else { ContentResolver.addPeriodicSync(account, authority, new Bundle(), syncInterval); } }
static void function(Context context, int syncInterval, int flexTime) { Account account = getSyncAccount(context); String authority = context.getString(R.string.content_authority); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { SyncRequest request = new SyncRequest.Builder(). syncPeriodic(syncInterval, flexTime). setSyncAdapter(account, authority). setExtras(new Bundle()).build(); ContentResolver.requestSync(request); } else { ContentResolver.addPeriodicSync(account, authority, new Bundle(), syncInterval); } }
/** * Helper method to schedule the sync adapter periodic execution */
Helper method to schedule the sync adapter periodic execution
configurePeriodicSync
{ "repo_name": "jfeldman3694/Sunshine", "path": "app/src/main/java/com/example/android/sunshine/app/sync/SunshineSyncAdapter.java", "license": "apache-2.0", "size": 24087 }
[ "android.accounts.Account", "android.content.ContentResolver", "android.content.Context", "android.content.SyncRequest", "android.os.Build", "android.os.Bundle" ]
import android.accounts.Account; import android.content.ContentResolver; import android.content.Context; import android.content.SyncRequest; import android.os.Build; import android.os.Bundle;
import android.accounts.*; import android.content.*; import android.os.*;
[ "android.accounts", "android.content", "android.os" ]
android.accounts; android.content; android.os;
1,023,400
private void parseFilterExpr() throws SirixXPathException { parsePrimaryExpr(); parsePredicateList(); }
void function() throws SirixXPathException { parsePrimaryExpr(); parsePredicateList(); }
/** * Parses the the rule FilterExpr according to the following production rule: * <p> * [38] FilterExpr ::= PrimaryExpr PredicateList . * </p> * * @throws SirixXPathException */
Parses the the rule FilterExpr according to the following production rule: [38] FilterExpr ::= PrimaryExpr PredicateList .
parseFilterExpr
{ "repo_name": "sirixdb/sirix", "path": "bundles/sirix-core/src/main/java/org/sirix/service/xml/xpath/parser/XPathParser.java", "license": "bsd-3-clause", "size": 59160 }
[ "org.sirix.exception.SirixXPathException" ]
import org.sirix.exception.SirixXPathException;
import org.sirix.exception.*;
[ "org.sirix.exception" ]
org.sirix.exception;
375,784
public Cursor<Record> find(Comparable<? super Record> fields) { Lock previous = new ReentrantLock(); previous.lock(); Tier<Record, Address> inner = getRoot(); for (;;) { inner.readWriteLock.readLock().lock(); previous.unlock(); previous = inner.readWriteLock.readLock(); int branch = inner.find(fields); if (inner.isChildLeaf()) { Tier<Record, Address> leaf = structure.getStorage().load(stash, inner.getChildAddress(branch)); leaf.readWriteLock.readLock().lock(); previous.unlock(); return new CoreCursor<Record, Address>(stash, structure, leaf, leaf.find(fields)); } inner = structure.getStorage().load(stash, inner.getChildAddress(branch)); } }
Cursor<Record> function(Comparable<? super Record> fields) { Lock previous = new ReentrantLock(); previous.lock(); Tier<Record, Address> inner = getRoot(); for (;;) { inner.readWriteLock.readLock().lock(); previous.unlock(); previous = inner.readWriteLock.readLock(); int branch = inner.find(fields); if (inner.isChildLeaf()) { Tier<Record, Address> leaf = structure.getStorage().load(stash, inner.getChildAddress(branch)); leaf.readWriteLock.readLock().lock(); previous.unlock(); return new CoreCursor<Record, Address>(stash, structure, leaf, leaf.find(fields)); } inner = structure.getStorage().load(stash, inner.getChildAddress(branch)); } }
/** * Return a forward cursor that references if the first object value in the * b+tree that is less than or equal to the given comparable. * * @param comparable * The comparable representing the value to find. * @return A forward cursor that references the first object value in the * b+tree that is less than or equal to the given comparable. */
Return a forward cursor that references if the first object value in the b+tree that is less than or equal to the given comparable
find
{ "repo_name": "defunct/strata", "path": "src/main/java/com/goodworkalan/strata/CoreQuery.java", "license": "mit", "size": 14521 }
[ "java.util.concurrent.locks.Lock", "java.util.concurrent.locks.ReentrantLock" ]
import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock;
import java.util.concurrent.locks.*;
[ "java.util" ]
java.util;
1,346,250
public WebDriver getProxiedBrowser(String providedBrowserId, boolean enableExtensions) { return this.getProxiedBrowser(providedBrowserId, null, enableExtensions); }
WebDriver function(String providedBrowserId, boolean enableExtensions) { return this.getProxiedBrowser(providedBrowserId, null, enableExtensions); }
/** * Opens the identified browser for manual proxying through ZAP * * @param providedBrowserId the browser id * @param enableExtensions if true then optional browser extensions will be enabled */
Opens the identified browser for manual proxying through ZAP
getProxiedBrowser
{ "repo_name": "kingthorin/zap-extensions", "path": "addOns/selenium/src/main/java/org/zaproxy/zap/extension/selenium/ExtensionSelenium.java", "license": "apache-2.0", "size": 48162 }
[ "org.openqa.selenium.WebDriver" ]
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.*;
[ "org.openqa.selenium" ]
org.openqa.selenium;
2,753,964
private boolean openFileDialog () { //Using user.home instead of user.dir boolean projOpened = false; JFileChooser fc = new JFileChooser(new File( System.getProperty ("user.home") + File.separator + ".memoranda" + File.separator + ".proj" + File.separator + ".pspxFiles")); int returnVal = fc.showOpenDialog(this); ObjectInputStream ois; if (returnVal == JFileChooser.APPROVE_OPTION) { try { File openThis = fc.getSelectedFile(); ois = new ObjectInputStream (new FileInputStream (openThis.getAbsolutePath())); pspI = (PspImpl) ois.readObject(); //Checks to see what other snap ins need to be opened for the opened project openSavedSnapIns (new File (System.getProperty("user.home") + File.separator + ".memoranda" + File.separator + ".proj" + File.separator + '.' + pspI.getpId())); ois.close(); if (currentView instanceof PSP_DesignPanel) { project_MouseEvent ("DESIGN"); } else if (currentView instanceof PSP_DefectPanel) { project_MouseEvent ("DEFECT"); } else if (currentView instanceof PSP_PlanningPanel) { project_MouseEvent ("PLANNING"); } else if (currentView instanceof PSP_DevelopmentTable) { dev = (Development) ois.readObject(); } else if (currentView instanceof PSP_TimeLog) { project_MouseEvent ("TIMELOG"); } else { project_MouseEvent ("PSP"); } projOpened = true; if (toolBar.getComponentCount() <= 3) setExtraTools (); } catch (ClassNotFoundException e) { Util.debug("CHECK THE OBJECT"); projOpened = false; } catch (IOException e) { Util.debug("FILE NOT FOUND!"); projOpened = false; } } return projOpened; }
boolean function () { boolean projOpened = false; JFileChooser fc = new JFileChooser(new File( System.getProperty (STR) + File.separator + STR + File.separator + ".proj" + File.separator + STR)); int returnVal = fc.showOpenDialog(this); ObjectInputStream ois; if (returnVal == JFileChooser.APPROVE_OPTION) { try { File openThis = fc.getSelectedFile(); ois = new ObjectInputStream (new FileInputStream (openThis.getAbsolutePath())); pspI = (PspImpl) ois.readObject(); openSavedSnapIns (new File (System.getProperty(STR) + File.separator + STR + File.separator + ".proj" + File.separator + '.' + pspI.getpId())); ois.close(); if (currentView instanceof PSP_DesignPanel) { project_MouseEvent (STR); } else if (currentView instanceof PSP_DefectPanel) { project_MouseEvent (STR); } else if (currentView instanceof PSP_PlanningPanel) { project_MouseEvent (STR); } else if (currentView instanceof PSP_DevelopmentTable) { dev = (Development) ois.readObject(); } else if (currentView instanceof PSP_TimeLog) { project_MouseEvent (STR); } else { project_MouseEvent ("PSP"); } projOpened = true; if (toolBar.getComponentCount() <= 3) setExtraTools (); } catch (ClassNotFoundException e) { Util.debug(STR); projOpened = false; } catch (IOException e) { Util.debug(STR); projOpened = false; } } return projOpened; }
/** * Implementing open file dialog to help user select project to open */
Implementing open file dialog to help user select project to open
openFileDialog
{ "repo_name": "cst316/spring16project-io", "path": "src/net/sf/memoranda/ui/PSP_Panel.java", "license": "gpl-2.0", "size": 21393 }
[ "java.awt.event.MouseEvent", "java.io.File", "java.io.FileInputStream", "java.io.IOException", "java.io.ObjectInputStream", "javax.swing.JFileChooser", "net.sf.memoranda.psp.Development", "net.sf.memoranda.psp.PspImpl", "net.sf.memoranda.psp.TimeLog", "net.sf.memoranda.util.Util" ]
import java.awt.event.MouseEvent; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.ObjectInputStream; import javax.swing.JFileChooser; import net.sf.memoranda.psp.Development; import net.sf.memoranda.psp.PspImpl; import net.sf.memoranda.psp.TimeLog; import net.sf.memoranda.util.Util;
import java.awt.event.*; import java.io.*; import javax.swing.*; import net.sf.memoranda.psp.*; import net.sf.memoranda.util.*;
[ "java.awt", "java.io", "javax.swing", "net.sf.memoranda" ]
java.awt; java.io; javax.swing; net.sf.memoranda;
525,157
protected void onPostExecute(Bitmap result) { iv.setImageBitmap(result); } }
void function(Bitmap result) { iv.setImageBitmap(result); } }
/** The system calls this to perform work in the UI thread and delivers * the result from doInBackground() */
The system calls this to perform work in the UI thread and delivers
onPostExecute
{ "repo_name": "wolfogre/AndroidProgramming", "path": "WidgetBase/UiThreadSample/src/main/java/com/example/me/myapplication/MainActivity.java", "license": "mit", "size": 7395 }
[ "android.graphics.Bitmap" ]
import android.graphics.Bitmap;
import android.graphics.*;
[ "android.graphics" ]
android.graphics;
1,923,919
@Test public void getPayloadDataBuffer() { int length = 10; DataByteBuffer payload = new DataByteBuffer(ByteBuffer.allocate(length), length); RPCBlockReadResponse resp = new RPCBlockReadResponse(BLOCK_ID, OFFSET, LENGTH, payload, STATUS); assertValid(resp); Assert.assertEquals(payload, resp.getPayloadDataBuffer()); } /** * Tests the * {@link RPCBlockReadResponse#createErrorResponse(RPCBlockReadRequest, RPCResponse.Status)}
void function() { int length = 10; DataByteBuffer payload = new DataByteBuffer(ByteBuffer.allocate(length), length); RPCBlockReadResponse resp = new RPCBlockReadResponse(BLOCK_ID, OFFSET, LENGTH, payload, STATUS); assertValid(resp); Assert.assertEquals(payload, resp.getPayloadDataBuffer()); } /** * Tests the * {@link RPCBlockReadResponse#createErrorResponse(RPCBlockReadRequest, RPCResponse.Status)}
/** * Tests the {@link RPCBlockReadResponse#getPayloadDataBuffer()} method. */
Tests the <code>RPCBlockReadResponse#getPayloadDataBuffer()</code> method
getPayloadDataBuffer
{ "repo_name": "ShailShah/alluxio", "path": "core/server/worker/src/test/java/alluxio/network/protocol/RPCBlockReadResponseTest.java", "license": "apache-2.0", "size": 4592 }
[ "java.nio.ByteBuffer", "org.junit.Assert" ]
import java.nio.ByteBuffer; import org.junit.Assert;
import java.nio.*; import org.junit.*;
[ "java.nio", "org.junit" ]
java.nio; org.junit;
1,622,406
public void setVar(String var) { this.var = var; } private class ForkedTransition { private ExecutionContext executionContext; private Transition transition; }
void function(String var) { this.var = var; } private class ForkedTransition { private ExecutionContext executionContext; private Transition transition; }
/** * Set the name of the variable to which the eleements of <code>foreach</code> are assigned. * @param var the variable name to set */
Set the name of the variable to which the eleements of <code>foreach</code> are assigned
setVar
{ "repo_name": "nguyentienlong/community-edition", "path": "projects/repository/source/java/org/alfresco/repo/workflow/jbpm/ForEachFork.java", "license": "lgpl-3.0", "size": 8578 }
[ "org.jbpm.graph.def.Transition", "org.jbpm.graph.exe.ExecutionContext" ]
import org.jbpm.graph.def.Transition; import org.jbpm.graph.exe.ExecutionContext;
import org.jbpm.graph.def.*; import org.jbpm.graph.exe.*;
[ "org.jbpm.graph" ]
org.jbpm.graph;
1,800,185
protected TrimResult trimChildRestore( RelNode rel, RelNode input, ImmutableBitSet fieldsUsed, Set<RelDataTypeField> extraFields) { TrimResult trimResult = trimChild(rel, input, fieldsUsed, extraFields); if (trimResult.right.isIdentity()) { return trimResult; } final RelDataType rowType = input.getRowType(); List<RelDataTypeField> fieldList = rowType.getFieldList(); final List<RexNode> exprList = new ArrayList<RexNode>(); final List<String> nameList = rowType.getFieldNames(); RexBuilder rexBuilder = rel.getCluster().getRexBuilder(); assert trimResult.right.getSourceCount() == fieldList.size(); for (int i = 0; i < fieldList.size(); i++) { int source = trimResult.right.getTargetOpt(i); RelDataTypeField field = fieldList.get(i); exprList.add( source < 0 ? rexBuilder.makeZeroLiteral(field.getType()) : rexBuilder.makeInputRef(field.getType(), source)); } RelNode project = projectFactory.createProject( trimResult.left, exprList, nameList); return new TrimResult( project, Mappings.createIdentity(fieldList.size())); }
TrimResult function( RelNode rel, RelNode input, ImmutableBitSet fieldsUsed, Set<RelDataTypeField> extraFields) { TrimResult trimResult = trimChild(rel, input, fieldsUsed, extraFields); if (trimResult.right.isIdentity()) { return trimResult; } final RelDataType rowType = input.getRowType(); List<RelDataTypeField> fieldList = rowType.getFieldList(); final List<RexNode> exprList = new ArrayList<RexNode>(); final List<String> nameList = rowType.getFieldNames(); RexBuilder rexBuilder = rel.getCluster().getRexBuilder(); assert trimResult.right.getSourceCount() == fieldList.size(); for (int i = 0; i < fieldList.size(); i++) { int source = trimResult.right.getTargetOpt(i); RelDataTypeField field = fieldList.get(i); exprList.add( source < 0 ? rexBuilder.makeZeroLiteral(field.getType()) : rexBuilder.makeInputRef(field.getType(), source)); } RelNode project = projectFactory.createProject( trimResult.left, exprList, nameList); return new TrimResult( project, Mappings.createIdentity(fieldList.size())); }
/** * Trims a child relational expression, then adds back a dummy project to * restore the fields that were removed. * * <p>Sounds pointless? It causes unused fields to be removed * further down the tree (towards the leaves), but it ensure that the * consuming relational expression continues to see the same fields. * * @param rel Relational expression * @param input Input relational expression, whose fields to trim * @param fieldsUsed Bitmap of fields needed by the consumer * @return New relational expression and its field mapping */
Trims a child relational expression, then adds back a dummy project to restore the fields that were removed. Sounds pointless? It causes unused fields to be removed further down the tree (towards the leaves), but it ensure that the consuming relational expression continues to see the same fields
trimChildRestore
{ "repo_name": "mehant/incubator-calcite", "path": "core/src/main/java/org/apache/calcite/sql2rel/RelFieldTrimmer.java", "license": "apache-2.0", "size": 41128 }
[ "java.util.ArrayList", "java.util.List", "java.util.Set", "org.apache.calcite.rel.RelNode", "org.apache.calcite.rel.type.RelDataType", "org.apache.calcite.rel.type.RelDataTypeField", "org.apache.calcite.rex.RexBuilder", "org.apache.calcite.rex.RexNode", "org.apache.calcite.util.ImmutableBitSet", "org.apache.calcite.util.mapping.Mappings" ]
import java.util.ArrayList; import java.util.List; import java.util.Set; import org.apache.calcite.rel.RelNode; import org.apache.calcite.rel.type.RelDataType; import org.apache.calcite.rel.type.RelDataTypeField; import org.apache.calcite.rex.RexBuilder; import org.apache.calcite.rex.RexNode; import org.apache.calcite.util.ImmutableBitSet; import org.apache.calcite.util.mapping.Mappings;
import java.util.*; import org.apache.calcite.rel.*; import org.apache.calcite.rel.type.*; import org.apache.calcite.rex.*; import org.apache.calcite.util.*; import org.apache.calcite.util.mapping.*;
[ "java.util", "org.apache.calcite" ]
java.util; org.apache.calcite;
2,367,778
@Override public Boolean open() { if (!openingPort.compareAndSet(false, true)) { logger.debug("{} - opening already in progress.", this.toString()); return false; } if (logger.isDebugEnabled()) { logger.debug("{} - Opening", this.toString()); } portState.setState(PortStates.CLOSED); // clear device states devicesStates.clear(); // set initial state for configured devices devicesStates.setStateToAllConfiguredDevices(this.deviceName, DeviceStates.UNKNOWN); // reset connected state connected = false; setWaitingForAnswer(false); try { // get port ID portId = CommPortIdentifier.getPortIdentifier(this.deviceID); } catch (NoSuchPortException ex) { portState.setState(PortStates.NOT_EXIST); if (!alreadyPortNotFound) { logger.warn("{} not found", this.toString()); logger.info("Available ports: " + getCommPortListString()); alreadyPortNotFound = true; } openingPort.set(false); return false; } alreadyPortNotFound = false; if (portId != null) { // initialize serial port try { serialPort = portId.open("openHAB", 2000); } catch (PortInUseException e) { portState.setState(PortStates.NOT_AVAILABLE); logger.error("{} is in use", this.toString()); this.close(); openingPort.set(false); return false; } try { inputStream = serialPort.getInputStream(); } catch (IOException e) { logger.error("{} exception: {}", this.toString(), e.getMessage()); this.close(); openingPort.set(false); return false; } try { // get the output stream outputStream = serialPort.getOutputStream(); } catch (IOException e) { logger.error("{} exception:{}", this.toString(), e.getMessage()); this.close(); openingPort.set(false); return false; } try { serialPort.addEventListener(this); } catch (TooManyListenersException e) { logger.error("{} exception:{}", this.toString(), e.getMessage()); this.close(); openingPort.set(false); return false; } // activate the DATA_AVAILABLE notifier serialPort.notifyOnDataAvailable(true); if (this.forceRTS) { // OUTPUT_BUFFER_EMPTY serialPort.notifyOnOutputEmpty(true); } try { // set port parameters serialPort.setSerialPortParams(baud, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); serialPort.setFlowControlMode(SerialPort.FLOWCONTROL_NONE); } catch (UnsupportedCommOperationException e) { logger.error("{} exception: {}", this.toString(), e.getMessage()); this.close(); openingPort.set(false); return false; } } if (logger.isDebugEnabled()) { logger.debug("{} - opened", this.toString()); } portState.setState(PortStates.LISTENING); connected = true; openingPort.set(false); return true; }
Boolean function() { if (!openingPort.compareAndSet(false, true)) { logger.debug(STR, this.toString()); return false; } if (logger.isDebugEnabled()) { logger.debug(STR, this.toString()); } portState.setState(PortStates.CLOSED); devicesStates.clear(); devicesStates.setStateToAllConfiguredDevices(this.deviceName, DeviceStates.UNKNOWN); connected = false; setWaitingForAnswer(false); try { portId = CommPortIdentifier.getPortIdentifier(this.deviceID); } catch (NoSuchPortException ex) { portState.setState(PortStates.NOT_EXIST); if (!alreadyPortNotFound) { logger.warn(STR, this.toString()); logger.info(STR + getCommPortListString()); alreadyPortNotFound = true; } openingPort.set(false); return false; } alreadyPortNotFound = false; if (portId != null) { try { serialPort = portId.open(STR, 2000); } catch (PortInUseException e) { portState.setState(PortStates.NOT_AVAILABLE); logger.error(STR, this.toString()); this.close(); openingPort.set(false); return false; } try { inputStream = serialPort.getInputStream(); } catch (IOException e) { logger.error(STR, this.toString(), e.getMessage()); this.close(); openingPort.set(false); return false; } try { outputStream = serialPort.getOutputStream(); } catch (IOException e) { logger.error(STR, this.toString(), e.getMessage()); this.close(); openingPort.set(false); return false; } try { serialPort.addEventListener(this); } catch (TooManyListenersException e) { logger.error(STR, this.toString(), e.getMessage()); this.close(); openingPort.set(false); return false; } serialPort.notifyOnDataAvailable(true); if (this.forceRTS) { serialPort.notifyOnOutputEmpty(true); } try { serialPort.setSerialPortParams(baud, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); serialPort.setFlowControlMode(SerialPort.FLOWCONTROL_NONE); } catch (UnsupportedCommOperationException e) { logger.error(STR, this.toString(), e.getMessage()); this.close(); openingPort.set(false); return false; } } if (logger.isDebugEnabled()) { logger.debug(STR, this.toString()); } portState.setState(PortStates.LISTENING); connected = true; openingPort.set(false); return true; }
/** * Open serial port * * @see org.openhab.binding.simplebinary.internal.SimpleBinaryIDevice#open() */
Open serial port
open
{ "repo_name": "docbender/openhab", "path": "bundles/binding/org.openhab.binding.simplebinary/src/main/java/org/openhab/binding/simplebinary/internal/SimpleBinaryUART.java", "license": "epl-1.0", "size": 21076 }
[ "gnu.io.CommPortIdentifier", "gnu.io.NoSuchPortException", "gnu.io.PortInUseException", "gnu.io.SerialPort", "gnu.io.UnsupportedCommOperationException", "java.io.IOException", "java.util.TooManyListenersException", "org.openhab.binding.simplebinary.internal.SimpleBinaryDeviceState", "org.openhab.binding.simplebinary.internal.SimpleBinaryPortState" ]
import gnu.io.CommPortIdentifier; import gnu.io.NoSuchPortException; import gnu.io.PortInUseException; import gnu.io.SerialPort; import gnu.io.UnsupportedCommOperationException; import java.io.IOException; import java.util.TooManyListenersException; import org.openhab.binding.simplebinary.internal.SimpleBinaryDeviceState; import org.openhab.binding.simplebinary.internal.SimpleBinaryPortState;
import gnu.io.*; import java.io.*; import java.util.*; import org.openhab.binding.simplebinary.internal.*;
[ "gnu.io", "java.io", "java.util", "org.openhab.binding" ]
gnu.io; java.io; java.util; org.openhab.binding;
1,798,611
public static java.util.Date addDatePart(java.util.Date d, int field, int amount ) { Calendar defCalendar = new GregorianCalendar(); defCalendar.setTime(d); defCalendar.add(field, amount); d = defCalendar.getTime(); return d; }
static java.util.Date function(java.util.Date d, int field, int amount ) { Calendar defCalendar = new GregorianCalendar(); defCalendar.setTime(d); defCalendar.add(field, amount); d = defCalendar.getTime(); return d; }
/** * adds a date part to the date, equivalent to Calendar.add() * @see java.text.Calendar */
adds a date part to the date, equivalent to Calendar.add()
addDatePart
{ "repo_name": "PaesslerAG/JMXMiniProbe", "path": "src/com/paessler/prtg/util/DateUtility.java", "license": "bsd-3-clause", "size": 66185 }
[ "java.util.Calendar", "java.util.Date", "java.util.GregorianCalendar" ]
import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar;
import java.util.*;
[ "java.util" ]
java.util;
1,307,107
public void setFormat(CodedValue format) { this.format = format; }
void function(CodedValue format) { this.format = format; }
/** * Method description * * * @param format */
Method description
setFormat
{ "repo_name": "kef/hieos", "path": "src/xdsbridge/src/main/java/com/vangent/hieos/services/xds/bridge/model/Document.java", "license": "apache-2.0", "size": 6002 }
[ "com.vangent.hieos.subjectmodel.CodedValue" ]
import com.vangent.hieos.subjectmodel.CodedValue;
import com.vangent.hieos.subjectmodel.*;
[ "com.vangent.hieos" ]
com.vangent.hieos;
2,702,132
public int getLevel() { return level; } } private static final String QUEST_SLOT = "pizza_delivery"; private static Map<String, CustomerData> customerDB;
int function() { return level; } } private static final String QUEST_SLOT = STR; private static Map<String, CustomerData> customerDB;
/** * Get the minimum level needed for the NPC * * @return minimum level */
Get the minimum level needed for the NPC
getLevel
{ "repo_name": "sourceress-project/archestica", "path": "src/games/stendhal/server/maps/quests/PizzaDelivery.java", "license": "gpl-2.0", "size": 23890 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
2,310,713
@Override public boolean onOptionsItemSelected(MenuItem menuItem) { Log.d(TAG, "Action bar overflow menu item selected."); super.onOptionsItemSelected(menuItem); switch(menuItem.getItemId()) { case R.id.action_go_to_list: goToList(); return true; case R.id.action_go_to_layout: goToLayout(); return true; case R.id.action_sign_out: signOut(); return true; default: String error = "Invalid menu action!"; Log.e(TAG, error); toast(error); return false; } } // --------------------------------------------------------------------------------// // Protected Methods // // --------------------------------------------------------------------------------//
boolean function(MenuItem menuItem) { Log.d(TAG, STR); super.onOptionsItemSelected(menuItem); switch(menuItem.getItemId()) { case R.id.action_go_to_list: goToList(); return true; case R.id.action_go_to_layout: goToLayout(); return true; case R.id.action_sign_out: signOut(); return true; default: String error = STR; Log.e(TAG, error); toast(error); return false; } }
/** * Handles which action to take based on what menu item was selected. * * @param menuItem The menu item selected by the user. * @return true if the event was handled as expected, false otherwise. */
Handles which action to take based on what menu item was selected
onOptionsItemSelected
{ "repo_name": "Jenuma/bias", "path": "bias/src/main/java/io/whitegoldlabs/bias/views/BaseActivity.java", "license": "gpl-3.0", "size": 10222 }
[ "android.util.Log", "android.view.MenuItem" ]
import android.util.Log; import android.view.MenuItem;
import android.util.*; import android.view.*;
[ "android.util", "android.view" ]
android.util; android.view;
257,054
public TestContext getTextContext(String... kvs) { assert kvs.length % 2 == 0; Map<String, String> env = new HashMap<>(System.getenv()); env.put("ASAKUSA_HOME", folder.getRoot().getAbsolutePath()); Map<String, String> args = new HashMap<>(); for (int i = 0; i < kvs.length; i += 2) { args.put(kvs[i], kvs[i + 1]); } return new TestContext() {
TestContext function(String... kvs) { assert kvs.length % 2 == 0; Map<String, String> env = new HashMap<>(System.getenv()); env.put(STR, folder.getRoot().getAbsolutePath()); Map<String, String> args = new HashMap<>(); for (int i = 0; i < kvs.length; i += 2) { args.put(kvs[i], kvs[i + 1]); } return new TestContext() {
/** * Creates a test context. * @param kvs key and value pairs * @return the created context */
Creates a test context
getTextContext
{ "repo_name": "asakusafw/asakusafw", "path": "directio-project/asakusa-directio-test-moderator/src/test/java/com/asakusafw/testdriver/directio/ProfileContext.java", "license": "apache-2.0", "size": 4537 }
[ "com.asakusafw.testdriver.core.TestContext", "java.util.HashMap", "java.util.Map" ]
import com.asakusafw.testdriver.core.TestContext; import java.util.HashMap; import java.util.Map;
import com.asakusafw.testdriver.core.*; import java.util.*;
[ "com.asakusafw.testdriver", "java.util" ]
com.asakusafw.testdriver; java.util;
1,956,409
public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) { if (DEBUG) Log.i(TAG, String.format("surfaceChanged() fmt=%d size=%dx%d", format, w, h)); mWidth = w; mHeight = h; if (mActivity.getRequestedOrientation() == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE && mWidth < mHeight) { return; } if (mActivity.getRequestedOrientation() == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT && mWidth > mHeight) { return; } if (!mRunning) { mRunning = true; new Thread(this).start(); } else { mChanged = true; if (mStarted) { nativeExpose(); } } }
void function(SurfaceHolder holder, int format, int w, int h) { if (DEBUG) Log.i(TAG, String.format(STR, format, w, h)); mWidth = w; mHeight = h; if (mActivity.getRequestedOrientation() == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE && mWidth < mHeight) { return; } if (mActivity.getRequestedOrientation() == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT && mWidth > mHeight) { return; } if (!mRunning) { mRunning = true; new Thread(this).start(); } else { mChanged = true; if (mStarted) { nativeExpose(); } } }
/** * This method is part of the SurfaceHolder.Callback interface, and is * not normally called or subclassed by clients of GLSurfaceView. */
This method is part of the SurfaceHolder.Callback interface, and is not normally called or subclassed by clients of GLSurfaceView
surfaceChanged
{ "repo_name": "renpytom/python-for-android", "path": "src/src/org/renpy/android/SDLSurfaceView.java", "license": "lgpl-2.1", "size": 52082 }
[ "android.content.pm.ActivityInfo", "android.util.Log", "android.view.SurfaceHolder" ]
import android.content.pm.ActivityInfo; import android.util.Log; import android.view.SurfaceHolder;
import android.content.pm.*; import android.util.*; import android.view.*;
[ "android.content", "android.util", "android.view" ]
android.content; android.util; android.view;
403,219
public boolean hasGestPreisDiff(int nummer) { if (!isCalculated) throw new IllegalStateException("Recalc ist notwendig"); boolean bDiff = false; ArrayList<ArtikelStatistik> aas = aaslager.get(nummer); Iterator<ArtikelStatistik> it = aas.iterator(); while (it.hasNext()) { if (it.next().isChanged()) { bDiff = true; break; } } return bDiff; }
boolean function(int nummer) { if (!isCalculated) throw new IllegalStateException(STR); boolean bDiff = false; ArrayList<ArtikelStatistik> aas = aaslager.get(nummer); Iterator<ArtikelStatistik> it = aas.iterator(); while (it.hasNext()) { if (it.next().isChanged()) { bDiff = true; break; } } return bDiff; }
/** * &UUml;berpr&uuml;fung ob einer der Gestehungspreise f&uuml;r ein Lager falsch ist * * @param nummer * Nummer des Lagers in den Daten (Achtung: nicht die IId) * @return true bei Fehler */
&UUml;berpr&uuml;fung ob einer der Gestehungspreise f&uuml;r ein Lager falsch ist
hasGestPreisDiff
{ "repo_name": "erdincay/ejb", "path": "src/com/lp/server/artikel/service/ArtikelGestehungspreisCalc.java", "license": "agpl-3.0", "size": 27368 }
[ "java.util.ArrayList", "java.util.Iterator" ]
import java.util.ArrayList; import java.util.Iterator;
import java.util.*;
[ "java.util" ]
java.util;
2,166,297
public void enforce(OptionsParser parser, @Nullable String command) throws OptionsParsingException { if (invocationPolicy == null || invocationPolicy.getFlagPoliciesCount() == 0) { return; } // The effective policy returned is expanded, filtered for applicable commands, and cleaned of // redundancies and conflicts. List<FlagPolicyWithContext> effectivePolicies = getEffectivePolicies(invocationPolicy, parser, command, loglevel); for (FlagPolicyWithContext flagPolicy : effectivePolicies) { String flagName = flagPolicy.policy.getFlagName(); OptionValueDescription valueDescription; try { valueDescription = parser.getOptionValueDescription(flagName); } catch (IllegalArgumentException e) { // This flag doesn't exist. We are deliberately lenient if the flag policy has a flag // we don't know about. This is for better future proofing so that as new flags are added, // new policies can use the new flags without worrying about older versions of Bazel. logger.at(loglevel).log( "Flag '%s' specified by invocation policy does not exist", flagName); continue; } // getOptionDescription() will return null if the option does not exist, however // getOptionValueDescription() above would have thrown an IllegalArgumentException if that // were the case. Verify.verifyNotNull(flagPolicy.description); switch (flagPolicy.policy.getOperationCase()) { case SET_VALUE: applySetValueOperation(parser, flagPolicy, valueDescription, loglevel); break; case USE_DEFAULT: applyUseDefaultOperation( parser, "UseDefault", flagPolicy.description.getOptionDefinition(), loglevel); break; case ALLOW_VALUES: AllowValues allowValues = flagPolicy.policy.getAllowValues(); FilterValueOperation.AllowValueOperation allowValueOperation = new FilterValueOperation.AllowValueOperation(loglevel); allowValueOperation.apply( parser, flagPolicy.origin, allowValues.getAllowedValuesList(), allowValues.hasNewValue() ? allowValues.getNewValue() : null, allowValues.hasUseDefault(), valueDescription, flagPolicy.description); break; case DISALLOW_VALUES: DisallowValues disallowValues = flagPolicy.policy.getDisallowValues(); FilterValueOperation.DisallowValueOperation disallowValueOperation = new FilterValueOperation.DisallowValueOperation(loglevel); disallowValueOperation.apply( parser, flagPolicy.origin, disallowValues.getDisallowedValuesList(), disallowValues.hasNewValue() ? disallowValues.getNewValue() : null, disallowValues.hasUseDefault(), valueDescription, flagPolicy.description); break; case OPERATION_NOT_SET: throw new PolicyOperationNotSetException(flagName); default: logger.atWarning().log( "Unknown operation '%s' from invocation policy for flag '%s'", flagPolicy.policy.getOperationCase(), flagName); break; } } } private static class PolicyOperationNotSetException extends OptionsParsingException { PolicyOperationNotSetException(String flagName) { super(String.format("Flag policy for flag '%s' does not " + "have an operation", flagName)); } }
void function(OptionsParser parser, @Nullable String command) throws OptionsParsingException { if (invocationPolicy == null invocationPolicy.getFlagPoliciesCount() == 0) { return; } List<FlagPolicyWithContext> effectivePolicies = getEffectivePolicies(invocationPolicy, parser, command, loglevel); for (FlagPolicyWithContext flagPolicy : effectivePolicies) { String flagName = flagPolicy.policy.getFlagName(); OptionValueDescription valueDescription; try { valueDescription = parser.getOptionValueDescription(flagName); } catch (IllegalArgumentException e) { logger.at(loglevel).log( STR, flagName); continue; } Verify.verifyNotNull(flagPolicy.description); switch (flagPolicy.policy.getOperationCase()) { case SET_VALUE: applySetValueOperation(parser, flagPolicy, valueDescription, loglevel); break; case USE_DEFAULT: applyUseDefaultOperation( parser, STR, flagPolicy.description.getOptionDefinition(), loglevel); break; case ALLOW_VALUES: AllowValues allowValues = flagPolicy.policy.getAllowValues(); FilterValueOperation.AllowValueOperation allowValueOperation = new FilterValueOperation.AllowValueOperation(loglevel); allowValueOperation.apply( parser, flagPolicy.origin, allowValues.getAllowedValuesList(), allowValues.hasNewValue() ? allowValues.getNewValue() : null, allowValues.hasUseDefault(), valueDescription, flagPolicy.description); break; case DISALLOW_VALUES: DisallowValues disallowValues = flagPolicy.policy.getDisallowValues(); FilterValueOperation.DisallowValueOperation disallowValueOperation = new FilterValueOperation.DisallowValueOperation(loglevel); disallowValueOperation.apply( parser, flagPolicy.origin, disallowValues.getDisallowedValuesList(), disallowValues.hasNewValue() ? disallowValues.getNewValue() : null, disallowValues.hasUseDefault(), valueDescription, flagPolicy.description); break; case OPERATION_NOT_SET: throw new PolicyOperationNotSetException(flagName); default: logger.atWarning().log( STR, flagPolicy.policy.getOperationCase(), flagName); break; } } } private static class PolicyOperationNotSetException extends OptionsParsingException { PolicyOperationNotSetException(String flagName) { super(String.format(STR + STR, flagName)); } }
/** * Applies this OptionsPolicyEnforcer's policy to the given OptionsParser. * * @param parser The OptionsParser to enforce policy on. * @param command The current blaze command, for flag policies that apply to only specific * commands. Such policies will be enforced only if they contain this command or a command * they inherit from * @throws OptionsParsingException if any flag policy is invalid. */
Applies this OptionsPolicyEnforcer's policy to the given OptionsParser
enforce
{ "repo_name": "perezd/bazel", "path": "src/main/java/com/google/devtools/common/options/InvocationPolicyEnforcer.java", "license": "apache-2.0", "size": 37612 }
[ "com.google.common.base.Verify", "com.google.devtools.build.lib.runtime.proto.InvocationPolicyOuterClass", "java.util.List", "javax.annotation.Nullable" ]
import com.google.common.base.Verify; import com.google.devtools.build.lib.runtime.proto.InvocationPolicyOuterClass; import java.util.List; import javax.annotation.Nullable;
import com.google.common.base.*; import com.google.devtools.build.lib.runtime.proto.*; import java.util.*; import javax.annotation.*;
[ "com.google.common", "com.google.devtools", "java.util", "javax.annotation" ]
com.google.common; com.google.devtools; java.util; javax.annotation;
2,091,567
public WorkflowScheme findSchemeByName(String schemaName) throws DotDataException;
WorkflowScheme function(String schemaName) throws DotDataException;
/** * finds the schema with the specified name. * * @param schemaName * @return the schema with the specified name. null if it doesn't exists */
finds the schema with the specified name
findSchemeByName
{ "repo_name": "dotCMS/core", "path": "dotCMS/src/main/java/com/dotmarketing/portlets/workflows/business/WorkflowAPI.java", "license": "gpl-3.0", "size": 45694 }
[ "com.dotmarketing.exception.DotDataException", "com.dotmarketing.portlets.workflows.model.WorkflowScheme" ]
import com.dotmarketing.exception.DotDataException; import com.dotmarketing.portlets.workflows.model.WorkflowScheme;
import com.dotmarketing.exception.*; import com.dotmarketing.portlets.workflows.model.*;
[ "com.dotmarketing.exception", "com.dotmarketing.portlets" ]
com.dotmarketing.exception; com.dotmarketing.portlets;
964,766
public ReadWriteLock getLockForFile(final File toLock) { return this.lockProvider.getLock(toLock); }
ReadWriteLock function(final File toLock) { return this.lockProvider.getLock(toLock); }
/** * Get a {@link java.util.concurrent.locks.ReadWriteLock} which is unique to the given file. This method will always * return the same lock for the path on the filesystem even if the {@link java.io.File} object is different. * * @param toLock the file to get a lock for. * @return a lock for the given file. */
Get a <code>java.util.concurrent.locks.ReadWriteLock</code> which is unique to the given file. This method will always return the same lock for the path on the filesystem even if the <code>java.io.File</code> object is different
getLockForFile
{ "repo_name": "xwiki/xwiki-platform", "path": "xwiki-platform-core/xwiki-platform-store/xwiki-platform-store-filesystem-oldcore/src/main/java/org/xwiki/store/filesystem/internal/FilesystemStoreTools.java", "license": "lgpl-2.1", "size": 15713 }
[ "java.io.File", "java.util.concurrent.locks.ReadWriteLock" ]
import java.io.File; import java.util.concurrent.locks.ReadWriteLock;
import java.io.*; import java.util.concurrent.locks.*;
[ "java.io", "java.util" ]
java.io; java.util;
466,882
InitialGuess calcAllInitValues(double[] initParameters) { double[] init = new double[n+PARAMETERS]; for (int i = 0; i < initParameters.length; i++) { init[i] = initParameters[i]; } final double a = initParameters[0]; final double b = initParameters[1]; final double alpha = initParameters[2]; final double x = initParameters[3]; final double y = initParameters[4]; final double twopi = 2*Math.PI; angleDerivative.setRadii(a, b); angleDerivative.setAngle(alpha); // work out the angle values for the closest points on ellipse final IndexIterator itx = X.getIterator(); final IndexIterator ity = Y.getIterator(); int i = PARAMETERS; while (itx.hasNext() && ity.hasNext()) { final double Xc = X.getElementDoubleAbs(itx.index) - x; final double Yc = Y.getElementDoubleAbs(ity.index) - y; angleDerivative.setCoordinate(Xc, Yc); try { // find quadrant to use double pa = Math.atan2(Yc, Xc); if (pa < 0) pa += twopi; pa -= alpha; final double end; final double halfpi = 0.5*Math.PI; pa /= halfpi; end = Math.ceil(pa)*halfpi; final double angle = solver.solve(100, angleDerivative, end-halfpi, end); init[i++] = angle; } catch (TooManyEvaluationsException e) { throw new IllegalArgumentException("Problem with solver converging as iterations exceed limit"); } catch (MathIllegalArgumentException e) { // cannot happen } } return new InitialGuess(init); }
InitialGuess calcAllInitValues(double[] initParameters) { double[] init = new double[n+PARAMETERS]; for (int i = 0; i < initParameters.length; i++) { init[i] = initParameters[i]; } final double a = initParameters[0]; final double b = initParameters[1]; final double alpha = initParameters[2]; final double x = initParameters[3]; final double y = initParameters[4]; final double twopi = 2*Math.PI; angleDerivative.setRadii(a, b); angleDerivative.setAngle(alpha); final IndexIterator itx = X.getIterator(); final IndexIterator ity = Y.getIterator(); int i = PARAMETERS; while (itx.hasNext() && ity.hasNext()) { final double Xc = X.getElementDoubleAbs(itx.index) - x; final double Yc = Y.getElementDoubleAbs(ity.index) - y; angleDerivative.setCoordinate(Xc, Yc); try { double pa = Math.atan2(Yc, Xc); if (pa < 0) pa += twopi; pa -= alpha; final double end; final double halfpi = 0.5*Math.PI; pa /= halfpi; end = Math.ceil(pa)*halfpi; final double angle = solver.solve(100, angleDerivative, end-halfpi, end); init[i++] = angle; } catch (TooManyEvaluationsException e) { throw new IllegalArgumentException(STR); } catch (MathIllegalArgumentException e) { } } return new InitialGuess(init); }
/** * Calculate angles of closest points on ellipse to targets * @param initParameters geometric parameters * @return array of all initial parameters */
Calculate angles of closest points on ellipse to targets
calcAllInitValues
{ "repo_name": "colinpalmer/dawnsci", "path": "org.eclipse.dawnsci.analysis.dataset/src/org/eclipse/dawnsci/analysis/dataset/roi/fitting/EllipseFitter.java", "license": "epl-1.0", "size": 16323 }
[ "org.apache.commons.math3.exception.MathIllegalArgumentException", "org.apache.commons.math3.exception.TooManyEvaluationsException", "org.apache.commons.math3.optim.InitialGuess", "org.eclipse.dawnsci.analysis.dataset.impl.IndexIterator" ]
import org.apache.commons.math3.exception.MathIllegalArgumentException; import org.apache.commons.math3.exception.TooManyEvaluationsException; import org.apache.commons.math3.optim.InitialGuess; import org.eclipse.dawnsci.analysis.dataset.impl.IndexIterator;
import org.apache.commons.math3.exception.*; import org.apache.commons.math3.optim.*; import org.eclipse.dawnsci.analysis.dataset.impl.*;
[ "org.apache.commons", "org.eclipse.dawnsci" ]
org.apache.commons; org.eclipse.dawnsci;
1,655,243
public void run() throws Exception { config = getConfig(); for (int i = 0; i < t_cases.length; i++) { logger.log(Level.FINE, "\n\t+++++ TestCase #" + (i + (int) 1)); t_cases[i].callMethod(); } //PASS return; }
void function() throws Exception { config = getConfig(); for (int i = 0; i < t_cases.length; i++) { logger.log(Level.FINE, STR + (i + (int) 1)); t_cases[i].callMethod(); } return; }
/** * This method runs all Test Cases specified in the class description. */
This method runs all Test Cases specified in the class description
run
{ "repo_name": "cdegroot/river", "path": "qa/src/com/sun/jini/test/spec/constraint/coreconstraint/GetTimeTest.java", "license": "apache-2.0", "size": 12452 }
[ "java.util.logging.Level" ]
import java.util.logging.Level;
import java.util.logging.*;
[ "java.util" ]
java.util;
40,633
protected static void createFile(IgfsImpl igfs, IgfsPath file, boolean overwrite, long blockSize, @Nullable byte[]... chunks) throws Exception { IgfsOutputStream os = null; try { os = igfs.create(file, 256, overwrite, null, 0, blockSize, null); writeFileChunks(os, chunks); } finally { U.closeQuiet(os); awaitFileClose(igfs.asSecondary(), file); } }
static void function(IgfsImpl igfs, IgfsPath file, boolean overwrite, long blockSize, @Nullable byte[]... chunks) throws Exception { IgfsOutputStream os = null; try { os = igfs.create(file, 256, overwrite, null, 0, blockSize, null); writeFileChunks(os, chunks); } finally { U.closeQuiet(os); awaitFileClose(igfs.asSecondary(), file); } }
/** * Create the file in the given IGFS and write provided data chunks to it. * * @param igfs IGFS. * @param file File. * @param overwrite Overwrite flag. * @param blockSize Block size. * @param chunks Data chunks. * @throws Exception If failed. */
Create the file in the given IGFS and write provided data chunks to it
createFile
{ "repo_name": "zzcclp/ignite", "path": "modules/core/src/test/java/org/apache/ignite/internal/processors/igfs/IgfsAbstractSelfTest.java", "license": "apache-2.0", "size": 87306 }
[ "org.apache.ignite.igfs.IgfsOutputStream", "org.apache.ignite.igfs.IgfsPath", "org.apache.ignite.internal.util.typedef.internal.U", "org.jetbrains.annotations.Nullable" ]
import org.apache.ignite.igfs.IgfsOutputStream; import org.apache.ignite.igfs.IgfsPath; import org.apache.ignite.internal.util.typedef.internal.U; import org.jetbrains.annotations.Nullable;
import org.apache.ignite.igfs.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.jetbrains.annotations.*;
[ "org.apache.ignite", "org.jetbrains.annotations" ]
org.apache.ignite; org.jetbrains.annotations;
1,825,646
public static String flattenTree(Tree t) { t = t.prune(emptyFilter, tf); String flatString = SentenceUtils.listToString(t.yield()); return flatString; }
static String function(Tree t) { t = t.prune(emptyFilter, tf); String flatString = SentenceUtils.listToString(t.yield()); return flatString; }
/** * Returns the string associated with the input parse tree. Traces and * ATB-specific escape sequences (e.g., "-RRB-" for ")") are removed. * * @param t - A parse tree * @return The yield of the input parse tree */
Returns the string associated with the input parse tree. Traces and ATB-specific escape sequences (e.g., "-RRB-" for ")") are removed
flattenTree
{ "repo_name": "intfloat/CoreNLP", "path": "src/edu/stanford/nlp/trees/international/arabic/ATBTreeUtils.java", "license": "gpl-2.0", "size": 3772 }
[ "edu.stanford.nlp.ling.SentenceUtils", "edu.stanford.nlp.trees.Tree" ]
import edu.stanford.nlp.ling.SentenceUtils; import edu.stanford.nlp.trees.Tree;
import edu.stanford.nlp.ling.*; import edu.stanford.nlp.trees.*;
[ "edu.stanford.nlp" ]
edu.stanford.nlp;
493,289
this.sortOrder = sortOrder == null ? "" : sortOrder; return this; } /** * Compares two objects by this instance's sort order. * <p> * Splits the sort order on {@code ,} and tries to sort by each of the supplied fields. * The strings obtained after splitting must be valid keys for {@code enumType} (or valid keys * prefixed with a hyphen {@code -} for descending order), otherwise the sorting fails and a * {@link PaginationException} is thrown with {@link ErrorCode#SORT_KEY_UNPROCESSABLE}. * <p> * The comparison in general follows {@link java.util.Comparator#compare(Object, Object)}, * where depending on how the comparison logic is implemented by the passed * {@code enumType} of type {@link PaginationComparatorProperty}. * <p> * This method returns either -1, 0, or 1: * <dl> * <dt>-1</dt> * <dd>If the right object should appear after the left object.</dd> * <dt>0</dt> * <dd>If the order of the two given object is unimportant, that means for * the given sort order they are considered to be equal. This is the default.</dd> * <dt>1</dt> * <dd>If the left object should appear after the right object.</dd> * </dl> * <p> * If one objects value for a sort key is null, it will always be sorted after the other object. * See {@link #compareNull(Object, Object, boolean)} for more details on this. * Additionally if the first key in the sort order suffices, the comparison follows the fail-fast * principle and returns the value. Otherwise it sorts as long as needed to break the tie between * the two objects. * <p> * For information on how to implement the {@code enumType}, take a look at the examples at * {@link PaginationComparator} or {@link PaginationComparatorProperty}. * * @param left left object * @param right right object * @param enumType an enum implementing {@link PaginationComparatorProperty} * @param <V> The enum type implementing {@link PaginationComparatorProperty}
this.sortOrder = sortOrder == null ? "" : sortOrder; return this; } /** * Compares two objects by this instance's sort order. * <p> * Splits the sort order on {@code ,} and tries to sort by each of the supplied fields. * The strings obtained after splitting must be valid keys for {@code enumType} (or valid keys * prefixed with a hyphen {@code -} for descending order), otherwise the sorting fails and a * {@link PaginationException} is thrown with {@link ErrorCode#SORT_KEY_UNPROCESSABLE}. * <p> * The comparison in general follows {@link java.util.Comparator#compare(Object, Object)}, * where depending on how the comparison logic is implemented by the passed * {@code enumType} of type {@link PaginationComparatorProperty}. * <p> * This method returns either -1, 0, or 1: * <dl> * <dt>-1</dt> * <dd>If the right object should appear after the left object.</dd> * <dt>0</dt> * <dd>If the order of the two given object is unimportant, that means for * the given sort order they are considered to be equal. This is the default.</dd> * <dt>1</dt> * <dd>If the left object should appear after the right object.</dd> * </dl> * <p> * If one objects value for a sort key is null, it will always be sorted after the other object. * See {@link #compareNull(Object, Object, boolean)} for more details on this. * Additionally if the first key in the sort order suffices, the comparison follows the fail-fast * principle and returns the value. Otherwise it sorts as long as needed to break the tie between * the two objects. * <p> * For information on how to implement the {@code enumType}, take a look at the examples at * {@link PaginationComparator} or {@link PaginationComparatorProperty}. * * @param left left object * @param right right object * @param enumType an enum implementing {@link PaginationComparatorProperty} * @param <V> The enum type implementing {@link PaginationComparatorProperty}
/** * Sets the sort order and returns the comparator so that it can be used * in {@link java.util.stream.Stream#sorted(Comparator)} calls: * <pre>{@code stream().sorted(this.setSortorder(newsort))}</pre> * * If {@code sortOrder} is {@code null}, it is reset to the empty string. * * @param sortOrder a new sort order * @return this */
Sets the sort order and returns the comparator so that it can be used in <code>java.util.stream.Stream#sorted(Comparator)</code> calls: <code>stream().sorted(this.setSortorder(newsort))</code> If sortOrder is null, it is reset to the empty string
replaceSortorder
{ "repo_name": "intuit/wasabi", "path": "modules/api/src/main/java/com/intuit/wasabi/api/pagination/comparators/PaginationComparator.java", "license": "apache-2.0", "size": 12339 }
[ "com.intuit.wasabi.exceptions.PaginationException", "com.intuit.wasabi.experimentobjects.exceptions.ErrorCode", "java.util.Comparator" ]
import com.intuit.wasabi.exceptions.PaginationException; import com.intuit.wasabi.experimentobjects.exceptions.ErrorCode; import java.util.Comparator;
import com.intuit.wasabi.exceptions.*; import com.intuit.wasabi.experimentobjects.exceptions.*; import java.util.*;
[ "com.intuit.wasabi", "java.util" ]
com.intuit.wasabi; java.util;
1,085,217
public ThermostatSocket getThermostatSocket(ThermostatProfile thermostat) { Map<Technology, ThermostatServerIdentifier> idMap = thermostat.getServerIdentifiers(); String fingerprint = thermostat.getFingerprint(); // Try WiFi IP if (availableTechnologies.contains(Technology.WiFi_IP)) { Log.d(TAG, "WiFi is available, trying to create IP socket..."); ServerIdentifierIP id = (ServerIdentifierIP)idMap.get(Technology.WiFi_IP); if (id != null) { try { ThermostatSocket socket = getWifiSocket(id, fingerprint); if (socket != null) { return socket; } } catch (Exception e) { Log.e(TAG, "Error when creating WiFi socket to " + fingerprint, e); } } else { Log.d(TAG, "IP addresses are not available for thermostat " + fingerprint); } } // Try Bluetooth RFCOMM if (availableTechnologies.contains(Technology.BLUETOOTH_RFCOMM)) { Log.d(TAG, "Bluetooth is available, trying to create RFCOMM socket..."); ServerIdentifierBluetooth id = (ServerIdentifierBluetooth)idMap.get(Technology.BLUETOOTH_RFCOMM); if (id != null) { BluetoothDevice device = bluetoothAdapter.getRemoteDevice(id.getBluetoothAddress()); try { return new ThermostatSocketBluetooth(device); } catch (Exception e) { Log.e(TAG, "Error when creating Bluetooth socket to " + fingerprint, e); } } else { Log.d(TAG, "IP addresses are not available for thermostat " + fingerprint); } } return null; }
ThermostatSocket function(ThermostatProfile thermostat) { Map<Technology, ThermostatServerIdentifier> idMap = thermostat.getServerIdentifiers(); String fingerprint = thermostat.getFingerprint(); if (availableTechnologies.contains(Technology.WiFi_IP)) { Log.d(TAG, STR); ServerIdentifierIP id = (ServerIdentifierIP)idMap.get(Technology.WiFi_IP); if (id != null) { try { ThermostatSocket socket = getWifiSocket(id, fingerprint); if (socket != null) { return socket; } } catch (Exception e) { Log.e(TAG, STR + fingerprint, e); } } else { Log.d(TAG, STR + fingerprint); } } if (availableTechnologies.contains(Technology.BLUETOOTH_RFCOMM)) { Log.d(TAG, STR); ServerIdentifierBluetooth id = (ServerIdentifierBluetooth)idMap.get(Technology.BLUETOOTH_RFCOMM); if (id != null) { BluetoothDevice device = bluetoothAdapter.getRemoteDevice(id.getBluetoothAddress()); try { return new ThermostatSocketBluetooth(device); } catch (Exception e) { Log.e(TAG, STR + fingerprint, e); } } else { Log.d(TAG, STR + fingerprint); } } return null; }
/** * Creates a thermostat socket using the following priority order for available technologies: * 1) WiFi IPv6 * 2) WiFi IPv4 * 3) Bluetooth RFCOMM * * @param thermostat to be connected via the socket * @return the socket to the thermostat or null if there are no available communication technologies */
Creates a thermostat socket using the following priority order for available technologies: 1) WiFi IPv6 2) WiFi IPv4 3) Bluetooth RFCOMM
getThermostatSocket
{ "repo_name": "peterkersch/smartphone-thermostat", "path": "client/src/com/blackbird/thermostat/technology/TechnologySelector.java", "license": "apache-2.0", "size": 10908 }
[ "android.bluetooth.BluetoothDevice", "android.util.Log", "com.blackbird.thermostat.protocol.ThermostatServerIdentifier", "com.blackbird.thermostat.store.ThermostatProfile", "com.thermostat.protocol.ThermostatSocket", "com.thermostat.technology.Technology", "java.util.Map" ]
import android.bluetooth.BluetoothDevice; import android.util.Log; import com.blackbird.thermostat.protocol.ThermostatServerIdentifier; import com.blackbird.thermostat.store.ThermostatProfile; import com.thermostat.protocol.ThermostatSocket; import com.thermostat.technology.Technology; import java.util.Map;
import android.bluetooth.*; import android.util.*; import com.blackbird.thermostat.protocol.*; import com.blackbird.thermostat.store.*; import com.thermostat.protocol.*; import com.thermostat.technology.*; import java.util.*;
[ "android.bluetooth", "android.util", "com.blackbird.thermostat", "com.thermostat.protocol", "com.thermostat.technology", "java.util" ]
android.bluetooth; android.util; com.blackbird.thermostat; com.thermostat.protocol; com.thermostat.technology; java.util;
1,924,719
protected void setComponentsSize() { // ComponentSizeAdjuster.adjustComponentsWidth(appendButton, compareButton); ComponentSizeAdjuster.adjustComponentsHeight(appendButton, compareButton, depthComboBox, heightComboBox, depthHeightSeparator); }
void function() { ComponentSizeAdjuster.adjustComponentsHeight(appendButton, compareButton, depthComboBox, heightComboBox, depthHeightSeparator); }
/** * Sets size of GUI components. */
Sets size of GUI components
setComponentsSize
{ "repo_name": "nomencurator/taxonaut", "path": "src/main/java/org/nomencurator/gui/swing/NameListPane.java", "license": "apache-2.0", "size": 16156 }
[ "org.nomencurator.gui.ComponentSizeAdjuster" ]
import org.nomencurator.gui.ComponentSizeAdjuster;
import org.nomencurator.gui.*;
[ "org.nomencurator.gui" ]
org.nomencurator.gui;
1,581,357
public Object save(WechatReply model);
Object function(WechatReply model);
/** * save model to database * * @param model * @return */
save model to database
save
{ "repo_name": "JpressProjects/jpress", "path": "jpress-service-api/src/main/java/io/jpress/service/WechatReplyService.java", "license": "lgpl-3.0", "size": 2199 }
[ "io.jpress.model.WechatReply" ]
import io.jpress.model.WechatReply;
import io.jpress.model.*;
[ "io.jpress.model" ]
io.jpress.model;
39,833