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
ServiceCall get200Model204NoModelDefaultError201InvalidAsync(final ServiceCallback<A> serviceCallback) throws IllegalArgumentException;
ServiceCall get200Model204NoModelDefaultError201InvalidAsync(final ServiceCallback<A> serviceCallback) throws IllegalArgumentException;
/** * Send a 201 response with valid payload: {'statusCode': '201'}. * * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if callback is null * @return the {@link ServiceCall} object */
Send a 201 response with valid payload: {'statusCode': '201'}
get200Model204NoModelDefaultError201InvalidAsync
{ "repo_name": "brodyberg/autorest", "path": "AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/MultipleResponsesOperations.java", "license": "mit", "size": 29440 }
[ "com.microsoft.rest.ServiceCall", "com.microsoft.rest.ServiceCallback" ]
import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback;
import com.microsoft.rest.*;
[ "com.microsoft.rest" ]
com.microsoft.rest;
2,102,744
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/1786") public static <T extends Message> Marshaller<T> jsonMarshaller(final T defaultInstance) { final Printer printer = JsonFormat.printer(); // TODO(carl-mastrangelo): Add support for ExtensionRegistry (TypeRegistry?) final JsonFormat.Parser parser = JsonFormat.parser(); final Charset charset = Charset.forName("UTF-8");
@ExperimentalApi(STRUTF-8");
/** * Create a {@code Marshaller} for json protos of the same type as {@code defaultInstance}. * * <p>This is an unstable API and has not been optimized yet for performance. */
Create a Marshaller for json protos of the same type as defaultInstance. This is an unstable API and has not been optimized yet for performance
jsonMarshaller
{ "repo_name": "LuminateWireless/grpc-java", "path": "protobuf/src/main/java/io/grpc/protobuf/ProtoUtils.java", "license": "bsd-3-clause", "size": 5089 }
[ "io.grpc.ExperimentalApi" ]
import io.grpc.ExperimentalApi;
import io.grpc.*;
[ "io.grpc" ]
io.grpc;
180,065
public String getText(PDDocument doc) throws IOException { StringWriter outputStream = new StringWriter(); writeText(doc, outputStream); return outputStream.toString(); }
String function(PDDocument doc) throws IOException { StringWriter outputStream = new StringWriter(); writeText(doc, outputStream); return outputStream.toString(); }
/** * This will return the text of a document. See writeText. <br> * NOTE: The document must not be encrypted when coming into this method. * * @param doc The document to get the text from. * @return The text of the PDF document. * @throws IOException if the doc state is invalid or it is encrypted. */
This will return the text of a document. See writeText.
getText
{ "repo_name": "TomRoush/PdfBox-Android", "path": "library/src/main/java/com/tom_roush/pdfbox/text/PDFTextStripper.java", "license": "apache-2.0", "size": 76100 }
[ "com.tom_roush.pdfbox.pdmodel.PDDocument", "java.io.IOException", "java.io.StringWriter" ]
import com.tom_roush.pdfbox.pdmodel.PDDocument; import java.io.IOException; import java.io.StringWriter;
import com.tom_roush.pdfbox.pdmodel.*; import java.io.*;
[ "com.tom_roush.pdfbox", "java.io" ]
com.tom_roush.pdfbox; java.io;
1,365,989
SimpleResponse validateUser(final HttpServletRequest request, HttpSession session) throws ApplicationException, DBException;
SimpleResponse validateUser(final HttpServletRequest request, HttpSession session) throws ApplicationException, DBException;
/** * Validates user. * * @param request * The HTTP request. * @param session * The HTTP session. * @return Simple response object. * @throws ApplicationException * If a problem occurs. * @throws DBException * If a db problem occurs. */
Validates user
validateUser
{ "repo_name": "oswa/bianccoAdmin", "path": "BianccoAdministrator/src/main/java/com/biancco/admin/service/AuthenticationService.java", "license": "apache-2.0", "size": 1293 }
[ "com.biancco.admin.app.exception.ApplicationException", "com.biancco.admin.app.exception.DBException", "com.biancco.admin.model.view.SimpleResponse", "javax.servlet.http.HttpServletRequest", "javax.servlet.http.HttpSession" ]
import com.biancco.admin.app.exception.ApplicationException; import com.biancco.admin.app.exception.DBException; import com.biancco.admin.model.view.SimpleResponse; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession;
import com.biancco.admin.app.exception.*; import com.biancco.admin.model.view.*; import javax.servlet.http.*;
[ "com.biancco.admin", "javax.servlet" ]
com.biancco.admin; javax.servlet;
2,686,286
private void processQueue(long now) { PQEntry pqe = m_pollQueue.pollFirst(); pqe.getDevice().doPoll(0); addToPollQueue(pqe.getDevice(), now + pqe.getDevice().getPollInterval()); } } private static class PQEntry implements Comparable<PQEntry> { private InsteonDevice m_dev = null; private long m_expirationTime = 0L; PQEntry(InsteonDevice dev, long time) { m_dev = dev; m_expirationTime = time; }
void function(long now) { PQEntry pqe = m_pollQueue.pollFirst(); pqe.getDevice().doPoll(0); addToPollQueue(pqe.getDevice(), now + pqe.getDevice().getPollInterval()); } } private static class PQEntry implements Comparable<PQEntry> { private InsteonDevice m_dev = null; private long m_expirationTime = 0L; PQEntry(InsteonDevice dev, long time) { m_dev = dev; m_expirationTime = time; }
/** * Takes first element off the poll queue, polls the corresponding device, * and puts the device back into the poll queue to be polled again later. * * @param now the current time */
Takes first element off the poll queue, polls the corresponding device, and puts the device back into the poll queue to be polled again later
processQueue
{ "repo_name": "paolodenti/openhab", "path": "bundles/binding/org.openhab.binding.insteonplm/src/main/java/org/openhab/binding/insteonplm/internal/driver/Poller.java", "license": "epl-1.0", "size": 9863 }
[ "org.openhab.binding.insteonplm.internal.device.InsteonDevice" ]
import org.openhab.binding.insteonplm.internal.device.InsteonDevice;
import org.openhab.binding.insteonplm.internal.device.*;
[ "org.openhab.binding" ]
org.openhab.binding;
376,626
public static final String parseFileNameFromString(String absolutePath) { if ( absolutePath == null ) return null; int index = absolutePath.lastIndexOf(File.separatorChar); if ( index > -1 ) { return absolutePath.substring(index); } return null; }
static final String function(String absolutePath) { if ( absolutePath == null ) return null; int index = absolutePath.lastIndexOf(File.separatorChar); if ( index > -1 ) { return absolutePath.substring(index); } return null; }
/** * Get the file name from absolute path. * @param absolutePath * @return */
Get the file name from absolute path
parseFileNameFromString
{ "repo_name": "wangqi/gameserver", "path": "bootstrap/src/main/java/com/xinqihd/sns/gameserver/util/IOUtil.java", "license": "apache-2.0", "size": 11737 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
2,330,172
public void readObjectData(ObjectInputStream stream) throws ClassNotFoundException, IOException { super.readObjectData(stream); }
void function(ObjectInputStream stream) throws ClassNotFoundException, IOException { super.readObjectData(stream); }
/** * Read a serialized version of the contents of this session object from * the specified object input stream, without requiring that the * StandardSession itself have been serialized. * * @param stream The object input stream to read from * * @exception ClassNotFoundException if an unknown class is specified * @exception IOException if an input/output error occurs */
Read a serialized version of the contents of this session object from the specified object input stream, without requiring that the StandardSession itself have been serialized
readObjectData
{ "repo_name": "yuyupapa/OpenSource", "path": "apache-tomcat-6.0.48/java/org/apache/catalina/ha/session/ReplicatedSession.java", "license": "apache-2.0", "size": 9247 }
[ "java.io.IOException", "java.io.ObjectInputStream" ]
import java.io.IOException; import java.io.ObjectInputStream;
import java.io.*;
[ "java.io" ]
java.io;
2,800,684
@Beta public static <E> FluentIterable<E> from(E[] elements) { return from(Arrays.asList(elements)); } /** * Construct a fluent iterable from another fluent iterable. This is obviously never necessary, * but is intended to help call out cases where one migration from {@code Iterable} to {@code * FluentIterable} has obviated the need to explicitly convert to a {@code FluentIterable}. * * @deprecated instances of {@code FluentIterable} don't need to be converted to {@code * FluentIterable}
static <E> FluentIterable<E> function(E[] elements) { return from(Arrays.asList(elements)); } /** * Construct a fluent iterable from another fluent iterable. This is obviously never necessary, * but is intended to help call out cases where one migration from {@code Iterable} to { * FluentIterable} has obviated the need to explicitly convert to a {@code FluentIterable}. * * @deprecated instances of {@code FluentIterable} don't need to be converted to { * FluentIterable}
/** * Returns a fluent iterable containing {@code elements} in the specified order. * * <p>The returned iterable is an unmodifiable view of the input array. * * <p><b>{@code Stream} equivalent:</b> {@link java.util.stream.Stream#of(Object[]) * Stream.of(T...)}. * * @since 20.0 (since 18.0 as an overload of {@code of}) */
Returns a fluent iterable containing elements in the specified order. The returned iterable is an unmodifiable view of the input array. Stream equivalent: <code>java.util.stream.Stream#of(Object[]) Stream.of(T...)</code>
from
{ "repo_name": "typetools/guava", "path": "android/guava/src/com/google/common/collect/FluentIterable.java", "license": "apache-2.0", "size": 34810 }
[ "java.util.Arrays" ]
import java.util.Arrays;
import java.util.*;
[ "java.util" ]
java.util;
1,461,181
public boolean isScrollStoped(final ScrollView scrollView) { int x1 = scrollView.getScrollX(); int y1 = scrollView.getScrollY(); sleep(100); int x2 = scrollView.getScrollX(); int y2 = scrollView.getScrollY(); return x1 == x2 && y1 == y2 ? true : false; }
boolean function(final ScrollView scrollView) { int x1 = scrollView.getScrollX(); int y1 = scrollView.getScrollY(); sleep(100); int x2 = scrollView.getScrollX(); int y2 = scrollView.getScrollY(); return x1 == x2 && y1 == y2 ? true : false; }
/** * This method will cost 100ms to judge whether scrollview stoped. * * @param scrollView * @return true means scrolling is stop, otherwise return fasle */
This method will cost 100ms to judge whether scrollview stoped
isScrollStoped
{ "repo_name": "0359xiaodong/Cafe", "path": "testrunner/src/com/baidu/cafe/local/LocalLib.java", "license": "apache-2.0", "size": 84428 }
[ "android.widget.ScrollView" ]
import android.widget.ScrollView;
import android.widget.*;
[ "android.widget" ]
android.widget;
2,437,907
@XmlElement(name = "last_used") public boolean isLastUsed() { return lastUsed; }
@XmlElement(name = STR) boolean function() { return lastUsed; }
/** * Return true if it is last used, otherwise return false * @return */
Return true if it is last used, otherwise return false
isLastUsed
{ "repo_name": "exalt-tech/trex-stateless-gui", "path": "src/main/java/com/exalttech/trex/ui/models/datastore/Connection.java", "license": "apache-2.0", "size": 3546 }
[ "javax.xml.bind.annotation.XmlElement" ]
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.*;
[ "javax.xml" ]
javax.xml;
864,726
public static ExpectedCount times(int count) { Assert.isTrue(count >= 1, "'count' must be >= 1"); return new ExpectedCount(count, count); }
static ExpectedCount function(int count) { Assert.isTrue(count >= 1, STR); return new ExpectedCount(count, count); }
/** * Exactly N times. */
Exactly N times
times
{ "repo_name": "spring-projects/spring-framework", "path": "spring-test/src/main/java/org/springframework/test/web/client/ExpectedCount.java", "license": "apache-2.0", "size": 2974 }
[ "org.springframework.util.Assert" ]
import org.springframework.util.Assert;
import org.springframework.util.*;
[ "org.springframework.util" ]
org.springframework.util;
1,842,643
@Test public void testWALCoprocessorLoaded() throws Exception { // test to see whether the coprocessor is loaded or not. FSHLog log = null; try { log = new FSHLog(fs, FSUtils.getRootDir(conf), dir.toString(), HConstants.HREGION_OLDLOGDIR_NAME, conf, null, true, null, null); WALCoprocessorHost host = log.getCoprocessorHost(); Coprocessor c = host.findCoprocessor(SampleRegionWALObserver.class.getName()); assertNotNull(c); } finally { if (log != null) { log.close(); } } }
void function() throws Exception { FSHLog log = null; try { log = new FSHLog(fs, FSUtils.getRootDir(conf), dir.toString(), HConstants.HREGION_OLDLOGDIR_NAME, conf, null, true, null, null); WALCoprocessorHost host = log.getCoprocessorHost(); Coprocessor c = host.findCoprocessor(SampleRegionWALObserver.class.getName()); assertNotNull(c); } finally { if (log != null) { log.close(); } } }
/** * A loaded WAL coprocessor won't break existing WAL test cases. */
A loaded WAL coprocessor won't break existing WAL test cases
testWALCoprocessorLoaded
{ "repo_name": "toshimasa-nasu/hbase", "path": "hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestFSHLog.java", "license": "apache-2.0", "size": 19903 }
[ "org.apache.hadoop.hbase.Coprocessor", "org.apache.hadoop.hbase.HConstants", "org.apache.hadoop.hbase.coprocessor.SampleRegionWALObserver", "org.apache.hadoop.hbase.util.FSUtils", "org.junit.Assert" ]
import org.apache.hadoop.hbase.Coprocessor; import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.coprocessor.SampleRegionWALObserver; import org.apache.hadoop.hbase.util.FSUtils; import org.junit.Assert;
import org.apache.hadoop.hbase.*; import org.apache.hadoop.hbase.coprocessor.*; import org.apache.hadoop.hbase.util.*; import org.junit.*;
[ "org.apache.hadoop", "org.junit" ]
org.apache.hadoop; org.junit;
627,000
@Nonnull CompletableFuture<R> call(@Nonnull T input);
CompletableFuture<R> call(@Nonnull T input);
/** * Calls the requested service and returns a future which will be * completed with the result once a response is received. */
Calls the requested service and returns a future which will be completed with the result once a response is received
call
{ "repo_name": "gurbuzali/hazelcast-jet", "path": "extensions/grpc/src/main/java/com/hazelcast/jet/grpc/GrpcService.java", "license": "apache-2.0", "size": 1436 }
[ "java.util.concurrent.CompletableFuture", "javax.annotation.Nonnull" ]
import java.util.concurrent.CompletableFuture; import javax.annotation.Nonnull;
import java.util.concurrent.*; import javax.annotation.*;
[ "java.util", "javax.annotation" ]
java.util; javax.annotation;
2,157,741
@Override public FilterExecuterType getFilterExecuterType() { return FilterExecuterType.FALSE; }
@Override FilterExecuterType function() { return FilterExecuterType.FALSE; }
/** * This method will provide the executer type to the callee inorder to identify * the executer type for the filter resolution, False Expresssion willl not execute anything. * it will return empty bitset */
This method will provide the executer type to the callee inorder to identify the executer type for the filter resolution, False Expresssion willl not execute anything. it will return empty bitset
getFilterExecuterType
{ "repo_name": "manishgupta88/incubator-carbondata", "path": "core/src/main/java/org/apache/carbondata/core/scan/filter/resolver/resolverinfo/FalseConditionalResolverImpl.java", "license": "apache-2.0", "size": 2351 }
[ "org.apache.carbondata.core.scan.filter.intf.FilterExecuterType" ]
import org.apache.carbondata.core.scan.filter.intf.FilterExecuterType;
import org.apache.carbondata.core.scan.filter.intf.*;
[ "org.apache.carbondata" ]
org.apache.carbondata;
2,442,975
public static <T, U extends Unifiable<? super T>> Choice<Unifier> unifyList( Unifier unifier, @Nullable List<U> toUnify, @Nullable final List<? extends T> targets, boolean allowVarargs) { if (toUnify == null && targets == null) { return Choice.of(unifier); } else if (toUnify == null || targets == null || (allowVarargs ? toUnify.size() - 1 > targets.size() : toUnify.size() != targets.size())) { return Choice.none(); }
static <T, U extends Unifiable<? super T>> Choice<Unifier> function( Unifier unifier, @Nullable List<U> toUnify, @Nullable final List<? extends T> targets, boolean allowVarargs) { if (toUnify == null && targets == null) { return Choice.of(unifier); } else if (toUnify == null targets == null (allowVarargs ? toUnify.size() - 1 > targets.size() : toUnify.size() != targets.size())) { return Choice.none(); }
/** * Returns all successful unification paths from the specified {@code Unifier} unifying the * specified lists, allowing varargs if and only if {@code allowVarargs} is true. */
Returns all successful unification paths from the specified Unifier unifying the specified lists, allowing varargs if and only if allowVarargs is true
unifyList
{ "repo_name": "cushon/error-prone", "path": "core/src/main/java/com/google/errorprone/refaster/Unifier.java", "license": "apache-2.0", "size": 7050 }
[ "java.util.List", "javax.annotation.Nullable" ]
import java.util.List; import javax.annotation.Nullable;
import java.util.*; import javax.annotation.*;
[ "java.util", "javax.annotation" ]
java.util; javax.annotation;
1,512,462
public static ZonedDateTimeMatcher sameInstant(ZonedDateTime date) { return new ZonedDateTimeMatcher(date); }
static ZonedDateTimeMatcher function(ZonedDateTime date) { return new ZonedDateTimeMatcher(date); }
/** * Creates a matcher that matches when the examined string reprensents the same instant as the reference datetime * @param date the reference datetime against which the examined string is checked */
Creates a matcher that matches when the examined string reprensents the same instant as the reference datetime
sameInstant
{ "repo_name": "ajeans/sandbox", "path": "sandbox-hipster/src/test/java/com/ajeansen/sandbox/web/rest/TestUtil.java", "license": "gpl-3.0", "size": 4387 }
[ "java.time.ZonedDateTime" ]
import java.time.ZonedDateTime;
import java.time.*;
[ "java.time" ]
java.time;
1,422,270
public static XMLHttpRequest createXHR() { return XMLHttpRequest.create(); }
static XMLHttpRequest function() { return XMLHttpRequest.create(); }
/** * Instances a new com.google.gwt.xhr.client.XMLHttpRequest. */
Instances a new com.google.gwt.xhr.client.XMLHttpRequest
createXHR
{ "repo_name": "stori-es/stori_es", "path": "dashboard/src/main/java/de/devbliss/gwt/xdm/client/CustomCORSDispatcher.java", "license": "apache-2.0", "size": 16530 }
[ "com.google.gwt.xhr.client.XMLHttpRequest" ]
import com.google.gwt.xhr.client.XMLHttpRequest;
import com.google.gwt.xhr.client.*;
[ "com.google.gwt" ]
com.google.gwt;
713,995
List<T> getAllByNativeQuery(String sql);
List<T> getAllByNativeQuery(String sql);
/** * Gets the all by native query. * * @param sql * the sql * @return the all by native query */
Gets the all by native query
getAllByNativeQuery
{ "repo_name": "impetus-opensource/ankush", "path": "ankush/src/main/java/com/impetus/ankush/common/dao/GenericDao.java", "license": "lgpl-3.0", "size": 8536 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,690,068
public static String removeNewlineInFormula(String str){ Matcher m1 = PATTERN1.matcher(str); Matcher m2 = PATTERN2.matcher(str); Matcher m3 = PATTERN3.matcher(str); Matcher m4 = PATTERN4.matcher(str); Matcher m5 = PATTERN5.matcher(str); Matcher[] matchers = {m1, m2, m3, m4, m5}; for (Matcher matcher : matchers) { while (matcher.find()) { String oldStr = matcher.group(); String newStr = oldStr.replaceAll("[\\n\\r]", ""); str = str.replace(oldStr, newStr); } } return str; }
static String function(String str){ Matcher m1 = PATTERN1.matcher(str); Matcher m2 = PATTERN2.matcher(str); Matcher m3 = PATTERN3.matcher(str); Matcher m4 = PATTERN4.matcher(str); Matcher m5 = PATTERN5.matcher(str); Matcher[] matchers = {m1, m2, m3, m4, m5}; for (Matcher matcher : matchers) { while (matcher.find()) { String oldStr = matcher.group(); String newStr = oldStr.replaceAll(STR, ""); str = str.replace(oldStr, newStr); } } return str; }
/** * Fix the "bug" that ImageSpan shows as many as the num of lines of the string substituted * @param str string containing formulas * @return string containing single-line formulas */
Fix the "bug" that ImageSpan shows as many as the num of lines of the string substituted
removeNewlineInFormula
{ "repo_name": "daquexian/chaoli-forum-for-android-2", "path": "app/src/main/java/com/daquexian/chaoli/forum/meta/OnlineImgUtils.java", "license": "gpl-3.0", "size": 12530 }
[ "java.util.regex.Matcher" ]
import java.util.regex.Matcher;
import java.util.regex.*;
[ "java.util" ]
java.util;
2,681,681
long getLastModifiedTime(Object key) throws EntryNotFoundException { RegionEntry entry = this.entries.getEntry(key); if (entry == null) throw new EntryNotFoundException(key.toString()); return entry.getLastModified(); }
long getLastModifiedTime(Object key) throws EntryNotFoundException { RegionEntry entry = this.entries.getEntry(key); if (entry == null) throw new EntryNotFoundException(key.toString()); return entry.getLastModified(); }
/** * Used internally by EntryExpiryTask. Ok for it to ignore transaction. */
Used internally by EntryExpiryTask. Ok for it to ignore transaction
getLastModifiedTime
{ "repo_name": "papicella/snappy-store", "path": "gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/LocalRegion.java", "license": "apache-2.0", "size": 506961 }
[ "com.gemstone.gemfire.cache.EntryNotFoundException" ]
import com.gemstone.gemfire.cache.EntryNotFoundException;
import com.gemstone.gemfire.cache.*;
[ "com.gemstone.gemfire" ]
com.gemstone.gemfire;
2,825,467
public Map<String, Long> getROCurrentVersion(int nodeId, List<String> storeNames) { Map<String, Long> returnMap = Maps.newHashMapWithExpectedSize(storeNames.size()); Map<String, String> versionDirs = getROCurrentVersionDir(nodeId, storeNames); for(String storeName: versionDirs.keySet()) { returnMap.put(storeName, ReadOnlyUtils.getVersionId(new File(versionDirs.get(storeName)))); } return returnMap; }
Map<String, Long> function(int nodeId, List<String> storeNames) { Map<String, Long> returnMap = Maps.newHashMapWithExpectedSize(storeNames.size()); Map<String, String> versionDirs = getROCurrentVersionDir(nodeId, storeNames); for(String storeName: versionDirs.keySet()) { returnMap.put(storeName, ReadOnlyUtils.getVersionId(new File(versionDirs.get(storeName)))); } return returnMap; }
/** * Returns the 'current' version of RO store * * @param nodeId The id of the node on which the store is present * @param storeNames List of all the stores * @return Returns a map of store name to the respective max version * number */
Returns the 'current' version of RO store
getROCurrentVersion
{ "repo_name": "mabh/voldemort", "path": "src/java/voldemort/client/protocol/admin/AdminClient.java", "license": "apache-2.0", "size": 239790 }
[ "com.google.common.collect.Maps", "java.io.File", "java.util.List", "java.util.Map" ]
import com.google.common.collect.Maps; import java.io.File; import java.util.List; import java.util.Map;
import com.google.common.collect.*; import java.io.*; import java.util.*;
[ "com.google.common", "java.io", "java.util" ]
com.google.common; java.io; java.util;
75,657
public void alterMeasure(CubeMeasure measure) throws HiveException { if (measure == null) { throw new NullPointerException("Cannot add null measure"); } // Replace measure if already existing if (measureMap.containsKey(measure.getName().toLowerCase())) { measures.remove(getMeasureByName(measure.getName())); LOG.info("Replacing measure " + getMeasureByName(measure.getName()) + " with " + measure); } measures.add(measure); measureMap.put(measure.getName().toLowerCase(), measure); MetastoreUtil.addNameStrings(getProperties(), MetastoreUtil.getCubeMeasureListKey(getName()), measures); measure.addProperties(getProperties()); }
void function(CubeMeasure measure) throws HiveException { if (measure == null) { throw new NullPointerException(STR); } if (measureMap.containsKey(measure.getName().toLowerCase())) { measures.remove(getMeasureByName(measure.getName())); LOG.info(STR + getMeasureByName(measure.getName()) + STR + measure); } measures.add(measure); measureMap.put(measure.getName().toLowerCase(), measure); MetastoreUtil.addNameStrings(getProperties(), MetastoreUtil.getCubeMeasureListKey(getName()), measures); measure.addProperties(getProperties()); }
/** * Alters the measure if already existing or just adds if it is new measure. * * @param measure * @throws HiveException */
Alters the measure if already existing or just adds if it is new measure
alterMeasure
{ "repo_name": "rajubairishetti/lens", "path": "lens-cube/src/main/java/org/apache/lens/cube/metadata/Cube.java", "license": "apache-2.0", "size": 14295 }
[ "org.apache.hadoop.hive.ql.metadata.HiveException" ]
import org.apache.hadoop.hive.ql.metadata.HiveException;
import org.apache.hadoop.hive.ql.metadata.*;
[ "org.apache.hadoop" ]
org.apache.hadoop;
1,543,747
private void specialPack() { Dimension oldSz = getSize(); //save current position and size Point oldLoc = getLocation(); pack(); Dimension scnSz = Toolkit.getDefaultToolkit().getScreenSize(); Dimension newSz = getSize(); newSz.width = oldSz.width; //preserve the old width (for now) int newY = oldLoc.y-(newSz.height-oldSz.height); if(newY<10) newY=10; int newX = oldLoc.x; if( (newX+newSz.width) > scnSz.width-10) newX = scnSz.width-newSz.width-10; if(newX < 10) newX=10; setSize(newSz); setLocation(newX, newY); //subtract new size from oldSize, adjust vpos by that amount }
void function() { Dimension oldSz = getSize(); Point oldLoc = getLocation(); pack(); Dimension scnSz = Toolkit.getDefaultToolkit().getScreenSize(); Dimension newSz = getSize(); newSz.width = oldSz.width; int newY = oldLoc.y-(newSz.height-oldSz.height); if(newY<10) newY=10; int newX = oldLoc.x; if( (newX+newSz.width) > scnSz.width-10) newX = scnSz.width-newSz.width-10; if(newX < 10) newX=10; setSize(newSz); setLocation(newX, newY); }
/**This is a 'pack()' that tries to keep the bottom of the Window in the same spot and all of window visible * Also, width is preserved.*/
This is a 'pack()' that tries to keep the bottom of the Window in the same spot and all of window visible
specialPack
{ "repo_name": "rbenech/RiWebApps", "path": "legacy/rtalk/RtServer.java", "license": "unlicense", "size": 38884 }
[ "java.awt.Dimension", "java.awt.Point", "java.awt.Toolkit" ]
import java.awt.Dimension; import java.awt.Point; import java.awt.Toolkit;
import java.awt.*;
[ "java.awt" ]
java.awt;
1,351,289
public static final void writeByteArrayXml(byte[] val, String name, XmlSerializer out) throws XmlPullParserException, java.io.IOException { if (val == null) { out.startTag(null, "null"); out.endTag(null, "null"); return; } out.startTag(null, "byte-array"); if (name != null) { out.attribute(null, "name", name); } final int N = val.length; out.attribute(null, "num", Integer.toString(N)); StringBuilder sb = new StringBuilder(val.length*2); for (int i=0; i<N; i++) { int b = val[i]; int h = b>>4; sb.append(h >= 10 ? ('a'+h-10) : ('0'+h)); h = b&0xff; sb.append(h >= 10 ? ('a'+h-10) : ('0'+h)); } out.text(sb.toString()); out.endTag(null, "byte-array"); }
static final void function(byte[] val, String name, XmlSerializer out) throws XmlPullParserException, java.io.IOException { if (val == null) { out.startTag(null, "null"); out.endTag(null, "null"); return; } out.startTag(null, STR); if (name != null) { out.attribute(null, "name", name); } final int N = val.length; out.attribute(null, "num", Integer.toString(N)); StringBuilder sb = new StringBuilder(val.length*2); for (int i=0; i<N; i++) { int b = val[i]; int h = b>>4; sb.append(h >= 10 ? ('a'+h-10) : ('0'+h)); h = b&0xff; sb.append(h >= 10 ? ('a'+h-10) : ('0'+h)); } out.text(sb.toString()); out.endTag(null, STR); }
/** * Flatten a byte[] into an XmlSerializer. The list can later be read back * with readThisByteArrayXml(). * * @param val The byte array to be flattened. * @param name Name attribute to include with this array's tag, or null for * none. * @param out XmlSerializer to write the array into. * * @see #writeMapXml * @see #writeValueXml */
Flatten a byte[] into an XmlSerializer. The list can later be read back with readThisByteArrayXml()
writeByteArrayXml
{ "repo_name": "wtao901231/libMinusAndroid", "path": "libMinusKit/src/main/java/minus/android/internal/util/XmlUtils.java", "license": "apache-2.0", "size": 33850 }
[ "java.io.IOException", "org.xmlpull.v1.XmlPullParserException", "org.xmlpull.v1.XmlSerializer" ]
import java.io.IOException; import org.xmlpull.v1.XmlPullParserException; import org.xmlpull.v1.XmlSerializer;
import java.io.*; import org.xmlpull.v1.*;
[ "java.io", "org.xmlpull.v1" ]
java.io; org.xmlpull.v1;
1,668,830
public String getDisplayDate() { if (StringUtils.isNotEmpty(displayDate)) { return displayDate; } StringBuilder sb = new StringBuilder(); if (!dateStringsStart.isEmpty()) { sb.append(dateStringsStart.get(0)); } if (StringUtils.isNotEmpty(dateEndString) && !dateEndString.equals(dateStringsStart.get(0))) { sb.append(" - ").append(dateEndString); } return sb.toString(); }
String function() { if (StringUtils.isNotEmpty(displayDate)) { return displayDate; } StringBuilder sb = new StringBuilder(); if (!dateStringsStart.isEmpty()) { sb.append(dateStringsStart.get(0)); } if (StringUtils.isNotEmpty(dateEndString) && !dateEndString.equals(dateStringsStart.get(0))) { sb.append(STR).append(dateEndString); } return sb.toString(); }
/** * <p> * Getter for the field <code>displayDate</code>. * </p> * * @return a {@link java.lang.String} object. */
Getter for the field <code>displayDate</code>.
getDisplayDate
{ "repo_name": "intranda/goobi-viewer-core", "path": "goobi-viewer-core/src/main/java/io/goobi/viewer/model/viewer/EventElement.java", "license": "gpl-2.0", "size": 11840 }
[ "org.apache.commons.lang3.StringUtils" ]
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.*;
[ "org.apache.commons" ]
org.apache.commons;
2,889,226
private Part getPart(final DocumentImpl doc, final boolean create, final int sizeHint) { if(lastPart != null && doc.getDocId() == lastDoc) { return lastPart; } int idx = IntArrays.binarySearch(documentIds, 0, partCount, doc.getDocId()); Part part = null; if(idx >= 0) { part = parts[idx]; } else if(create) { idx = -(idx + 1); part = new Part(sizeHint); insertPart(doc.getDocId(), part, idx); } return part; }
Part function(final DocumentImpl doc, final boolean create, final int sizeHint) { if(lastPart != null && doc.getDocId() == lastDoc) { return lastPart; } int idx = IntArrays.binarySearch(documentIds, 0, partCount, doc.getDocId()); Part part = null; if(idx >= 0) { part = parts[idx]; } else if(create) { idx = -(idx + 1); part = new Part(sizeHint); insertPart(doc.getDocId(), part, idx); } return part; }
/** * The method <code>getPart</code> * * @param doc a <code>DocumentImpl</code> value * @param create a <code>boolean</code> value * @param sizeHint an <code>int</code> value * @return a <code>Part</code> value */
The method <code>getPart</code>
getPart
{ "repo_name": "wolfgangmm/exist", "path": "exist-core/src/main/java/org/exist/dom/persistent/ExtArrayNodeSet.java", "license": "lgpl-2.1", "size": 37454 }
[ "it.unimi.dsi.fastutil.ints.IntArrays" ]
import it.unimi.dsi.fastutil.ints.IntArrays;
import it.unimi.dsi.fastutil.ints.*;
[ "it.unimi.dsi" ]
it.unimi.dsi;
799,736
public KnowledgeLink getKnowledgeLink() { return this.knowledgeLink; }
KnowledgeLink function() { return this.knowledgeLink; }
/** * Gets the knowledgelink. * * @return knowledgelink. */
Gets the knowledgelink
getKnowledgeLink
{ "repo_name": "prowim/prowim", "path": "prowim-portal/src/org/prowim/portal/models/tree/model/KnowledgeLinkLeaf.java", "license": "gpl-3.0", "size": 6463 }
[ "org.prowim.datamodel.prowim.KnowledgeLink" ]
import org.prowim.datamodel.prowim.KnowledgeLink;
import org.prowim.datamodel.prowim.*;
[ "org.prowim.datamodel" ]
org.prowim.datamodel;
351,200
public static void merge(Readable input, ExtensionRegistry extensionRegistry, Message.Builder builder) throws IOException { // Read the entire input to a String then parse that. // If StreamTokenizer were not quite so crippled, or if there were a kind // of Reader that could read in chunks that match some particular regex, // or if we wanted to write a custom Reader to tokenize our stream, then // we would not have to read to one big String. Alas, none of these is // the case. Oh well. merge(toStringBuilder(input), extensionRegistry, builder); } private static final int BUFFER_SIZE = 4096;
static void function(Readable input, ExtensionRegistry extensionRegistry, Message.Builder builder) throws IOException { merge(toStringBuilder(input), extensionRegistry, builder); } private static final int BUFFER_SIZE = 4096;
/** * Parse a text-format message from {@code input} and merge the contents into {@code builder}. * Extensions will be recognized if they are registered in {@code extensionRegistry}. */
Parse a text-format message from input and merge the contents into builder. Extensions will be recognized if they are registered in extensionRegistry
merge
{ "repo_name": "sh4nth/atlasdb-1", "path": "atlasdb-server/src/main/java/com/palantir/atlasdb/proto/fork/ForkedJsonFormat.java", "license": "bsd-3-clause", "size": 55575 }
[ "com.google.protobuf.ExtensionRegistry", "com.google.protobuf.Message", "java.io.IOException" ]
import com.google.protobuf.ExtensionRegistry; import com.google.protobuf.Message; import java.io.IOException;
import com.google.protobuf.*; import java.io.*;
[ "com.google.protobuf", "java.io" ]
com.google.protobuf; java.io;
2,693,753
DataMigrationService apply(Context context); }
DataMigrationService apply(Context context); }
/** * Executes the update request. * * @param context The context to associate with this operation. * @return the updated resource. */
Executes the update request
apply
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/datamigration/azure-resourcemanager-datamigration/src/main/java/com/azure/resourcemanager/datamigration/models/DataMigrationService.java", "license": "mit", "size": 17361 }
[ "com.azure.core.util.Context" ]
import com.azure.core.util.Context;
import com.azure.core.util.*;
[ "com.azure.core" ]
com.azure.core;
1,093,228
public void close() { writeLock.lock(); try { if (dataFile == null) { return; } reset(); dataFile.close(); logDetailEvent("dataFileCache file close end"); dataFile = null; boolean empty = fileFreePosition == initialFreePos; if (empty) { deleteFile(); deleteBackup(); } } catch (HsqlException e) { throw e; } catch (Throwable t) { logSevereEvent("DataFileCache.close", t); throw Error.error(t, ErrorCode.FILE_IO_ERROR, ErrorCode.M_DataFileCache_close, new Object[] { t.toString(), dataFileName }); } finally { writeLock.unlock(); } }
void function() { writeLock.lock(); try { if (dataFile == null) { return; } reset(); dataFile.close(); logDetailEvent(STR); dataFile = null; boolean empty = fileFreePosition == initialFreePos; if (empty) { deleteFile(); deleteBackup(); } } catch (HsqlException e) { throw e; } catch (Throwable t) { logSevereEvent(STR, t); throw Error.error(t, ErrorCode.FILE_IO_ERROR, ErrorCode.M_DataFileCache_close, new Object[] { t.toString(), dataFileName }); } finally { writeLock.unlock(); } }
/** * Writes out all cached rows that have been modified and the * free position pointer for the *.data file and then closes the file. */
Writes out all cached rows that have been modified and the free position pointer for the *.data file and then closes the file
close
{ "repo_name": "Julien35/dev-courses", "path": "tutoriel-spring-mvc/lib/hsqldb/src/org/hsqldb/persist/DataFileCache.java", "license": "mit", "size": 47274 }
[ "org.hsqldb.HsqlException", "org.hsqldb.error.Error", "org.hsqldb.error.ErrorCode" ]
import org.hsqldb.HsqlException; import org.hsqldb.error.Error; import org.hsqldb.error.ErrorCode;
import org.hsqldb.*; import org.hsqldb.error.*;
[ "org.hsqldb", "org.hsqldb.error" ]
org.hsqldb; org.hsqldb.error;
770,081
private static void timeoutCheck(DefaultFuture future) { TimeoutCheckTask task = new TimeoutCheckTask(future); TIME_OUT_TIMER.newTimeout(task, future.getTimeout(), TimeUnit.MILLISECONDS); }
static void function(DefaultFuture future) { TimeoutCheckTask task = new TimeoutCheckTask(future); TIME_OUT_TIMER.newTimeout(task, future.getTimeout(), TimeUnit.MILLISECONDS); }
/** * check time out of the future */
check time out of the future
timeoutCheck
{ "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 }
[ "java.util.concurrent.TimeUnit" ]
import java.util.concurrent.TimeUnit;
import java.util.concurrent.*;
[ "java.util" ]
java.util;
1,257,622
@SuppressWarnings({"ClassReferencesSubclass"}) public void close() { SQLException sqlException = closeQuery(); connection = null; if (this.session != null) { this.session.detachQuery(this); } if (sqlException != null) { throw new DbSqlException("Close query error", sqlException); } }
@SuppressWarnings({STR}) void function() { SQLException sqlException = closeQuery(); connection = null; if (this.session != null) { this.session.detachQuery(this); } if (sqlException != null) { throw new DbSqlException(STR, sqlException); } }
/** * Closes the query and all created results sets and detaches itself from the session. */
Closes the query and all created results sets and detaches itself from the session
close
{ "repo_name": "vilmospapp/jodd", "path": "jodd-db/src/main/java/jodd/db/DbQueryBase.java", "license": "bsd-2-clause", "size": 25801 }
[ "java.sql.SQLException" ]
import java.sql.SQLException;
import java.sql.*;
[ "java.sql" ]
java.sql;
2,791,590
public final void testRSAOtherPrimeInfo02() { try { new RSAOtherPrimeInfo(null, BigInteger.valueOf(2L), BigInteger.valueOf(3L)); fail("Expected NPE not thrown"); } catch (NullPointerException e) { } }
final void function() { try { new RSAOtherPrimeInfo(null, BigInteger.valueOf(2L), BigInteger.valueOf(3L)); fail(STR); } catch (NullPointerException e) { } }
/** * Test #2 for <code>RSAOtherPrimeInfo(BigInteger,BigInteger,BigInteger)</code> ctor * Assertion: NullPointerException if prime is null */
Test #2 for <code>RSAOtherPrimeInfo(BigInteger,BigInteger,BigInteger)</code> ctor Assertion: NullPointerException if prime is null
testRSAOtherPrimeInfo02
{ "repo_name": "AdmireTheDistance/android_libcore", "path": "luni/src/test/java/tests/security/spec/RSAOtherPrimeInfoTest.java", "license": "gpl-2.0", "size": 4919 }
[ "java.math.BigInteger", "java.security.spec.RSAOtherPrimeInfo" ]
import java.math.BigInteger; import java.security.spec.RSAOtherPrimeInfo;
import java.math.*; import java.security.spec.*;
[ "java.math", "java.security" ]
java.math; java.security;
137,614
public void startElement(String tagname, AttributeList attrlist) throws SAXException { // System.out.println("ELEMENT received: "+tagname); if (rootobjstash == null) { try { Class objclass = classnamemanager.findClazz(tagname); rootobjstash = objclass.newInstance(); } catch (Throwable t) { throw UniversalRuntimeException.accumulate(t, "Tag name " + tagname + " has not been mapped onto a default constructible object"); } } // remember that the following production occurs asynchronously, driven // by events from the SAX stream. saxer.produceSubtree(rootobjstash, attrlist, null); // hand over ownership of the SAX stream to the SAXalizer parserstash.setDocumentHandler(saxer); }
void function(String tagname, AttributeList attrlist) throws SAXException { if (rootobjstash == null) { try { Class objclass = classnamemanager.findClazz(tagname); rootobjstash = objclass.newInstance(); } catch (Throwable t) { throw UniversalRuntimeException.accumulate(t, STR + tagname + STR); } } saxer.produceSubtree(rootobjstash, attrlist, null); parserstash.setDocumentHandler(saxer); }
/** Implements the DocumentHandler interface. This method is only implemented to * intercept the very first opening tag for the root object, at which point * handling is forwarded to the internal SAXalizer object. * @param tagname The tag name for the element just seen in the SAX stream. * @param attrlist The attribute list of the tag just seen in the SAX stream. * @exception SAXException If any exception requires to be propagated from this * interface. */
Implements the DocumentHandler interface. This method is only implemented to intercept the very first opening tag for the root object, at which point handling is forwarded to the internal SAXalizer object
startElement
{ "repo_name": "ern/rsf", "path": "rsf-core/ponderutilcore/src/uk/org/ponder/saxalizer/SAXalizerHelper.java", "license": "bsd-3-clause", "size": 5493 }
[ "org.xml.sax.AttributeList", "org.xml.sax.SAXException", "uk.org.ponder.util.UniversalRuntimeException" ]
import org.xml.sax.AttributeList; import org.xml.sax.SAXException; import uk.org.ponder.util.UniversalRuntimeException;
import org.xml.sax.*; import uk.org.ponder.util.*;
[ "org.xml.sax", "uk.org.ponder" ]
org.xml.sax; uk.org.ponder;
91,335
public static SelectionDialog createChooseIntepreterInfoDialog(IWorkbenchWindow workbenchWindow, IInterpreterInfo[] interpreters, String msg, boolean selectMultiple) { IStructuredContentProvider contentProvider = new IStructuredContentProvider() {
static SelectionDialog function(IWorkbenchWindow workbenchWindow, IInterpreterInfo[] interpreters, String msg, boolean selectMultiple) { IStructuredContentProvider contentProvider = new IStructuredContentProvider() {
/** * Creates a dialog that'll choose from a list of interpreter infos. */
Creates a dialog that'll choose from a list of interpreter infos
createChooseIntepreterInfoDialog
{ "repo_name": "akurtakov/Pydev", "path": "plugins/org.python.pydev/src/org/python/pydev/ui/pythonpathconf/AbstractInterpreterPreferencesPage.java", "license": "epl-1.0", "size": 10732 }
[ "org.eclipse.jface.viewers.IStructuredContentProvider", "org.eclipse.ui.IWorkbenchWindow", "org.eclipse.ui.dialogs.SelectionDialog", "org.python.pydev.core.IInterpreterInfo" ]
import org.eclipse.jface.viewers.IStructuredContentProvider; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.dialogs.SelectionDialog; import org.python.pydev.core.IInterpreterInfo;
import org.eclipse.jface.viewers.*; import org.eclipse.ui.*; import org.eclipse.ui.dialogs.*; import org.python.pydev.core.*;
[ "org.eclipse.jface", "org.eclipse.ui", "org.python.pydev" ]
org.eclipse.jface; org.eclipse.ui; org.python.pydev;
1,661,060
public String toJava(MethodType incoming) { StringBuilder builder = new StringBuilder(); boolean second = false; for (Transform transform : transforms) { if (second) builder.append('\n'); second = true; builder.append(transform.toJava(incoming)); } return builder.toString(); }
String function(MethodType incoming) { StringBuilder builder = new StringBuilder(); boolean second = false; for (Transform transform : transforms) { if (second) builder.append('\n'); second = true; builder.append(transform.toJava(incoming)); } return builder.toString(); }
/** * Produce Java code that would perform equivalent operations to this binder. * * @return Java code for the handle adaptations this Binder would produce. */
Produce Java code that would perform equivalent operations to this binder
toJava
{ "repo_name": "headius/invokebinder", "path": "src/main/java/com/headius/invokebinder/Binder.java", "license": "apache-2.0", "size": 76964 }
[ "com.headius.invokebinder.transform.Transform", "java.lang.invoke.MethodType" ]
import com.headius.invokebinder.transform.Transform; import java.lang.invoke.MethodType;
import com.headius.invokebinder.transform.*; import java.lang.invoke.*;
[ "com.headius.invokebinder", "java.lang" ]
com.headius.invokebinder; java.lang;
250,511
@ServiceMethod(returns = ReturnType.SINGLE) public Mono<Response<Flux<ByteBuffer>>> deleteWithResponseAsync( String resourceGroupName, String virtualHubName, String routeTableName) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } if (virtualHubName == null) { return Mono.error(new IllegalArgumentException("Parameter virtualHubName is required and cannot be null.")); } if (routeTableName == null) { return Mono.error(new IllegalArgumentException("Parameter routeTableName is required and cannot be null.")); } final String apiVersion = "2020-05-01"; return FluxUtil .withContext( context -> service .delete( this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, virtualHubName, routeTableName, apiVersion, context)) .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); }
@ServiceMethod(returns = ReturnType.SINGLE) Mono<Response<Flux<ByteBuffer>>> function( String resourceGroupName, String virtualHubName, String routeTableName) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( STR)); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( STR)); } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException(STR)); } if (virtualHubName == null) { return Mono.error(new IllegalArgumentException(STR)); } if (routeTableName == null) { return Mono.error(new IllegalArgumentException(STR)); } final String apiVersion = STR; return FluxUtil .withContext( context -> service .delete( this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, virtualHubName, routeTableName, apiVersion, context)) .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); }
/** * Deletes a RouteTable. * * @param resourceGroupName The resource group name of the RouteTable. * @param virtualHubName The name of the VirtualHub. * @param routeTableName The name of the RouteTable. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */
Deletes a RouteTable
deleteWithResponseAsync
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/resourcemanager/azure-resourcemanager-network/src/main/java/com/azure/resourcemanager/network/implementation/HubRouteTablesClientImpl.java", "license": "mit", "size": 53453 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.http.rest.Response", "com.azure.core.util.FluxUtil", "java.nio.ByteBuffer" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.Response; import com.azure.core.util.FluxUtil; import java.nio.ByteBuffer;
import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.util.*; import java.nio.*;
[ "com.azure.core", "java.nio" ]
com.azure.core; java.nio;
2,750,029
public static Field<Double> cubeSize(Object __1) { CubeSize f = new CubeSize(); f.set__1(__1); return f.asField(); }
static Field<Double> function(Object __1) { CubeSize f = new CubeSize(); f.set__1(__1); return f.asField(); }
/** * Get <code>public.cube_size</code> as a field. */
Get <code>public.cube_size</code> as a field
cubeSize
{ "repo_name": "Remper/sociallink", "path": "alignments/src/main/java/eu/fbk/fm/alignments/index/db/Routines.java", "license": "apache-2.0", "size": 37686 }
[ "eu.fbk.fm.alignments.index.db.routines.CubeSize", "org.jooq.Field" ]
import eu.fbk.fm.alignments.index.db.routines.CubeSize; import org.jooq.Field;
import eu.fbk.fm.alignments.index.db.routines.*; import org.jooq.*;
[ "eu.fbk.fm", "org.jooq" ]
eu.fbk.fm; org.jooq;
2,219,528
@Function(name = "next", arity = 1) public static Object next(ExecutionContext cx, Object thisValue, Object value) { SubscriptionObserverObject o = thisSubscriptionObserverObject(cx, thisValue); SubscriptionObject subscription = o.getSubscription(); if (SubscriptionClosed(subscription)) { return UNDEFINED; } ScriptObject observer = subscription.getObserver(); try { Callable nextMethod = GetMethod(cx, observer, "next"); Object result; if (nextMethod == null) { result = UNDEFINED; } else { result = nextMethod.call(cx, observer, value); } return result; } catch (ScriptException e) { // FIXME: spec bug - CloseSubscription is not defined // FIXME: spec bug - incorrect ReturnIfAbrupt does not match tests try { CloseSubscription(cx, subscription); } catch (ScriptException ignore) { } throw e; } } /** * %SubscriptionObserverPrototype%.error ( exception ) * * @param cx * the execution context * @param thisValue * the function this-value * @param exception * the exception value * @return the result {@code this.[[Observer]].error()}
@Function(name = "next", arity = 1) static Object function(ExecutionContext cx, Object thisValue, Object value) { SubscriptionObserverObject o = thisSubscriptionObserverObject(cx, thisValue); SubscriptionObject subscription = o.getSubscription(); if (SubscriptionClosed(subscription)) { return UNDEFINED; } ScriptObject observer = subscription.getObserver(); try { Callable nextMethod = GetMethod(cx, observer, "next"); Object result; if (nextMethod == null) { result = UNDEFINED; } else { result = nextMethod.call(cx, observer, value); } return result; } catch (ScriptException e) { try { CloseSubscription(cx, subscription); } catch (ScriptException ignore) { } throw e; } } /** * %SubscriptionObserverPrototype%.error ( exception ) * * @param cx * the execution context * @param thisValue * the function this-value * @param exception * the exception value * @return the result {@code this.[[Observer]].error()}
/** * %SubscriptionObserverPrototype%.next ( value ) * * @param cx * the execution context * @param thisValue * the function this-value * @param value * the next value * @return the result {@code this.[[Observer]].next()} or {@code undefined} if this subscription is closed */
%SubscriptionObserverPrototype%.next ( value )
next
{ "repo_name": "jugglinmike/es6draft", "path": "src/main/java/com/github/anba/es6draft/runtime/objects/observable/SubscriptionObserverPrototype.java", "license": "mit", "size": 9012 }
[ "com.github.anba.es6draft.runtime.AbstractOperations", "com.github.anba.es6draft.runtime.ExecutionContext", "com.github.anba.es6draft.runtime.internal.Properties", "com.github.anba.es6draft.runtime.internal.ScriptException", "com.github.anba.es6draft.runtime.objects.observable.SubscriptionAbstractOperations", "com.github.anba.es6draft.runtime.types.Callable", "com.github.anba.es6draft.runtime.types.ScriptObject" ]
import com.github.anba.es6draft.runtime.AbstractOperations; import com.github.anba.es6draft.runtime.ExecutionContext; import com.github.anba.es6draft.runtime.internal.Properties; import com.github.anba.es6draft.runtime.internal.ScriptException; import com.github.anba.es6draft.runtime.objects.observable.SubscriptionAbstractOperations; import com.github.anba.es6draft.runtime.types.Callable; import com.github.anba.es6draft.runtime.types.ScriptObject;
import com.github.anba.es6draft.runtime.*; import com.github.anba.es6draft.runtime.internal.*; import com.github.anba.es6draft.runtime.objects.observable.*; import com.github.anba.es6draft.runtime.types.*;
[ "com.github.anba" ]
com.github.anba;
1,208,904
public String checksumRows(final HTable table) throws Exception { Scan scan = new Scan(); ResultScanner results = table.getScanner(scan); MessageDigest digest = MessageDigest.getInstance("MD5"); for (Result res : results) { digest.update(res.getRow()); } results.close(); return digest.toString(); }
String function(final HTable table) throws Exception { Scan scan = new Scan(); ResultScanner results = table.getScanner(scan); MessageDigest digest = MessageDigest.getInstance("MD5"); for (Result res : results) { digest.update(res.getRow()); } results.close(); return digest.toString(); }
/** * Return an md5 digest of the entire contents of a table. */
Return an md5 digest of the entire contents of a table
checksumRows
{ "repo_name": "bcopeland/hbase-thrift", "path": "src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java", "license": "apache-2.0", "size": 58875 }
[ "java.security.MessageDigest", "org.apache.hadoop.hbase.client.HTable", "org.apache.hadoop.hbase.client.Result", "org.apache.hadoop.hbase.client.ResultScanner", "org.apache.hadoop.hbase.client.Scan" ]
import java.security.MessageDigest; import org.apache.hadoop.hbase.client.HTable; import org.apache.hadoop.hbase.client.Result; import org.apache.hadoop.hbase.client.ResultScanner; import org.apache.hadoop.hbase.client.Scan;
import java.security.*; import org.apache.hadoop.hbase.client.*;
[ "java.security", "org.apache.hadoop" ]
java.security; org.apache.hadoop;
341,166
String checkEnd() throws StandardException { int end = fieldStart; for( ; fieldStart < len; fieldStart++) { if( str.charAt( fieldStart) != ' ') throw StandardException.newException( SQLState.LANG_DATE_SYNTAX_EXCEPTION); } currentSeparator = 0; while( end > 0 && str.charAt( end - 1) == ' ') end--; trimmedString = (end == len) ? str : str.substring( 0, end); return trimmedString; } // end of checkEnd
String checkEnd() throws StandardException { int end = fieldStart; for( ; fieldStart < len; fieldStart++) { if( str.charAt( fieldStart) != ' ') throw StandardException.newException( SQLState.LANG_DATE_SYNTAX_EXCEPTION); } currentSeparator = 0; while( end > 0 && str.charAt( end - 1) == ' ') end--; trimmedString = (end == len) ? str : str.substring( 0, end); return trimmedString; }
/** * Check that we are at the end of the string: that the rest of the characters, if any, are blanks. * * @return the original string with trailing blanks trimmed off. * @exception StandardException if there are more non-blank characters. */
Check that we are at the end of the string: that the rest of the characters, if any, are blanks
checkEnd
{ "repo_name": "lpxz/grail-derby104", "path": "java/engine/org/apache/derby/iapi/types/DateTimeParser.java", "license": "apache-2.0", "size": 7672 }
[ "org.apache.derby.iapi.error.StandardException", "org.apache.derby.iapi.reference.SQLState" ]
import org.apache.derby.iapi.error.StandardException; import org.apache.derby.iapi.reference.SQLState;
import org.apache.derby.iapi.error.*; import org.apache.derby.iapi.reference.*;
[ "org.apache.derby" ]
org.apache.derby;
1,596,236
@SuppressWarnings("unchecked") public List<UserGame> listInActive(final Game game, final Nation nation) { final Session session = getSessionFactory().getCurrentSession(); final Criteria criteria = session.createCriteria(UserGame.class); criteria.add(Restrictions.eq("current", false)); criteria.add(Restrictions.eq("game", game)); criteria.add(Restrictions.eq("nation", nation)); criteria.addOrder(Order.asc("turnPickUp")); return criteria.list(); }
@SuppressWarnings(STR) List<UserGame> function(final Game game, final Nation nation) { final Session session = getSessionFactory().getCurrentSession(); final Criteria criteria = session.createCriteria(UserGame.class); criteria.add(Restrictions.eq(STR, false)); criteria.add(Restrictions.eq("game", game)); criteria.add(Restrictions.eq(STR, nation)); criteria.addOrder(Order.asc(STR)); return criteria.list(); }
/** * Listing all inactive UserGame records from the database. * * @param game the Game object to filter records. * @param nation the Nation object to filter records. * @return a list of all inactive UserGames that exist inside the table UserGames. */
Listing all inactive UserGame records from the database
listInActive
{ "repo_name": "EaW1805/data", "path": "src/main/java/com/eaw1805/data/managers/UserGameManager.java", "license": "mit", "size": 15517 }
[ "com.eaw1805.data.model.Game", "com.eaw1805.data.model.Nation", "com.eaw1805.data.model.UserGame", "java.util.List", "org.hibernate.Criteria", "org.hibernate.Session", "org.hibernate.criterion.Order", "org.hibernate.criterion.Restrictions" ]
import com.eaw1805.data.model.Game; import com.eaw1805.data.model.Nation; import com.eaw1805.data.model.UserGame; import java.util.List; import org.hibernate.Criteria; import org.hibernate.Session; import org.hibernate.criterion.Order; import org.hibernate.criterion.Restrictions;
import com.eaw1805.data.model.*; import java.util.*; import org.hibernate.*; import org.hibernate.criterion.*;
[ "com.eaw1805.data", "java.util", "org.hibernate", "org.hibernate.criterion" ]
com.eaw1805.data; java.util; org.hibernate; org.hibernate.criterion;
1,357,874
public void assertIsInSameMinuteWindowAs(AssertionInfo info, Date actual, Date other) { assertNotNull(info, actual); dateParameterIsNotNull(other); if (!areInSameMinuteWindow(actual, other)) throw failures.failure(info, shouldBeInSameMinuteWindow(actual, other)); }
void function(AssertionInfo info, Date actual, Date other) { assertNotNull(info, actual); dateParameterIsNotNull(other); if (!areInSameMinuteWindow(actual, other)) throw failures.failure(info, shouldBeInSameMinuteWindow(actual, other)); }
/** * Verifies that actual and given {@code Date} are chronologically in the same minute. * @param info contains information about the assertion. * @param actual the "actual" {@code Date}. * @param other the given {@code Date} to compare actual {@code Date} to. * @throws AssertionError if {@code actual} is {@code null}. * @throws NullPointerException if other {@code Date} is {@code null}. * @throws AssertionError if actual and given {@code Date} are not chronologically speaking in the same minute. */
Verifies that actual and given Date are chronologically in the same minute
assertIsInSameMinuteWindowAs
{ "repo_name": "hazendaz/assertj-core", "path": "src/main/java/org/assertj/core/internal/Dates.java", "license": "apache-2.0", "size": 39823 }
[ "java.util.Date", "org.assertj.core.api.AssertionInfo", "org.assertj.core.error.ShouldBeInSameMinuteWindow" ]
import java.util.Date; import org.assertj.core.api.AssertionInfo; import org.assertj.core.error.ShouldBeInSameMinuteWindow;
import java.util.*; import org.assertj.core.api.*; import org.assertj.core.error.*;
[ "java.util", "org.assertj.core" ]
java.util; org.assertj.core;
2,697,404
@RequiresApi(value = 19) public static String getMimeTypeForFile(Context context, Uri uri){ DocumentFile f = DocumentFile.fromSingleUri(context, uri); if(f != null){ if(!StringUtilities.isNullOrEmpty(f.getType())){ return f.getType(); } } return "application/octet-stream"; }
@RequiresApi(value = 19) static String function(Context context, Uri uri){ DocumentFile f = DocumentFile.fromSingleUri(context, uri); if(f != null){ if(!StringUtilities.isNullOrEmpty(f.getType())){ return f.getType(); } } return STR; }
/** * Get the mime type for a Uri. * @param context * @param uri * @return */
Get the mime type for a Uri
getMimeTypeForFile
{ "repo_name": "PGMacDesign/PGMacUtilities", "path": "library/src/main/java/com/pgmacdesign/pgmactips/utilities/FileUtilities.java", "license": "apache-2.0", "size": 66064 }
[ "android.content.Context", "android.net.Uri", "androidx.annotation.RequiresApi", "androidx.documentfile.provider.DocumentFile" ]
import android.content.Context; import android.net.Uri; import androidx.annotation.RequiresApi; import androidx.documentfile.provider.DocumentFile;
import android.content.*; import android.net.*; import androidx.annotation.*; import androidx.documentfile.provider.*;
[ "android.content", "android.net", "androidx.annotation", "androidx.documentfile" ]
android.content; android.net; androidx.annotation; androidx.documentfile;
1,247,595
public void setWriteOffAmt (BigDecimal WriteOffAmt) { set_ValueNoCheck (COLUMNNAME_WriteOffAmt, WriteOffAmt); }
void function (BigDecimal WriteOffAmt) { set_ValueNoCheck (COLUMNNAME_WriteOffAmt, WriteOffAmt); }
/** Set Write-off Amount. @param WriteOffAmt Amount to write-off */
Set Write-off Amount
setWriteOffAmt
{ "repo_name": "arthurmelo88/palmetalADP", "path": "adempiere_360/base/src/org/compiere/model/X_C_AllocationLine.java", "license": "gpl-2.0", "size": 10337 }
[ "java.math.BigDecimal" ]
import java.math.BigDecimal;
import java.math.*;
[ "java.math" ]
java.math;
528,746
@ServiceMethod(returns = ReturnType.SINGLE) private Mono<BackupInstanceResourceInner> getAsync( String vaultName, String resourceGroupName, String backupInstanceName) { return getWithResponseAsync(vaultName, resourceGroupName, backupInstanceName) .flatMap( (Response<BackupInstanceResourceInner> res) -> { if (res.getValue() != null) { return Mono.just(res.getValue()); } else { return Mono.empty(); } }); }
@ServiceMethod(returns = ReturnType.SINGLE) Mono<BackupInstanceResourceInner> function( String vaultName, String resourceGroupName, String backupInstanceName) { return getWithResponseAsync(vaultName, resourceGroupName, backupInstanceName) .flatMap( (Response<BackupInstanceResourceInner> res) -> { if (res.getValue() != null) { return Mono.just(res.getValue()); } else { return Mono.empty(); } }); }
/** * Gets a backup instance with name in a backup vault. * * @param vaultName The name of the backup vault. * @param resourceGroupName The name of the resource group where the backup vault is present. * @param backupInstanceName The name of the backup instance. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a backup instance with name in a backup vault. */
Gets a backup instance with name in a backup vault
getAsync
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/dataprotection/azure-resourcemanager-dataprotection/src/main/java/com/azure/resourcemanager/dataprotection/implementation/BackupInstancesClientImpl.java", "license": "mit", "size": 135868 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.http.rest.Response", "com.azure.resourcemanager.dataprotection.fluent.models.BackupInstanceResourceInner" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.Response; import com.azure.resourcemanager.dataprotection.fluent.models.BackupInstanceResourceInner;
import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.resourcemanager.dataprotection.fluent.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
2,756,425
@Nonnull O visit(@Nonnull OWLSubPropertyChainOfAxiom axiom);
O visit(@Nonnull OWLSubPropertyChainOfAxiom axiom);
/** * visit OWLSubPropertyChainOfAxiom type * * @param axiom * axiom to visit * @return visitor value */
visit OWLSubPropertyChainOfAxiom type
visit
{ "repo_name": "matthewhorridge/owlapi-gwt", "path": "owlapi-gwt-client-side-emul/src/main/java/org/semanticweb/owlapi/model/OWLLogicalAxiomVisitorEx.java", "license": "lgpl-3.0", "size": 9088 }
[ "javax.annotation.Nonnull" ]
import javax.annotation.Nonnull;
import javax.annotation.*;
[ "javax.annotation" ]
javax.annotation;
905,814
public static Object getProperty(final Object target, final String fieldName) throws IllegalAccessException { Field field = getField(target, fieldName); Preconditions.checkNotNull(field); field.setAccessible(true); return field.get(target); }
static Object function(final Object target, final String fieldName) throws IllegalAccessException { Field field = getField(target, fieldName); Preconditions.checkNotNull(field); field.setAccessible(true); return field.get(target); }
/** * Get property. * * @param target target * @param fieldName field name * @return property * @throws IllegalAccessException illegal access exception */
Get property
getProperty
{ "repo_name": "dangdangdotcom/sharding-jdbc", "path": "sharding-transaction/sharding-transaction-2pc/sharding-transaction-2pc-xa/src/test/java/io/shardingsphere/transaction/xa/fixture/ReflectiveUtil.java", "license": "apache-2.0", "size": 3660 }
[ "com.google.common.base.Preconditions", "java.lang.reflect.Field" ]
import com.google.common.base.Preconditions; import java.lang.reflect.Field;
import com.google.common.base.*; import java.lang.reflect.*;
[ "com.google.common", "java.lang" ]
com.google.common; java.lang;
2,364,130
public static boolean isCarFileDeployed(String backendURL, String sessionCookie, String carFileName) throws ApplicationAdminExceptionException, RemoteException { ApplicationAdminClient appAdminClient = new ApplicationAdminClient(backendURL,sessionCookie); log.info("waiting " + MAX_TIME + " millis for car deployment " + carFileName); boolean isCarFileDeployed = false; Calendar startTime = Calendar.getInstance(); long time; while ((time = (Calendar.getInstance().getTimeInMillis() - startTime.getTimeInMillis())) < MAX_TIME) { String[] applicationList = appAdminClient.listAllApplications(); if (applicationList != null) { if (ArrayUtils.contains(applicationList, carFileName.replace("-", "_"))) { isCarFileDeployed = true; log.info("car file deployed in " + time + " mills"); return isCarFileDeployed; } } try { Thread.sleep(1000); } catch (InterruptedException e) { //ignore } } return isCarFileDeployed; }
static boolean function(String backendURL, String sessionCookie, String carFileName) throws ApplicationAdminExceptionException, RemoteException { ApplicationAdminClient appAdminClient = new ApplicationAdminClient(backendURL,sessionCookie); log.info(STR + MAX_TIME + STR + carFileName); boolean isCarFileDeployed = false; Calendar startTime = Calendar.getInstance(); long time; while ((time = (Calendar.getInstance().getTimeInMillis() - startTime.getTimeInMillis())) < MAX_TIME) { String[] applicationList = appAdminClient.listAllApplications(); if (applicationList != null) { if (ArrayUtils.contains(applicationList, carFileName.replace("-", "_"))) { isCarFileDeployed = true; log.info(STR + time + STR); return isCarFileDeployed; } } try { Thread.sleep(1000); } catch (InterruptedException e) { } } return isCarFileDeployed; }
/** * This will check whether given car file is deployed successfully within the defined time period * @param backendURL management server url * @param sessionCookie user session cookie * @param carFileName car file name * @return true if car file is deployed within the defined time * @throws ApplicationAdminExceptionException when error occurred in service * @throws RemoteException when error occurred while calling the service */
This will check whether given car file is deployed successfully within the defined time period
isCarFileDeployed
{ "repo_name": "nuwanw/product-as", "path": "modules/integration/tests-common/integration-test-utils/src/main/java/org/wso2/appserver/integration/common/utils/CarAppDeploymentUtil.java", "license": "apache-2.0", "size": 4710 }
[ "java.rmi.RemoteException", "java.util.Calendar", "org.apache.commons.lang.ArrayUtils", "org.wso2.carbon.application.mgt.stub.ApplicationAdminExceptionException", "org.wso2.carbon.integration.common.admin.client.ApplicationAdminClient" ]
import java.rmi.RemoteException; import java.util.Calendar; import org.apache.commons.lang.ArrayUtils; import org.wso2.carbon.application.mgt.stub.ApplicationAdminExceptionException; import org.wso2.carbon.integration.common.admin.client.ApplicationAdminClient;
import java.rmi.*; import java.util.*; import org.apache.commons.lang.*; import org.wso2.carbon.application.mgt.stub.*; import org.wso2.carbon.integration.common.admin.client.*;
[ "java.rmi", "java.util", "org.apache.commons", "org.wso2.carbon" ]
java.rmi; java.util; org.apache.commons; org.wso2.carbon;
1,729,786
private void populateProjects() { if (projectNameComboBox != null) { IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects(); int i = 0, selectedProjectIndex = -1; for (IProject prj : projects) { try { if (prj.hasNature(IAndroidConstants.ANDROID_NATURE)) { projectNameComboBox.add(prj.getName()); projectNameComboBox.setData(prj.getName(), prj); if ((javaProject != null) && prj.equals(javaProject)) { selectedProjectIndex = i; } i++; } } catch (CoreException e) { StudioLogger.info(CodeUtilsNLS.Info_ChooseLayoutItemsDialog_Project_Nature); } } if (projectNameComboBox.getItemCount() > 0) { if (selectedProjectIndex == -1) { projectNameComboBox.select(0); setJavaProject((IProject) projectNameComboBox.getData(projectNameComboBox .getText())); } else { projectNameComboBox.select(selectedProjectIndex); } } validate(); } }
void function() { if (projectNameComboBox != null) { IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects(); int i = 0, selectedProjectIndex = -1; for (IProject prj : projects) { try { if (prj.hasNature(IAndroidConstants.ANDROID_NATURE)) { projectNameComboBox.add(prj.getName()); projectNameComboBox.setData(prj.getName(), prj); if ((javaProject != null) && prj.equals(javaProject)) { selectedProjectIndex = i; } i++; } } catch (CoreException e) { StudioLogger.info(CodeUtilsNLS.Info_ChooseLayoutItemsDialog_Project_Nature); } } if (projectNameComboBox.getItemCount() > 0) { if (selectedProjectIndex == -1) { projectNameComboBox.select(0); setJavaProject((IProject) projectNameComboBox.getData(projectNameComboBox .getText())); } else { projectNameComboBox.select(selectedProjectIndex); } } validate(); } }
/** * Populate the combobox that holds projects, with information gathered from the ResourcesPlugin. * also selects the project set in the init method */
Populate the combobox that holds projects, with information gathered from the ResourcesPlugin. also selects the project set in the init method
populateProjects
{ "repo_name": "rex-xxx/mt6572_x201", "path": "tools/motodev/src/plugins/android.codeutils/src/com/motorola/studio/android/generateviewbylayout/ui/AbstractLayoutItemsDialog.java", "license": "gpl-2.0", "size": 26409 }
[ "com.motorola.studio.android.codeutils.i18n.CodeUtilsNLS", "com.motorola.studio.android.common.IAndroidConstants", "com.motorola.studio.android.common.log.StudioLogger", "org.eclipse.core.resources.IProject", "org.eclipse.core.resources.ResourcesPlugin", "org.eclipse.core.runtime.CoreException" ]
import com.motorola.studio.android.codeutils.i18n.CodeUtilsNLS; import com.motorola.studio.android.common.IAndroidConstants; import com.motorola.studio.android.common.log.StudioLogger; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException;
import com.motorola.studio.android.codeutils.i18n.*; import com.motorola.studio.android.common.*; import com.motorola.studio.android.common.log.*; import org.eclipse.core.resources.*; import org.eclipse.core.runtime.*;
[ "com.motorola.studio", "org.eclipse.core" ]
com.motorola.studio; org.eclipse.core;
177,133
public ByteBuffer getPeerId() { return this.peerId; }
ByteBuffer function() { return this.peerId; }
/** * Returns the raw peer ID as a {@link ByteBuffer}. */
Returns the raw peer ID as a <code>ByteBuffer</code>
getPeerId
{ "repo_name": "zanella/ttorrent", "path": "core/src/main/java/com/turn/ttorrent/common/Peer.java", "license": "apache-2.0", "size": 4465 }
[ "java.nio.ByteBuffer" ]
import java.nio.ByteBuffer;
import java.nio.*;
[ "java.nio" ]
java.nio;
409,076
private static Changeset[] createChangesets(long scmDate, int lines) { Changeset changetset = Changeset.newChangesetBuilder().setDate(scmDate).setRevision("rev-1").build(); Changeset[] changesets = new Changeset[lines]; for (int i = 0; i < lines; i++) { changesets[i] = changetset; } return changesets; }
static Changeset[] function(long scmDate, int lines) { Changeset changetset = Changeset.newChangesetBuilder().setDate(scmDate).setRevision("rev-1").build(); Changeset[] changesets = new Changeset[lines]; for (int i = 0; i < lines; i++) { changesets[i] = changetset; } return changesets; }
/** * Creates changesets of {@code lines} lines which all have the same date {@code scmDate}. */
Creates changesets of lines lines which all have the same date scmDate
createChangesets
{ "repo_name": "lbndev/sonarqube", "path": "server/sonar-server/src/test/java/org/sonar/server/computation/task/projectanalysis/qualitymodel/NewMaintainabilityMeasuresVisitorTest.java", "license": "lgpl-3.0", "size": 21961 }
[ "org.sonar.server.computation.task.projectanalysis.scm.Changeset" ]
import org.sonar.server.computation.task.projectanalysis.scm.Changeset;
import org.sonar.server.computation.task.projectanalysis.scm.*;
[ "org.sonar.server" ]
org.sonar.server;
812,024
public String lastName() { Nationality nacionality = nationality(); return lastName(nacionality); }
String function() { Nationality nacionality = nationality(); return lastName(nacionality); }
/** * Generate a random last name. * <pre> * chance.lastName(); * => "Nannucci" * </pre> * * @return A random last name */
Generate a random last name. <code> chance.lastName(); => "Nannucci" </code>
lastName
{ "repo_name": "open-fidias/chance4j", "path": "src/main/java/br/com/fidias/chance4j/Chance.java", "license": "gpl-3.0", "size": 58799 }
[ "br.com.fidias.chance4j.person.name.Nationality" ]
import br.com.fidias.chance4j.person.name.Nationality;
import br.com.fidias.chance4j.person.name.*;
[ "br.com.fidias" ]
br.com.fidias;
750,791
@Override public void mapTileRequestExpiredTile(MapTileRequestState pState, CacheableBitmapDrawable pDrawable) { // Put the expired tile into the cache putExpiredTileIntoCache(pState.getMapTile(), pDrawable.getBitmap()); // tell our caller we've finished and it should update its view if (mTileRequestCompleteHandler != null) { mTileRequestCompleteHandler.sendEmptyMessage(MapTile.MAPTILE_SUCCESS_ID); } if (DEBUG_TILE_PROVIDERS) { Log.i(TAG, "MapTileLayerBase.mapTileRequestExpiredTile(): " + pState.getMapTile()); } }
void function(MapTileRequestState pState, CacheableBitmapDrawable pDrawable) { putExpiredTileIntoCache(pState.getMapTile(), pDrawable.getBitmap()); if (mTileRequestCompleteHandler != null) { mTileRequestCompleteHandler.sendEmptyMessage(MapTile.MAPTILE_SUCCESS_ID); } if (DEBUG_TILE_PROVIDERS) { Log.i(TAG, STR + pState.getMapTile()); } }
/** * Called by implementation class methods indicating that they have produced an expired result * that can be used but better results may be delivered later. The tile is added to the cache, * and a MAPTILE_SUCCESS_ID message is sent. * * @param pState the map tile request state object * @param pDrawable the Drawable of the map tile */
Called by implementation class methods indicating that they have produced an expired result that can be used but better results may be delivered later. The tile is added to the cache, and a MAPTILE_SUCCESS_ID message is sent
mapTileRequestExpiredTile
{ "repo_name": "mikelmaron/OpenMapKit", "path": "MapboxAndroidSDK/src/main/java/com/mapbox/mapboxsdk/tileprovider/MapTileLayerBase.java", "license": "gpl-3.0", "size": 10608 }
[ "android.util.Log", "uk.co.senab.bitmapcache.CacheableBitmapDrawable" ]
import android.util.Log; import uk.co.senab.bitmapcache.CacheableBitmapDrawable;
import android.util.*; import uk.co.senab.bitmapcache.*;
[ "android.util", "uk.co.senab" ]
android.util; uk.co.senab;
755,423
public static Date rollMockClockMillis(long millis) { if (mockTime == null) { mockTime = new Date(); } mockTime = new Date(mockTime.getTime() + millis); return mockTime; }
static Date function(long millis) { if (mockTime == null) { mockTime = new Date(); } mockTime = new Date(mockTime.getTime() + millis); return mockTime; }
/** * Advances (or rewinds) the mock clock by the given number of milliseconds. */
Advances (or rewinds) the mock clock by the given number of milliseconds
rollMockClockMillis
{ "repo_name": "QuincySx/vport-android", "path": "crypto/src/main/java/com/a21vianet/quincysx/library/crypto/utils/Utils.java", "license": "mit", "size": 35378 }
[ "java.util.Date" ]
import java.util.Date;
import java.util.*;
[ "java.util" ]
java.util;
172,574
Map<String, String> getAdditionalParameters();
Map<String, String> getAdditionalParameters();
/** * The additional OAuth parameters for this protected resource. * * @return The additional OAuth parameters for this protected resource, or null if none. */
The additional OAuth parameters for this protected resource
getAdditionalParameters
{ "repo_name": "jgrandja/spring-security-oauth", "path": "spring-security-oauth/src/main/java/org/springframework/security/oauth/consumer/ProtectedResourceDetails.java", "license": "apache-2.0", "size": 3404 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
2,778,453
private void updateSwaggerSecurityDefinition(OpenAPI openAPI, SwaggerData swaggerData, String authUrl) { if (openAPI.getComponents() == null) { openAPI.setComponents(new Components()); } Map<String, SecurityScheme> securitySchemes = openAPI.getComponents().getSecuritySchemes(); if (securitySchemes == null) { securitySchemes = new HashMap<>(); openAPI.getComponents().setSecuritySchemes(securitySchemes); } SecurityScheme securityScheme = securitySchemes.get(OPENAPI_SECURITY_SCHEMA_KEY); if (securityScheme == null) { securityScheme = new SecurityScheme(); securityScheme.setType(SecurityScheme.Type.OAUTH2); securitySchemes.put(OPENAPI_SECURITY_SCHEMA_KEY, securityScheme); List<SecurityRequirement> security = new ArrayList<SecurityRequirement>(); SecurityRequirement secReq = new SecurityRequirement(); secReq.addList(OPENAPI_SECURITY_SCHEMA_KEY, new ArrayList<String>()); security.add(secReq); openAPI.setSecurity(security); } if (securityScheme.getFlows() == null) { securityScheme.setFlows(new OAuthFlows()); } OAuthFlow oAuthFlow = securityScheme.getFlows().getImplicit(); if (oAuthFlow == null) { oAuthFlow = new OAuthFlow(); securityScheme.getFlows().setImplicit(oAuthFlow); } oAuthFlow.setAuthorizationUrl(authUrl); Scopes oas3Scopes = new Scopes(); Set<Scope> scopes = swaggerData.getScopes(); if (scopes != null && !scopes.isEmpty()) { Map<String, String> scopeBindings = new HashMap<>(); for (Scope scope : scopes) { oas3Scopes.put(scope.getKey(), scope.getDescription()); scopeBindings.put(scope.getKey(), scope.getRoles()); } oAuthFlow.addExtension(APIConstants.SWAGGER_X_SCOPES_BINDINGS, scopeBindings); } oAuthFlow.setScopes(oas3Scopes); }
void function(OpenAPI openAPI, SwaggerData swaggerData, String authUrl) { if (openAPI.getComponents() == null) { openAPI.setComponents(new Components()); } Map<String, SecurityScheme> securitySchemes = openAPI.getComponents().getSecuritySchemes(); if (securitySchemes == null) { securitySchemes = new HashMap<>(); openAPI.getComponents().setSecuritySchemes(securitySchemes); } SecurityScheme securityScheme = securitySchemes.get(OPENAPI_SECURITY_SCHEMA_KEY); if (securityScheme == null) { securityScheme = new SecurityScheme(); securityScheme.setType(SecurityScheme.Type.OAUTH2); securitySchemes.put(OPENAPI_SECURITY_SCHEMA_KEY, securityScheme); List<SecurityRequirement> security = new ArrayList<SecurityRequirement>(); SecurityRequirement secReq = new SecurityRequirement(); secReq.addList(OPENAPI_SECURITY_SCHEMA_KEY, new ArrayList<String>()); security.add(secReq); openAPI.setSecurity(security); } if (securityScheme.getFlows() == null) { securityScheme.setFlows(new OAuthFlows()); } OAuthFlow oAuthFlow = securityScheme.getFlows().getImplicit(); if (oAuthFlow == null) { oAuthFlow = new OAuthFlow(); securityScheme.getFlows().setImplicit(oAuthFlow); } oAuthFlow.setAuthorizationUrl(authUrl); Scopes oas3Scopes = new Scopes(); Set<Scope> scopes = swaggerData.getScopes(); if (scopes != null && !scopes.isEmpty()) { Map<String, String> scopeBindings = new HashMap<>(); for (Scope scope : scopes) { oas3Scopes.put(scope.getKey(), scope.getDescription()); scopeBindings.put(scope.getKey(), scope.getRoles()); } oAuthFlow.addExtension(APIConstants.SWAGGER_X_SCOPES_BINDINGS, scopeBindings); } oAuthFlow.setScopes(oas3Scopes); }
/** * Include Scope details to the definition * * @param openAPI openapi definition * @param swaggerData Swagger related API data */
Include Scope details to the definition
updateSwaggerSecurityDefinition
{ "repo_name": "nuwand/carbon-apimgt", "path": "components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/definitions/OAS3Parser.java", "license": "apache-2.0", "size": 75509 }
[ "io.swagger.v3.oas.models.Components", "io.swagger.v3.oas.models.OpenAPI", "io.swagger.v3.oas.models.security.OAuthFlow", "io.swagger.v3.oas.models.security.OAuthFlows", "io.swagger.v3.oas.models.security.Scopes", "io.swagger.v3.oas.models.security.SecurityRequirement", "io.swagger.v3.oas.models.security.SecurityScheme", "java.util.ArrayList", "java.util.HashMap", "java.util.List", "java.util.Map", "java.util.Set", "org.wso2.carbon.apimgt.api.model.Scope", "org.wso2.carbon.apimgt.api.model.SwaggerData", "org.wso2.carbon.apimgt.impl.APIConstants" ]
import io.swagger.v3.oas.models.Components; import io.swagger.v3.oas.models.OpenAPI; import io.swagger.v3.oas.models.security.OAuthFlow; import io.swagger.v3.oas.models.security.OAuthFlows; import io.swagger.v3.oas.models.security.Scopes; import io.swagger.v3.oas.models.security.SecurityRequirement; import io.swagger.v3.oas.models.security.SecurityScheme; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; import org.wso2.carbon.apimgt.api.model.Scope; import org.wso2.carbon.apimgt.api.model.SwaggerData; import org.wso2.carbon.apimgt.impl.APIConstants;
import io.swagger.v3.oas.models.*; import io.swagger.v3.oas.models.security.*; import java.util.*; import org.wso2.carbon.apimgt.api.model.*; import org.wso2.carbon.apimgt.impl.*;
[ "io.swagger.v3", "java.util", "org.wso2.carbon" ]
io.swagger.v3; java.util; org.wso2.carbon;
2,570,725
public static void verifyGolden(TestCase test, Object object, SerializableAssert comparator) throws Exception { Assert.assertNotNull("Null comparator", comparator); Serializable deserialized = getObject(test, ".golden.ser"); comparator.assertDeserialized((Serializable) object, deserialized); }
static void function(TestCase test, Object object, SerializableAssert comparator) throws Exception { Assert.assertNotNull(STR, comparator); Serializable deserialized = getObject(test, STR); comparator.assertDeserialized((Serializable) object, deserialized); }
/** * Verifies that object deserialized from golden file correctly. * * The method loads "<code>testName</code>.golden.ser" resource file * from "<module root>/src/test/resources/serialization/<code>testPackage</code>" * folder, reads an object from the loaded file and compares it with * <code>object</code> using specified <code>comparator</code>. * * @param test- * test case * @param object- * to be compared * @param comparator - * for comparing (de)serialized objects */
Verifies that object deserialized from golden file correctly. The method loads "<code>testName</code>.golden.ser" resource file from "/src/test/resources/serialization/<code>testPackage</code>" folder, reads an object from the loaded file and compares it with <code>object</code> using specified <code>comparator</code>
verifyGolden
{ "repo_name": "rex-xxx/mt6572_x201", "path": "external/apache-harmony/support/src/test/java/org/apache/harmony/testframework/serialization/SerializationTest.java", "license": "gpl-2.0", "size": 22964 }
[ "java.io.Serializable", "junit.framework.Assert", "junit.framework.TestCase" ]
import java.io.Serializable; import junit.framework.Assert; import junit.framework.TestCase;
import java.io.*; import junit.framework.*;
[ "java.io", "junit.framework" ]
java.io; junit.framework;
1,550,753
protected Component createEditor(String name, Component parentComponent, final ModelElementsCollection collection) { editor = collection.getEJS().getModelEditor(); JPanel topPanel = createTopPanel(); JPanel variablesPanel = createVariablesPanel(); JButton closeButton = createCloseButton(); JPanel mainPanel = new JPanel(); mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS)); mainPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); mainPanel.setPreferredSize(new Dimension(430, 400)); mainPanel.add(topPanel); mainPanel.add(variablesPanel); mainPanel.add(closeButton); return mainPanel; }
Component function(String name, Component parentComponent, final ModelElementsCollection collection) { editor = collection.getEJS().getModelEditor(); JPanel topPanel = createTopPanel(); JPanel variablesPanel = createVariablesPanel(); JButton closeButton = createCloseButton(); JPanel mainPanel = new JPanel(); mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS)); mainPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); mainPanel.setPreferredSize(new Dimension(430, 400)); mainPanel.add(topPanel); mainPanel.add(variablesPanel); mainPanel.add(closeButton); return mainPanel; }
/** * Create the editor to configure the element */
Create the editor to configure the element
createEditor
{ "repo_name": "jcsombria/softwarelinks-ejs-matlabconnector", "path": "rip-matlab-client/src/es/uned/dia/jcsombria/softwarelinks/elements/MatlabJsonRpcElement.java", "license": "gpl-2.0", "size": 15680 }
[ "java.awt.Component", "java.awt.Dimension", "javax.swing.BoxLayout", "javax.swing.JButton", "javax.swing.JPanel", "javax.swing.border.EmptyBorder", "org.colos.ejs.model_elements.ModelElementsCollection" ]
import java.awt.Component; import java.awt.Dimension; import javax.swing.BoxLayout; import javax.swing.JButton; import javax.swing.JPanel; import javax.swing.border.EmptyBorder; import org.colos.ejs.model_elements.ModelElementsCollection;
import java.awt.*; import javax.swing.*; import javax.swing.border.*; import org.colos.ejs.model_elements.*;
[ "java.awt", "javax.swing", "org.colos.ejs" ]
java.awt; javax.swing; org.colos.ejs;
7,773
public boolean selectButton(String button) throws DawgTestException { try { RemoteWebDriver driver = TestContext.getCurrent().get(DawgHouseConstants.CONTEXT_WEB_DRIVER); By element = null; if (DawgHouseConstants.BTN_CLOSE.equalsIgnoreCase(button)) { element = By.xpath(DawgHousePageElements.CLOSE_BTN_XPATH); } else if (DawgHouseConstants.BTN_SAVE.equalsIgnoreCase(button)) { element = By.className(DawgHousePageElements.SAVE_BTN_CLASS); } else { throw new DawgTestException("Invalid " + button + " button is passed"); } // Checking if button displayed or not for (WebElement ele : driver.findElements(element)) { if (ele.isDisplayed()) { ele.click(); return true; } } } catch (NoSuchElementException e) { LOGGER.error("Failed to inspect " + button + "button in the edit device overlay"); } return false; }
boolean function(String button) throws DawgTestException { try { RemoteWebDriver driver = TestContext.getCurrent().get(DawgHouseConstants.CONTEXT_WEB_DRIVER); By element = null; if (DawgHouseConstants.BTN_CLOSE.equalsIgnoreCase(button)) { element = By.xpath(DawgHousePageElements.CLOSE_BTN_XPATH); } else if (DawgHouseConstants.BTN_SAVE.equalsIgnoreCase(button)) { element = By.className(DawgHousePageElements.SAVE_BTN_CLASS); } else { throw new DawgTestException(STR + button + STR); } for (WebElement ele : driver.findElements(element)) { if (ele.isDisplayed()) { ele.click(); return true; } } } catch (NoSuchElementException e) { LOGGER.error(STR + button + STR); } return false; }
/** * Method to select buttons(Close/Save) in edit device overlay * @param button * Edit device overlay button * @return boolean * true if edit device overlay button is selected, false otherwise * @throws DawgTestException */
Method to select buttons(Close/Save) in edit device overlay
selectButton
{ "repo_name": "vmatha002c/dawg", "path": "functional-tests/src/main/java/com/comcast/dawg/helper/DawgEditDevicePageHelper.java", "license": "apache-2.0", "size": 13751 }
[ "com.comcast.dawg.DawgTestException", "com.comcast.dawg.constants.DawgHouseConstants", "com.comcast.dawg.constants.DawgHousePageElements", "com.comcast.zucchini.TestContext", "org.openqa.selenium.By", "org.openqa.selenium.NoSuchElementException", "org.openqa.selenium.WebElement", "org.openqa.selenium.remote.RemoteWebDriver" ]
import com.comcast.dawg.DawgTestException; import com.comcast.dawg.constants.DawgHouseConstants; import com.comcast.dawg.constants.DawgHousePageElements; import com.comcast.zucchini.TestContext; import org.openqa.selenium.By; import org.openqa.selenium.NoSuchElementException; import org.openqa.selenium.WebElement; import org.openqa.selenium.remote.RemoteWebDriver;
import com.comcast.dawg.*; import com.comcast.dawg.constants.*; import com.comcast.zucchini.*; import org.openqa.selenium.*; import org.openqa.selenium.remote.*;
[ "com.comcast.dawg", "com.comcast.zucchini", "org.openqa.selenium" ]
com.comcast.dawg; com.comcast.zucchini; org.openqa.selenium;
1,091,955
@Test public void testGetPropertyNames() { JsonObject testJsonObject = this.createJsonObject(this.createUnderlyingJsonObject()); Set<String> testPropertyNames = new HashSet<String>(Arrays.asList("one", "two", "three", "four", "five")); for (String testPropertyName : testPropertyNames) { testJsonObject.setObjectProperty(testPropertyName, null); } assertEquals(testPropertyNames, testJsonObject.getPropertyNames()); }
void function() { JsonObject testJsonObject = this.createJsonObject(this.createUnderlyingJsonObject()); Set<String> testPropertyNames = new HashSet<String>(Arrays.asList("one", "two", "three", "four", "five")); for (String testPropertyName : testPropertyNames) { testJsonObject.setObjectProperty(testPropertyName, null); } assertEquals(testPropertyNames, testJsonObject.getPropertyNames()); }
/** * Test the retrieval of the names of the properties. * <p> * This test asserts that the retrieved property names match the names of the * properties of the underlying JavaScript object. */
Test the retrieval of the names of the properties. This test asserts that the retrieved property names match the names of the properties of the underlying JavaScript object
testGetPropertyNames
{ "repo_name": "kjots/json-toolkit", "path": "json-object.shared/src/test/java/org/kjots/json/object/shared/impl/JsonObjectImplTestBase.java", "license": "apache-2.0", "size": 22874 }
[ "java.util.Arrays", "java.util.HashSet", "java.util.Set", "junit.framework.Assert", "org.kjots.json.object.shared.JsonObject" ]
import java.util.Arrays; import java.util.HashSet; import java.util.Set; import junit.framework.Assert; import org.kjots.json.object.shared.JsonObject;
import java.util.*; import junit.framework.*; import org.kjots.json.object.shared.*;
[ "java.util", "junit.framework", "org.kjots.json" ]
java.util; junit.framework; org.kjots.json;
1,224,138
public Optional<Warp> getMatch(Comparator<Warp> comparator) { return IterableUtils.getFirst(getMatches(comparator)); }
Optional<Warp> function(Comparator<Warp> comparator) { return IterableUtils.getFirst(getMatches(comparator)); }
/** * Gets an Optional that contains the Warp that matches this Matchers criteria and is the first when sorting all * matching warps with the given Comparator (if such a Warp exists). * * @param comparator the comparator used to sort the matches * @return a matching Warp */
Gets an Optional that contains the Warp that matches this Matchers criteria and is the first when sorting all matching warps with the given Comparator (if such a Warp exists)
getMatch
{ "repo_name": "epicbastion/MyWarp", "path": "mywarp-core/src/main/java/me/taylorkelly/mywarp/util/MatchList.java", "license": "gpl-3.0", "size": 5037 }
[ "com.google.common.base.Optional", "java.util.Comparator", "me.taylorkelly.mywarp.warp.Warp" ]
import com.google.common.base.Optional; import java.util.Comparator; import me.taylorkelly.mywarp.warp.Warp;
import com.google.common.base.*; import java.util.*; import me.taylorkelly.mywarp.warp.*;
[ "com.google.common", "java.util", "me.taylorkelly.mywarp" ]
com.google.common; java.util; me.taylorkelly.mywarp;
2,406,874
public B substituteProperties(final B b, final Properties submittedProps, final Properties parentProps);
B function(final B b, final Properties submittedProps, final Properties parentProps);
/** * Performs property substitution on a given batch element b and all nested * sub elements. The given batch element is directly modified by this * method. * * @param b * @param submittedProps Properties submitted as job parameters * @param parentProps Properties inherited from parent elements * @return */
Performs property substitution on a given batch element b and all nested sub elements. The given batch element is directly modified by this method
substituteProperties
{ "repo_name": "WASdev/standards.jsr352.jbatch", "path": "com.ibm.jbatch.container/src/main/java/com/ibm/jbatch/container/modelresolver/PropertyResolver.java", "license": "apache-2.0", "size": 1792 }
[ "java.util.Properties" ]
import java.util.Properties;
import java.util.*;
[ "java.util" ]
java.util;
2,686,445
private Deferred<List<String>> resolveAggTags(final Set<byte[]> tagks) { if (aggregated_tags != null) { return Deferred.fromResult(null); } aggregated_tags = new ArrayList<String>(tagks.size()); final List<Deferred<String>> names = new ArrayList<Deferred<String>>(tagks.size()); for (final byte[] tagk : tagks) { names.add(tsdb.tag_names.getNameAsync(tagk)); }
Deferred<List<String>> function(final Set<byte[]> tagks) { if (aggregated_tags != null) { return Deferred.fromResult(null); } aggregated_tags = new ArrayList<String>(tagks.size()); final List<Deferred<String>> names = new ArrayList<Deferred<String>>(tagks.size()); for (final byte[] tagk : tagks) { names.add(tsdb.tag_names.getNameAsync(tagk)); }
/** * Resolves the set of tag keys to their string names. * @param tagks The set of unique tag names * @return a deferred to wait on for all of the tag keys to be resolved. The * result should be null. */
Resolves the set of tag keys to their string names
resolveAggTags
{ "repo_name": "eswdd/opentsdb", "path": "src/core/SpanGroup.java", "license": "lgpl-2.1", "size": 19547 }
[ "com.stumbleupon.async.Deferred", "java.util.ArrayList", "java.util.List", "java.util.Set" ]
import com.stumbleupon.async.Deferred; import java.util.ArrayList; import java.util.List; import java.util.Set;
import com.stumbleupon.async.*; import java.util.*;
[ "com.stumbleupon.async", "java.util" ]
com.stumbleupon.async; java.util;
1,646,871
public static int getNextRequestId(Context context) { SharedPreferences pref = context.getSharedPreferences("GEAR_CONSOLE", Context.MODE_PRIVATE); int requestId = pref.getInt("requestId", 1); SharedPreferences.Editor editor = pref.edit(); editor.putInt("requestId", ++requestId); editor.commit(); return requestId; }
static int function(Context context) { SharedPreferences pref = context.getSharedPreferences(STR, Context.MODE_PRIVATE); int requestId = pref.getInt(STR, 1); SharedPreferences.Editor editor = pref.edit(); editor.putInt(STR, ++requestId); editor.commit(); return requestId; }
/** * Return next requestId by incrementing previous * then store it to SharedPreferences * @param context * @return */
Return next requestId by incrementing previous then store it to SharedPreferences
getNextRequestId
{ "repo_name": "SamsungDeveloperCIS/GearConsoleSDK", "path": "GearConsoleSDKAndroid/gearconsolesdk/src/main/java/com/samsung/mscr/gearconsolesdk/library/GCUtils.java", "license": "apache-2.0", "size": 4765 }
[ "android.content.Context", "android.content.SharedPreferences" ]
import android.content.Context; import android.content.SharedPreferences;
import android.content.*;
[ "android.content" ]
android.content;
2,323,639
private IReportItem newReportItem( String extensionName, ReportDesignHandle designHandle ) { ExtendedItem extendedItem = new ExtendedItem( ); extendedItem.setProperty( IExtendedItemModel.EXTENSION_NAME_PROP, extensionName ); ExtendedItemHandle extendedItemHandle = (ExtendedItemHandle) extendedItem .getHandle( designHandle.getModule( ) ); CrosstabItemFactory factory = new CrosstabItemFactory( ); IReportItem item = factory.newReportItem( extendedItemHandle ); return item; }
IReportItem function( String extensionName, ReportDesignHandle designHandle ) { ExtendedItem extendedItem = new ExtendedItem( ); extendedItem.setProperty( IExtendedItemModel.EXTENSION_NAME_PROP, extensionName ); ExtendedItemHandle extendedItemHandle = (ExtendedItemHandle) extendedItem .getHandle( designHandle.getModule( ) ); CrosstabItemFactory factory = new CrosstabItemFactory( ); IReportItem item = factory.newReportItem( extendedItemHandle ); return item; }
/** * Create report item through element factory. * * @param extensionName * @param designHandle * @return */
Create report item through element factory
newReportItem
{ "repo_name": "sguan-actuate/birt", "path": "xtab/org.eclipse.birt.report.item.crosstab.core.tests/test/org/eclipse/birt/report/item/crosstab/core/de/CrosstabItemFactoryTest.java", "license": "epl-1.0", "size": 3077 }
[ "org.eclipse.birt.report.model.api.ExtendedItemHandle", "org.eclipse.birt.report.model.api.ReportDesignHandle", "org.eclipse.birt.report.model.api.extension.IReportItem", "org.eclipse.birt.report.model.elements.ExtendedItem", "org.eclipse.birt.report.model.elements.interfaces.IExtendedItemModel" ]
import org.eclipse.birt.report.model.api.ExtendedItemHandle; import org.eclipse.birt.report.model.api.ReportDesignHandle; import org.eclipse.birt.report.model.api.extension.IReportItem; import org.eclipse.birt.report.model.elements.ExtendedItem; import org.eclipse.birt.report.model.elements.interfaces.IExtendedItemModel;
import org.eclipse.birt.report.model.api.*; import org.eclipse.birt.report.model.api.extension.*; import org.eclipse.birt.report.model.elements.*; import org.eclipse.birt.report.model.elements.interfaces.*;
[ "org.eclipse.birt" ]
org.eclipse.birt;
716,857
private boolean copyFile(String fromPath, String toPath) { Log log = LogFactory.getLog(Listener.class); FileInputStream inputStream = null; FileOutputStream outputStream = null; try { inputStream = new FileInputStream(fromPath); outputStream = new FileOutputStream(toPath); OpenmrsUtil.copyFile(inputStream, outputStream); } catch (IOException io) { return false; } finally { try { if (inputStream != null) { inputStream.close(); } } catch (IOException io) { log.warn("Unable to close input stream", io); } try { if (outputStream != null) { outputStream.close(); } } catch (IOException io) { log.warn("Unable to close input stream", io); } } return true; }
boolean function(String fromPath, String toPath) { Log log = LogFactory.getLog(Listener.class); FileInputStream inputStream = null; FileOutputStream outputStream = null; try { inputStream = new FileInputStream(fromPath); outputStream = new FileOutputStream(toPath); OpenmrsUtil.copyFile(inputStream, outputStream); } catch (IOException io) { return false; } finally { try { if (inputStream != null) { inputStream.close(); } } catch (IOException io) { log.warn(STR, io); } try { if (outputStream != null) { outputStream.close(); } } catch (IOException io) { log.warn(STR, io); } } return true; }
/** * Copies file pointed to by <code>fromPath</code> to <code>toPath</code> * * @param fromPath * @param toPath * @return true/false whether the copy was a success */
Copies file pointed to by <code>fromPath</code> to <code>toPath</code>
copyFile
{ "repo_name": "MuhammadSafwan/Stop-Button-Ability", "path": "web/src/main/java/org/openmrs/web/Listener.java", "license": "mpl-2.0", "size": 24678 }
[ "java.io.FileInputStream", "java.io.FileOutputStream", "java.io.IOException", "org.apache.commons.logging.Log", "org.apache.commons.logging.LogFactory", "org.openmrs.util.OpenmrsUtil" ]
import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.openmrs.util.OpenmrsUtil;
import java.io.*; import org.apache.commons.logging.*; import org.openmrs.util.*;
[ "java.io", "org.apache.commons", "org.openmrs.util" ]
java.io; org.apache.commons; org.openmrs.util;
496,376
private double[] performLogarithmicRegression(double[]_x, double[] _y) { double[] bm = performLinearRegression(_x, ArrayHelper.log10(_y)); return new double[]{-1*Math.pow(10, bm[0]), Math.pow(10, bm[1])}; }
double[] function(double[]_x, double[] _y) { double[] bm = performLinearRegression(_x, ArrayHelper.log10(_y)); return new double[]{-1*Math.pow(10, bm[0]), Math.pow(10, bm[1])}; }
/** * computes values for r and A for the formula: R = A*r^t * @param _x array containing x values * @param _y array containing y values * @return a double array of size two. index 0 holds A, index 1 holds r */
computes values for r and A for the formula: R = A*r^t
performLogarithmicRegression
{ "repo_name": "mobilesec/sesames", "path": "SesameLibrary/src/at/sesame/fhooe/lib/calibration/Calibrator.java", "license": "lgpl-3.0", "size": 9138 }
[ "at.sesame.fhooe.lib.util.ArrayHelper" ]
import at.sesame.fhooe.lib.util.ArrayHelper;
import at.sesame.fhooe.lib.util.*;
[ "at.sesame.fhooe" ]
at.sesame.fhooe;
1,952,166
public boolean unscheduleServiceLevelAgreement(ServiceLevelAgreement sla) { boolean unscheduled = false; if (sla != null) { unscheduled = unscheduleServiceLevelAgreement(sla.getId()); } return unscheduled; }
boolean function(ServiceLevelAgreement sla) { boolean unscheduled = false; if (sla != null) { unscheduled = unscheduleServiceLevelAgreement(sla.getId()); } return unscheduled; }
/** * removes a SLA from the scheduler, so that it is no longer executed. * * @param sla The Service Level Agreement object * @return true if we were able to remove the SLA from the scheduler */
removes a SLA from the scheduler, so that it is no longer executed
unscheduleServiceLevelAgreement
{ "repo_name": "claudiu-stanciu/kylo", "path": "services/operational-metadata-service/operational-metadata-integration-service/src/main/java/com/thinkbiganalytics/metadata/sla/DefaultServiceLevelAgreementScheduler.java", "license": "apache-2.0", "size": 16958 }
[ "com.thinkbiganalytics.metadata.sla.api.ServiceLevelAgreement" ]
import com.thinkbiganalytics.metadata.sla.api.ServiceLevelAgreement;
import com.thinkbiganalytics.metadata.sla.api.*;
[ "com.thinkbiganalytics.metadata" ]
com.thinkbiganalytics.metadata;
2,622,906
public int indexOf(XYSeries series) { ParamChecks.nullNotPermitted(series, "series"); return this.data.indexOf(series); }
int function(XYSeries series) { ParamChecks.nullNotPermitted(series, STR); return this.data.indexOf(series); }
/** * Returns the index of the specified series, or -1 if that series is not * present in the dataset. * * @param series the series (<code>null</code> not permitted). * * @return The series index. * * @since 1.0.6 */
Returns the index of the specified series, or -1 if that series is not present in the dataset
indexOf
{ "repo_name": "oskopek/jfreechart-fse", "path": "src/main/java/org/jfree/data/xy/XYSeriesCollection.java", "license": "lgpl-2.1", "size": 24679 }
[ "org.jfree.chart.util.ParamChecks" ]
import org.jfree.chart.util.ParamChecks;
import org.jfree.chart.util.*;
[ "org.jfree.chart" ]
org.jfree.chart;
850,689
void convert(Reader contentReader, Writer rendererWriter, OptionsBuilder options) throws IOException;
void convert(Reader contentReader, Writer rendererWriter, OptionsBuilder options) throws IOException;
/** * Parse the document read from reader, and rendered result is sent to * writer. * * @param contentReader where asciidoc content is read. * @param rendererWriter where rendered content is written. Writer is flushed, but not * closed. * @param options a Hash of options to control processing (default: {}). * @throws IOException if an error occurs while writing rendered content, this * exception is thrown. */
Parse the document read from reader, and rendered result is sent to writer
convert
{ "repo_name": "ysb33r/asciidoctorj", "path": "asciidoctorj-api/src/main/java/org/asciidoctor/Asciidoctor.java", "license": "apache-2.0", "size": 21464 }
[ "java.io.IOException", "java.io.Reader", "java.io.Writer" ]
import java.io.IOException; import java.io.Reader; import java.io.Writer;
import java.io.*;
[ "java.io" ]
java.io;
2,847,648
private Set<Integer> computeReferencedMessageIds(List<Message> messages) { Set<Integer> ids = new HashSet<>(); // First, add the ID of the message messages.forEach(msg -> ids.add(msg.getId())); // Add all message ID's referenced by message attachments messages.stream() .filter(msg -> msg.getAttachments() != null && msg.getAttachments().size() > 0) .flatMap(msg -> msg.getAttachments().stream()) .forEach(att -> { Matcher m = MESSAGE_ATTACHMENT_FILE_PATTERN.matcher(att.getPath()); if (m.matches()) { ids.add(Integer.valueOf(m.group("id"))); } }); // Add all message ID's referenced by message HTML description fields messages.stream() .filter(msg -> msg.getDescs() != null && msg.getDescs().size() > 0) .flatMap(msg -> msg.getDescs().stream()) .filter(desc -> StringUtils.isNotBlank(desc.getDescription())) .forEach(desc -> { try { // Process files referenced by <a> "href" attributes and <img> "src" attributes Document doc = Jsoup.parse(desc.getDescription()); computeReferencedMessageIds(ids, doc, "a", "href"); computeReferencedMessageIds(ids, doc, "img", "src"); } catch (Exception ex) { log.trace("Failed computing referenced messages " + ex.getMessage()); } }); return ids; }
Set<Integer> function(List<Message> messages) { Set<Integer> ids = new HashSet<>(); messages.forEach(msg -> ids.add(msg.getId())); messages.stream() .filter(msg -> msg.getAttachments() != null && msg.getAttachments().size() > 0) .flatMap(msg -> msg.getAttachments().stream()) .forEach(att -> { Matcher m = MESSAGE_ATTACHMENT_FILE_PATTERN.matcher(att.getPath()); if (m.matches()) { ids.add(Integer.valueOf(m.group("id"))); } }); messages.stream() .filter(msg -> msg.getDescs() != null && msg.getDescs().size() > 0) .flatMap(msg -> msg.getDescs().stream()) .filter(desc -> StringUtils.isNotBlank(desc.getDescription())) .forEach(desc -> { try { Document doc = Jsoup.parse(desc.getDescription()); computeReferencedMessageIds(ids, doc, "a", "href"); computeReferencedMessageIds(ids, doc, "img", "src"); } catch (Exception ex) { log.trace(STR + ex.getMessage()); } }); return ids; }
/** * The procedure will determine which repository message ID's are still active. * <p> * In addition to the actual ID's of active message, look at the attachments and * referenced files in message HTML description fields, since these may reference * attachments for non-active messages. * * @param messages the list of active messages * @return the ID's for message repository folders to keep */
The procedure will determine which repository message ID's are still active. In addition to the actual ID's of active message, look at the attachments and referenced files in message HTML description fields, since these may reference attachments for non-active messages
computeReferencedMessageIds
{ "repo_name": "dma-dk/MsiProxy", "path": "msiproxy-common/src/main/java/dk/dma/msiproxy/common/provider/AbstractProviderService.java", "license": "apache-2.0", "size": 14664 }
[ "dk.dma.msiproxy.model.msi.Message", "java.util.HashSet", "java.util.List", "java.util.Set", "java.util.regex.Matcher", "org.apache.commons.lang.StringUtils", "org.jsoup.Jsoup", "org.jsoup.nodes.Document" ]
import dk.dma.msiproxy.model.msi.Message; import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.regex.Matcher; import org.apache.commons.lang.StringUtils; import org.jsoup.Jsoup; import org.jsoup.nodes.Document;
import dk.dma.msiproxy.model.msi.*; import java.util.*; import java.util.regex.*; import org.apache.commons.lang.*; import org.jsoup.*; import org.jsoup.nodes.*;
[ "dk.dma.msiproxy", "java.util", "org.apache.commons", "org.jsoup", "org.jsoup.nodes" ]
dk.dma.msiproxy; java.util; org.apache.commons; org.jsoup; org.jsoup.nodes;
246,427
@ServiceMethod(returns = ReturnType.SINGLE) private Mono<Void> deleteAsync(String resourceGroupName, String accountName) { return beginDeleteAsync(resourceGroupName, accountName).last().flatMap(this.client::getLroFinalResultOrError); }
@ServiceMethod(returns = ReturnType.SINGLE) Mono<Void> function(String resourceGroupName, String accountName) { return beginDeleteAsync(resourceGroupName, accountName).last().flatMap(this.client::getLroFinalResultOrError); }
/** * Deletes a Cognitive Services account from the resource group. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName The name of Cognitive Services account. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */
Deletes a Cognitive Services account from the resource group
deleteAsync
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/cognitiveservices/azure-resourcemanager-cognitiveservices/src/main/java/com/azure/resourcemanager/cognitiveservices/implementation/AccountsClientImpl.java", "license": "mit", "size": 114340 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod;
import com.azure.core.annotation.*;
[ "com.azure.core" ]
com.azure.core;
797,763
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller<PollResult<VpnProfileResponseInner>, VpnProfileResponseInner> beginGenerateVpnProfile( String resourceGroupName, String gatewayName, P2SVpnProfileParameters parameters, Context context) { return beginGenerateVpnProfileAsync(resourceGroupName, gatewayName, parameters, context).getSyncPoller(); }
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller<PollResult<VpnProfileResponseInner>, VpnProfileResponseInner> function( String resourceGroupName, String gatewayName, P2SVpnProfileParameters parameters, Context context) { return beginGenerateVpnProfileAsync(resourceGroupName, gatewayName, parameters, context).getSyncPoller(); }
/** * Generates VPN profile for P2S client of the P2SVpnGateway in the specified resource group. * * @param resourceGroupName The name of the resource group. * @param gatewayName The name of the P2SVpnGateway. * @param parameters Parameters supplied to the generate P2SVpnGateway VPN client package operation. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the {@link SyncPoller} for polling of vpn Profile Response for package generation. */
Generates VPN profile for P2S client of the P2SVpnGateway in the specified resource group
beginGenerateVpnProfile
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/resourcemanager/azure-resourcemanager-network/src/main/java/com/azure/resourcemanager/network/implementation/P2SVpnGatewaysClientImpl.java", "license": "mit", "size": 155308 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.management.polling.PollResult", "com.azure.core.util.Context", "com.azure.core.util.polling.SyncPoller", "com.azure.resourcemanager.network.fluent.models.VpnProfileResponseInner", "com.azure.resourcemanager.network.models.P2SVpnProfileParameters" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.management.polling.PollResult; import com.azure.core.util.Context; import com.azure.core.util.polling.SyncPoller; import com.azure.resourcemanager.network.fluent.models.VpnProfileResponseInner; import com.azure.resourcemanager.network.models.P2SVpnProfileParameters;
import com.azure.core.annotation.*; import com.azure.core.management.polling.*; import com.azure.core.util.*; import com.azure.core.util.polling.*; import com.azure.resourcemanager.network.fluent.models.*; import com.azure.resourcemanager.network.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
2,353,537
protected void prepareRefresh() { this.startupDate = System.currentTimeMillis(); this.active.set(true); if (logger.isInfoEnabled()) { logger.info("Refreshing " + this); } // Initialize any placeholder property sources in the context environment initPropertySources(); // Validate that all properties marked as required are resolvable // see ConfigurablePropertyResolver#setRequiredProperties getEnvironment().validateRequiredProperties(); // Allow for the collection of early ApplicationEvents, // to be published once the multicaster is available... this.earlyApplicationEvents = new LinkedHashSet<ApplicationEvent>(); }
void function() { this.startupDate = System.currentTimeMillis(); this.active.set(true); if (logger.isInfoEnabled()) { logger.info(STR + this); } initPropertySources(); getEnvironment().validateRequiredProperties(); this.earlyApplicationEvents = new LinkedHashSet<ApplicationEvent>(); }
/** * Prepare this context for refreshing, setting its startup date and * active flag as well as performing any initialization of property sources. */
Prepare this context for refreshing, setting its startup date and active flag as well as performing any initialization of property sources
prepareRefresh
{ "repo_name": "qobel/esoguproject", "path": "spring-framework/spring-context/src/main/java/org/springframework/context/support/AbstractApplicationContext.java", "license": "apache-2.0", "size": 47683 }
[ "java.util.LinkedHashSet", "org.springframework.context.ApplicationEvent" ]
import java.util.LinkedHashSet; import org.springframework.context.ApplicationEvent;
import java.util.*; import org.springframework.context.*;
[ "java.util", "org.springframework.context" ]
java.util; org.springframework.context;
2,564,302
//----------------------------------------------------------------------- public MarketDataName<?> getMarketDataName() { return marketDataName; }
MarketDataName<?> function() { return marketDataName; }
/** * Gets the market data name. * <p> * This name is used in the market data system to identify the data that the sensitivities refer to. * @return the value of the property, not null */
Gets the market data name. This name is used in the market data system to identify the data that the sensitivities refer to
getMarketDataName
{ "repo_name": "OpenGamma/Strata", "path": "modules/market/src/main/java/com/opengamma/strata/market/param/CurrencyParameterSensitivity.java", "license": "apache-2.0", "size": 39827 }
[ "com.opengamma.strata.data.MarketDataName" ]
import com.opengamma.strata.data.MarketDataName;
import com.opengamma.strata.data.*;
[ "com.opengamma.strata" ]
com.opengamma.strata;
8,434
private void writeResponse(Socket socket, Response response) throws IOException { OutputStreamWriter writer = new OutputStreamWriter(socket.getOutputStream(), StandardCharsets.UTF_8); if (response.getType() == ResponseType.CHAIN) { ((SerializableCR) response).serialize(); } Class<? extends Response> responseClass; switch (response.getType()) { case CHAIN: responseClass = ChainResponse.class; break; case SINGLE_RESULT: responseClass = SingleResultResponse.class; break; case MULTI_RESULT: responseClass = MultiResultResponse.class; break; default: responseClass = Response.class; break; } writer.write(new Gson().toJson(response, responseClass)); writer.flush(); } }
void function(Socket socket, Response response) throws IOException { OutputStreamWriter writer = new OutputStreamWriter(socket.getOutputStream(), StandardCharsets.UTF_8); if (response.getType() == ResponseType.CHAIN) { ((SerializableCR) response).serialize(); } Class<? extends Response> responseClass; switch (response.getType()) { case CHAIN: responseClass = ChainResponse.class; break; case SINGLE_RESULT: responseClass = SingleResultResponse.class; break; case MULTI_RESULT: responseClass = MultiResultResponse.class; break; default: responseClass = Response.class; break; } writer.write(new Gson().toJson(response, responseClass)); writer.flush(); } }
/** * Send the response object back to the caller. * @param socket - the socket to write to * @param response - the response object to write * @throws IOException thrown if there is an issue writing to the socket */
Send the response object back to the caller
writeResponse
{ "repo_name": "MrNakaan/Seltzer", "path": "seltzer-parent/seltzer-core/src/main/java/tech/seltzer/core/ServerSocketListener.java", "license": "mit", "size": 5917 }
[ "com.google.gson.Gson", "java.io.IOException", "java.io.OutputStreamWriter", "java.net.Socket", "java.nio.charset.StandardCharsets", "tech.seltzer.enums.ResponseType", "tech.seltzer.objects.SerializableCR", "tech.seltzer.objects.response.ChainResponse", "tech.seltzer.objects.response.MultiResultResponse", "tech.seltzer.objects.response.Response", "tech.seltzer.objects.response.SingleResultResponse" ]
import com.google.gson.Gson; import java.io.IOException; import java.io.OutputStreamWriter; import java.net.Socket; import java.nio.charset.StandardCharsets; import tech.seltzer.enums.ResponseType; import tech.seltzer.objects.SerializableCR; import tech.seltzer.objects.response.ChainResponse; import tech.seltzer.objects.response.MultiResultResponse; import tech.seltzer.objects.response.Response; import tech.seltzer.objects.response.SingleResultResponse;
import com.google.gson.*; import java.io.*; import java.net.*; import java.nio.charset.*; import tech.seltzer.enums.*; import tech.seltzer.objects.*; import tech.seltzer.objects.response.*;
[ "com.google.gson", "java.io", "java.net", "java.nio", "tech.seltzer.enums", "tech.seltzer.objects" ]
com.google.gson; java.io; java.net; java.nio; tech.seltzer.enums; tech.seltzer.objects;
1,843,906
@ServiceMethod(returns = ReturnType.SINGLE) void updateContract(String contractId, MicrosoftGraphContractInner body);
@ServiceMethod(returns = ReturnType.SINGLE) void updateContract(String contractId, MicrosoftGraphContractInner body);
/** * Update entity in contracts. * * @param contractId key: id of contract. * @param body New property values. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.resourcemanager.authorization.fluent.models.OdataErrorMainException thrown if the request is * rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */
Update entity in contracts
updateContract
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/resourcemanager/azure-resourcemanager-authorization/src/main/java/com/azure/resourcemanager/authorization/fluent/ContractsContractsClient.java", "license": "mit", "size": 16316 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.resourcemanager.authorization.fluent.models.MicrosoftGraphContractInner" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.resourcemanager.authorization.fluent.models.MicrosoftGraphContractInner;
import com.azure.core.annotation.*; import com.azure.resourcemanager.authorization.fluent.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
1,350,749
public void setMetrics(ClusterMetrics metrics) { assert metrics != null; this.metrics = metrics; }
void function(ClusterMetrics metrics) { assert metrics != null; this.metrics = metrics; }
/** * Sets node metrics. * * @param metrics Node metrics. */
Sets node metrics
setMetrics
{ "repo_name": "ryanzz/ignite", "path": "modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryNode.java", "license": "apache-2.0", "size": 17852 }
[ "org.apache.ignite.cluster.ClusterMetrics" ]
import org.apache.ignite.cluster.ClusterMetrics;
import org.apache.ignite.cluster.*;
[ "org.apache.ignite" ]
org.apache.ignite;
1,305,482
public void createFixedAsset(Invoice invoice) throws AxelorException;
void function(Invoice invoice) throws AxelorException;
/** * Allow to create fixed asset from invoice * * @param invoice * @return * @throws AxelorException */
Allow to create fixed asset from invoice
createFixedAsset
{ "repo_name": "ama-axelor/axelor-business-suite", "path": "axelor-account/src/main/java/com/axelor/apps/account/service/FixedAssetService.java", "license": "agpl-3.0", "size": 1644 }
[ "com.axelor.apps.account.db.Invoice", "com.axelor.exception.AxelorException" ]
import com.axelor.apps.account.db.Invoice; import com.axelor.exception.AxelorException;
import com.axelor.apps.account.db.*; import com.axelor.exception.*;
[ "com.axelor.apps", "com.axelor.exception" ]
com.axelor.apps; com.axelor.exception;
868,274
public NotificationBaseResponse updateNotification(String name, String endpoint, String token, AuthType authType) { NotificationUpdateRequest updateRequest = NotificationUpdateRequest.of(name, endpoint, token, authType); return updateNotification(updateRequest); }
NotificationBaseResponse function(String name, String endpoint, String token, AuthType authType) { NotificationUpdateRequest updateRequest = NotificationUpdateRequest.of(name, endpoint, token, authType); return updateNotification(updateRequest); }
/** * Update notification with specified parameters. * * @param name The notification name * @param endpoint The notification endpoint to update * @param token The notification token to update * @param authType The notification authentication type to update * @return A updating notification response */
Update notification with specified parameters
updateNotification
{ "repo_name": "baidubce/bce-sdk-java", "path": "src/main/java/com/baidubce/services/bvw/BvwClient.java", "license": "apache-2.0", "size": 39847 }
[ "com.baidubce.services.bvw.model.notification.AuthType", "com.baidubce.services.bvw.model.notification.NotificationBaseResponse", "com.baidubce.services.bvw.model.notification.NotificationUpdateRequest" ]
import com.baidubce.services.bvw.model.notification.AuthType; import com.baidubce.services.bvw.model.notification.NotificationBaseResponse; import com.baidubce.services.bvw.model.notification.NotificationUpdateRequest;
import com.baidubce.services.bvw.model.notification.*;
[ "com.baidubce.services" ]
com.baidubce.services;
903,907
public static void checkDfsSafeMode(final Configuration conf) throws IOException { boolean isInSafeMode = false; FileSystem fs = FileSystem.get(conf); if (fs instanceof DistributedFileSystem) { DistributedFileSystem dfs = (DistributedFileSystem)fs; isInSafeMode = isInSafeMode(dfs); } if (isInSafeMode) { throw new IOException("File system is in safemode, it can't be written now"); } }
static void function(final Configuration conf) throws IOException { boolean isInSafeMode = false; FileSystem fs = FileSystem.get(conf); if (fs instanceof DistributedFileSystem) { DistributedFileSystem dfs = (DistributedFileSystem)fs; isInSafeMode = isInSafeMode(dfs); } if (isInSafeMode) { throw new IOException(STR); } }
/** * Check whether dfs is in safemode. * @param conf * @throws IOException */
Check whether dfs is in safemode
checkDfsSafeMode
{ "repo_name": "mapr/hbase", "path": "hbase-server/src/main/java/org/apache/hadoop/hbase/util/FSUtils.java", "license": "apache-2.0", "size": 70673 }
[ "java.io.IOException", "org.apache.hadoop.conf.Configuration", "org.apache.hadoop.fs.FileSystem", "org.apache.hadoop.hdfs.DistributedFileSystem" ]
import java.io.IOException; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.hdfs.DistributedFileSystem;
import java.io.*; import org.apache.hadoop.conf.*; import org.apache.hadoop.fs.*; import org.apache.hadoop.hdfs.*;
[ "java.io", "org.apache.hadoop" ]
java.io; org.apache.hadoop;
652,233
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.playback_controls); loadViews(); setupCallbacks(); mSession = new MediaSession(this, "LeanbackSampleApp"); mSession.setCallback(new MediaSessionCallback()); mSession.setFlags(MediaSession.FLAG_HANDLES_MEDIA_BUTTONS | MediaSession.FLAG_HANDLES_TRANSPORT_CONTROLS); mSession.setActive(true); }
void function(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.playback_controls); loadViews(); setupCallbacks(); mSession = new MediaSession(this, STR); mSession.setCallback(new MediaSessionCallback()); mSession.setFlags(MediaSession.FLAG_HANDLES_MEDIA_BUTTONS MediaSession.FLAG_HANDLES_TRANSPORT_CONTROLS); mSession.setActive(true); }
/** * Called when the activity is first created. */
Called when the activity is first created
onCreate
{ "repo_name": "ryancford/movie-inspector", "path": "tv/src/main/java/info/ryanford/movieinspector/PlaybackOverlayActivity.java", "license": "apache-2.0", "size": 8713 }
[ "android.media.session.MediaSession", "android.os.Bundle" ]
import android.media.session.MediaSession; import android.os.Bundle;
import android.media.session.*; import android.os.*;
[ "android.media", "android.os" ]
android.media; android.os;
944,844
public static void save(List<RankList> samples, String outputFile) { try { BufferedWriter out = new BufferedWriter(new OutputStreamWriter( new FileOutputStream(outputFile))); for (int j = 0; j < samples.size(); j++) save(samples.get(j), out); out.close(); } catch (Exception ex) { System.out.println("Error in FeatureManager::save(): " + ex.toString()); System.exit(1); } }
static void function(List<RankList> samples, String outputFile) { try { BufferedWriter out = new BufferedWriter(new OutputStreamWriter( new FileOutputStream(outputFile))); for (int j = 0; j < samples.size(); j++) save(samples.get(j), out); out.close(); } catch (Exception ex) { System.out.println(STR + ex.toString()); System.exit(1); } }
/** * Save a sample set to file * * @param samples * @param outputFile */
Save a sample set to file
save
{ "repo_name": "sisinflab/lodreclib", "path": "src/main/java/ciir/umass/edu/features/FeatureManager.java", "license": "mit", "size": 19999 }
[ "java.io.BufferedWriter", "java.io.FileOutputStream", "java.io.OutputStreamWriter", "java.util.List" ]
import java.io.BufferedWriter; import java.io.FileOutputStream; import java.io.OutputStreamWriter; import java.util.List;
import java.io.*; import java.util.*;
[ "java.io", "java.util" ]
java.io; java.util;
811,593
public ConAtrDefinition updateConAtrDefinition(ConAtrDefinition conAtrDefinition) throws Exception { ConAtrVal conAtrVal = null; Long idConAtr = conAtrDefinition.getConAtr().getId(); // si ya hay un atributo valorizado creado lo actualizo //if (conAtrValVigente != null) { if (conAtrDefinition.getPoseeVigencia()){ ConAtrVal conAtrValVigente = this.getConAtrValVigente(idConAtr); ConAtrVal conAtrValPosVigente= null; Date fechaHasta = conAtrDefinition.getFechaHasta(); // seteo el vigente con la fecha hasta igual a la fecha desde del ingresada // es caso de ser nula if (conAtrValVigente != null && conAtrValVigente.getFechaHasta() == null) { if(DateUtil.isDateAfterOrEqual(conAtrDefinition.getFechaDesde(), conAtrValVigente.getFechaDesde())){ conAtrValVigente.setFechaHasta(conAtrDefinition.getFechaDesde()); conAtrValVigente = this.updateConAtrVal(conAtrValVigente); }else{ fechaHasta = conAtrValVigente.getFechaDesde(); } } // Insertar un registro nuevo conAtrVal = new ConAtrVal(); conAtrVal.setContribuyente(this); conAtrVal.setConAtr(ConAtr.getById(conAtrDefinition.getConAtr().getId())); conAtrVal.setValor(conAtrDefinition.getValorString()); conAtrVal.setFechaDesde(conAtrDefinition.getFechaDesde()); //Me fijo si hay un Registro a futuro conAtrValPosVigente = this.getConAtrValPosVigente(idConAtr,conAtrVal); if (conAtrValPosVigente != null ) { conAtrDefinition.setFechaHasta(DateUtil.addDaysToDate(conAtrValPosVigente.getFechaDesde(),-1)); } conAtrVal.setFechaHasta(fechaHasta); conAtrVal = this.createConAtrVal(conAtrVal); } else { //Solo se actualiza el valor del registro. // recupero en atributo conAtrVal = this.getConAtrValByIdConAtr(idConAtr); // si no posee lo creo if (conAtrVal == null) { conAtrVal = new ConAtrVal(); conAtrVal.setContribuyente(this); conAtrVal.setConAtr(ConAtr.getById(idConAtr)); } // seteo el valor conAtrVal.setFechaDesde(new Date()); conAtrVal.setValor(conAtrDefinition.getValorString()); conAtrVal = this.updateConAtrVal(conAtrVal); } return conAtrDefinition; }
ConAtrDefinition function(ConAtrDefinition conAtrDefinition) throws Exception { ConAtrVal conAtrVal = null; Long idConAtr = conAtrDefinition.getConAtr().getId(); if (conAtrDefinition.getPoseeVigencia()){ ConAtrVal conAtrValVigente = this.getConAtrValVigente(idConAtr); ConAtrVal conAtrValPosVigente= null; Date fechaHasta = conAtrDefinition.getFechaHasta(); if (conAtrValVigente != null && conAtrValVigente.getFechaHasta() == null) { if(DateUtil.isDateAfterOrEqual(conAtrDefinition.getFechaDesde(), conAtrValVigente.getFechaDesde())){ conAtrValVigente.setFechaHasta(conAtrDefinition.getFechaDesde()); conAtrValVigente = this.updateConAtrVal(conAtrValVigente); }else{ fechaHasta = conAtrValVigente.getFechaDesde(); } } conAtrVal = new ConAtrVal(); conAtrVal.setContribuyente(this); conAtrVal.setConAtr(ConAtr.getById(conAtrDefinition.getConAtr().getId())); conAtrVal.setValor(conAtrDefinition.getValorString()); conAtrVal.setFechaDesde(conAtrDefinition.getFechaDesde()); conAtrValPosVigente = this.getConAtrValPosVigente(idConAtr,conAtrVal); if (conAtrValPosVigente != null ) { conAtrDefinition.setFechaHasta(DateUtil.addDaysToDate(conAtrValPosVigente.getFechaDesde(),-1)); } conAtrVal.setFechaHasta(fechaHasta); conAtrVal = this.createConAtrVal(conAtrVal); } else { conAtrVal = this.getConAtrValByIdConAtr(idConAtr); if (conAtrVal == null) { conAtrVal = new ConAtrVal(); conAtrVal.setContribuyente(this); conAtrVal.setConAtr(ConAtr.getById(idConAtr)); } conAtrVal.setFechaDesde(new Date()); conAtrVal.setValor(conAtrDefinition.getValorString()); conAtrVal = this.updateConAtrVal(conAtrVal); } return conAtrDefinition; }
/** * Actualiza el valor y/o las vigencias de un atributo valorizado del * Contribuyente. El metodo actualiza el valor y las vigencias en caso * de ser un atributo que posee vigencias. * @param objImpAtrVal valores a actualizar * @return el objeto actualizado * @throws Exception */
Actualiza el valor y/o las vigencias de un atributo valorizado del Contribuyente. El metodo actualiza el valor y las vigencias en caso de ser un atributo que posee vigencias
updateConAtrDefinition
{ "repo_name": "avdata99/SIAT", "path": "siat-1.0-SOURCE/src/buss/src/ar/gov/rosario/siat/pad/buss/bean/Contribuyente.java", "license": "gpl-3.0", "size": 28403 }
[ "ar.gov.rosario.siat.def.buss.bean.ConAtr", "ar.gov.rosario.siat.pad.iface.model.ConAtrDefinition", "coop.tecso.demoda.iface.helper.DateUtil", "java.util.Date" ]
import ar.gov.rosario.siat.def.buss.bean.ConAtr; import ar.gov.rosario.siat.pad.iface.model.ConAtrDefinition; import coop.tecso.demoda.iface.helper.DateUtil; import java.util.Date;
import ar.gov.rosario.siat.def.buss.bean.*; import ar.gov.rosario.siat.pad.iface.model.*; import coop.tecso.demoda.iface.helper.*; import java.util.*;
[ "ar.gov.rosario", "coop.tecso.demoda", "java.util" ]
ar.gov.rosario; coop.tecso.demoda; java.util;
364,452
public void ShowEmails(List<Email> emails) { for (Email email: emails) { showSingleEmail(email); } }
void function(List<Email> emails) { for (Email email: emails) { showSingleEmail(email); } }
/** * Method that displays all of the emails * @param emails a list of emails */
Method that displays all of the emails
ShowEmails
{ "repo_name": "jimtryon/mvc", "path": "Jim-ModelViewController/src/edu/greenriver/it/view/PlannerConsoleView.java", "license": "mit", "size": 3592 }
[ "edu.greenriver.it.entities.Email", "java.util.List" ]
import edu.greenriver.it.entities.Email; import java.util.List;
import edu.greenriver.it.entities.*; import java.util.*;
[ "edu.greenriver.it", "java.util" ]
edu.greenriver.it; java.util;
2,518,433
@GET @Path("/{id}") @Produces(APPLICATION_JSON) @ApiOperation(value = "Get factory information by its id", notes = "Get JSON with factory information. Factory id is passed in a path parameter") @ApiResponses({@ApiResponse(code = 200, message = "OK"), @ApiResponse(code = 404, message = "Factory not found"), @ApiResponse(code = 400, message = "Failed to validate factory e.g. if it expired"), @ApiResponse(code = 500, message = "Internal server error")}) public Factory getFactory(@ApiParam(value = "Factory ID") @PathParam("id") String id, @ApiParam(value = "Whether or not to validate values like it is done when accepting a Factory", allowableValues = "true,false", defaultValue = "false") @DefaultValue("false") @QueryParam("validate") Boolean validate, @Context UriInfo uriInfo) throws NotFoundException, ServerException, BadRequestException { final Factory factory = factoryStore.getFactory(id); factory.setLinks(createLinks(factory, factoryStore.getFactoryImages(id, null), uriInfo)); if (validate) { acceptValidator.validateOnAccept(factory); } return factory; }
@Path("/{id}") @Produces(APPLICATION_JSON) @ApiOperation(value = STR, notes = STR) @ApiResponses({@ApiResponse(code = 200, message = "OK"), @ApiResponse(code = 404, message = STR), @ApiResponse(code = 400, message = STR), @ApiResponse(code = 500, message = STR)}) Factory function(@ApiParam(value = STR) @PathParam("id") String id, @ApiParam(value = STR, allowableValues = STR, defaultValue = "false") @DefaultValue("false") @QueryParam(STR) Boolean validate, UriInfo uriInfo) throws NotFoundException, ServerException, BadRequestException { final Factory factory = factoryStore.getFactory(id); factory.setLinks(createLinks(factory, factoryStore.getFactoryImages(id, null), uriInfo)); if (validate) { acceptValidator.validateOnAccept(factory); } return factory; }
/** * Get factory information from storage by specified id. * * @param id * id of factory * @param uriInfo * url context * @return the factory instance if it's found by id * @throws NotFoundException * when the factory with specified id doesn't not found * @throws ServerException * when any server errors occurs * @throws BadRequestException * when the factory is invalid e.g. is expired */
Get factory information from storage by specified id
getFactory
{ "repo_name": "dhuebner/che", "path": "wsmaster/che-core-api-factory/src/main/java/org/eclipse/che/api/factory/server/FactoryService.java", "license": "epl-1.0", "size": 31636 }
[ "io.swagger.annotations.ApiOperation", "io.swagger.annotations.ApiParam", "io.swagger.annotations.ApiResponse", "io.swagger.annotations.ApiResponses", "javax.ws.rs.DefaultValue", "javax.ws.rs.Path", "javax.ws.rs.PathParam", "javax.ws.rs.Produces", "javax.ws.rs.QueryParam", "javax.ws.rs.core.UriInfo", "org.eclipse.che.api.core.BadRequestException", "org.eclipse.che.api.core.NotFoundException", "org.eclipse.che.api.core.ServerException", "org.eclipse.che.api.factory.shared.dto.Factory" ]
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; import javax.ws.rs.DefaultValue; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; import javax.ws.rs.core.UriInfo; import org.eclipse.che.api.core.BadRequestException; import org.eclipse.che.api.core.NotFoundException; import org.eclipse.che.api.core.ServerException; import org.eclipse.che.api.factory.shared.dto.Factory;
import io.swagger.annotations.*; import javax.ws.rs.*; import javax.ws.rs.core.*; import org.eclipse.che.api.core.*; import org.eclipse.che.api.factory.shared.dto.*;
[ "io.swagger.annotations", "javax.ws", "org.eclipse.che" ]
io.swagger.annotations; javax.ws; org.eclipse.che;
1,411,686
@Test public void testExpiryPositiveWithConflation() { try { HARegionQueueAttributes haa = new HARegionQueueAttributes(); haa.setExpiryTime(2); //HARegionQueue regionqueue = new HARegionQueue("testing", cache, haa); HARegionQueue regionqueue = createHARegionQueue("testing",haa); regionqueue.put(new ConflatableObject("key", "value", new EventID( new byte[] { 1 }, 1, 1), true, "testing")); regionqueue.put(new ConflatableObject("key", "newValue", new EventID( new byte[] { 1 }, 1, 2), true, "testing")); Assert .assertTrue( " Expected region size not to be zero since expiry time has not been exceeded but it is not so ", !(regionqueue.size() == 0)); Assert .assertTrue( " Expected the available id's size not to be zero since expiry time has not been exceeded but it is not so ", !(regionqueue.getAvalaibleIds().size() == 0)); Assert .assertTrue( " Expected conflation map size not to be zero since expiry time has not been exceeded but it is not so " + ((((Map)(regionqueue.getConflationMapForTesting() .get("testing"))).get("key"))), !((((Map)(regionqueue.getConflationMapForTesting().get("testing"))) .get("key")) == null)); Assert .assertTrue( " Expected eventID map size not to be zero since expiry time has not been exceeded but it is not so ", !(regionqueue.getEventsMapForTesting().size() == 0)); Thread.sleep(5000); ThreadIdentifier tid = new ThreadIdentifier(new byte[] { 1 }, 1); System.out.println(" it still contains thread id : " + regionqueue.getRegion().containsKey(tid)); Assert .assertTrue( " Expected region size to be zero since expiry time has been exceeded but it is not so ", regionqueue.getRegion().keys().size() == 0); Assert .assertTrue( " Expected the available id's size to be zero since expiry time has been exceeded but it is not so ", regionqueue.getAvalaibleIds().size() == 0); System.out.println((((Map)(regionqueue.getConflationMapForTesting() .get("testing"))).get("key"))); Assert .assertTrue( " Expected conflation map size to be zero since expiry time has been exceeded but it is not so ", ((((Map)(regionqueue.getConflationMapForTesting().get("testing"))) .get("key")) == null)); Assert .assertTrue( " Expected eventID to be zero since expiry time has been exceeded but it is not so ", (regionqueue.getEventsMapForTesting().size() == 0)); } catch (Exception e) { e.printStackTrace(); fail(" test failed due to " + e); } }
void function() { try { HARegionQueueAttributes haa = new HARegionQueueAttributes(); haa.setExpiryTime(2); HARegionQueue regionqueue = createHARegionQueue(STR,haa); regionqueue.put(new ConflatableObject("key", "value", new EventID( new byte[] { 1 }, 1, 1), true, STR)); regionqueue.put(new ConflatableObject("key", STR, new EventID( new byte[] { 1 }, 1, 2), true, STR)); Assert .assertTrue( STR, !(regionqueue.size() == 0)); Assert .assertTrue( STR, !(regionqueue.getAvalaibleIds().size() == 0)); Assert .assertTrue( STR + ((((Map)(regionqueue.getConflationMapForTesting() .get(STR))).get("key"))), !((((Map)(regionqueue.getConflationMapForTesting().get(STR))) .get("key")) == null)); Assert .assertTrue( STR, !(regionqueue.getEventsMapForTesting().size() == 0)); Thread.sleep(5000); ThreadIdentifier tid = new ThreadIdentifier(new byte[] { 1 }, 1); System.out.println(STR + regionqueue.getRegion().containsKey(tid)); Assert .assertTrue( STR, regionqueue.getRegion().keys().size() == 0); Assert .assertTrue( STR, regionqueue.getAvalaibleIds().size() == 0); System.out.println((((Map)(regionqueue.getConflationMapForTesting() .get(STR))).get("key"))); Assert .assertTrue( STR, ((((Map)(regionqueue.getConflationMapForTesting().get(STR))) .get("key")) == null)); Assert .assertTrue( STR, (regionqueue.getEventsMapForTesting().size() == 0)); } catch (Exception e) { e.printStackTrace(); fail(STR + e); } }
/** * tests whether expiry of a conflated entry in the regin queue occurs as * expected * */
tests whether expiry of a conflated entry in the regin queue occurs as expected
testExpiryPositiveWithConflation
{ "repo_name": "ysung-pivotal/incubator-geode", "path": "gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/ha/HARegionQueueJUnitTest.java", "license": "apache-2.0", "size": 72402 }
[ "com.gemstone.gemfire.internal.cache.EventID", "java.util.Map", "junit.framework.Assert", "org.junit.Assert" ]
import com.gemstone.gemfire.internal.cache.EventID; import java.util.Map; import junit.framework.Assert; import org.junit.Assert;
import com.gemstone.gemfire.internal.cache.*; import java.util.*; import junit.framework.*; import org.junit.*;
[ "com.gemstone.gemfire", "java.util", "junit.framework", "org.junit" ]
com.gemstone.gemfire; java.util; junit.framework; org.junit;
1,183,447
MessageReceived findMessageReceivedByMessageId(long inId); /** * Creates a new {@link MessageReceived}
MessageReceived findMessageReceivedByMessageId(long inId); /** * Creates a new {@link MessageReceived}
/** * Finds MessageReceived by Message id * * @param inId * @return */
Finds MessageReceived by Message id
findMessageReceivedByMessageId
{ "repo_name": "sebastienhouzet/nabaztag-source-code", "path": "server/OS/net/violet/platform/datamodel/factories/MessageReceivedFactory.java", "license": "mit", "size": 1985 }
[ "net.violet.platform.datamodel.MessageReceived" ]
import net.violet.platform.datamodel.MessageReceived;
import net.violet.platform.datamodel.*;
[ "net.violet.platform" ]
net.violet.platform;
1,022,609
public static JavaDoubleRDD residuals(JavaDoubleRDD y, JavaDoubleRDD fit){ JavaPairRDD<Double, Double> data = y.zip(fit); return data.mapToDouble(val -> val._1 - val._2); } /** * linearCorrelationCoefficient * Linear correlation coefficient found when we calculate the regression sum of * squares over the variance given in y * @param regressionSumOfSquares * Standard error of mean from having calculated the regression sum of squares * @param yVariance * Variance in y as an array of double values
static JavaDoubleRDD function(JavaDoubleRDD y, JavaDoubleRDD fit){ JavaPairRDD<Double, Double> data = y.zip(fit); return data.mapToDouble(val -> val._1 - val._2); } /** * linearCorrelationCoefficient * Linear correlation coefficient found when we calculate the regression sum of * squares over the variance given in y * @param regressionSumOfSquares * Standard error of mean from having calculated the regression sum of squares * @param yVariance * Variance in y as an array of double values
/** * residuals * Difference between y from the least squares fit and the actual data * @param y * Array of doubles holding the y values * @param fit * The the least squares fit as an array of doubles * @return * Array of doubles holding the data's residual points */
residuals Difference between y from the least squares fit and the actual data
residuals
{ "repo_name": "uwplse/Casper", "path": "bin/benchmarks/manual/stats/StatsUtil.java", "license": "bsd-3-clause", "size": 13742 }
[ "org.apache.spark.api.java.JavaDoubleRDD", "org.apache.spark.api.java.JavaPairRDD" ]
import org.apache.spark.api.java.JavaDoubleRDD; import org.apache.spark.api.java.JavaPairRDD;
import org.apache.spark.api.java.*;
[ "org.apache.spark" ]
org.apache.spark;
2,449,337
EClass getMultiTouchDevice();
EClass getMultiTouchDevice();
/** * Returns the meta object for class '{@link org.openhab.binding.tinkerforge.internal.model.MultiTouchDevice <em>Multi Touch Device</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for class '<em>Multi Touch Device</em>'. * @see org.openhab.binding.tinkerforge.internal.model.MultiTouchDevice * @generated */
Returns the meta object for class '<code>org.openhab.binding.tinkerforge.internal.model.MultiTouchDevice Multi Touch Device</code>'.
getMultiTouchDevice
{ "repo_name": "gregfinley/openhab", "path": "bundles/binding/org.openhab.binding.tinkerforge/src/main/java/org/openhab/binding/tinkerforge/internal/model/ModelPackage.java", "license": "epl-1.0", "size": 665067 }
[ "org.eclipse.emf.ecore.EClass" ]
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
63,987
void eventAdded(TraceList trace, ITraceEvent event);
void eventAdded(TraceList trace, ITraceEvent event);
/** * Invoked when an event was added to the trace list. * * @param trace The trace list where the event was added. * @param event The event that was added to the trace list. */
Invoked when an event was added to the trace list
eventAdded
{ "repo_name": "google/binnavi", "path": "src/main/java/com/google/security/zynamics/binnavi/debug/models/trace/interfaces/ITraceListListener.java", "license": "apache-2.0", "size": 1511 }
[ "com.google.security.zynamics.binnavi.debug.models.trace.TraceList" ]
import com.google.security.zynamics.binnavi.debug.models.trace.TraceList;
import com.google.security.zynamics.binnavi.debug.models.trace.*;
[ "com.google.security" ]
com.google.security;
2,102,297
IGame getGame();
IGame getGame();
/** * Get the current game. * * @return The current game. */
Get the current game
getGame
{ "repo_name": "warpwe/java-chess", "path": "src/com/github/warpwe/javachess/engine/IChessEngine.java", "license": "gpl-2.0", "size": 3084 }
[ "com.github.warpwe.javachess.game.IGame" ]
import com.github.warpwe.javachess.game.IGame;
import com.github.warpwe.javachess.game.*;
[ "com.github.warpwe" ]
com.github.warpwe;
849,573
private void initAdapter() { RandomVideoCollectionGenerator randomVideoCollectionGenerator = new RandomVideoCollectionGenerator(); List<Video> videoCollection = randomVideoCollectionGenerator.generate(VIDEO_COUNT); adapter = new RendererAdapter<>(new VideoRendererBuilder(), videoCollection); }
void function() { RandomVideoCollectionGenerator randomVideoCollectionGenerator = new RandomVideoCollectionGenerator(); List<Video> videoCollection = randomVideoCollectionGenerator.generate(VIDEO_COUNT); adapter = new RendererAdapter<>(new VideoRendererBuilder(), videoCollection); }
/** * Initialize RendererAdapter */
Initialize RendererAdapter
initAdapter
{ "repo_name": "pedrovgs/Renderers", "path": "sample/src/main/java/com/pedrogomez/renderers/sample/ui/ListViewActivity.java", "license": "apache-2.0", "size": 2054 }
[ "com.pedrogomez.renderers.RendererAdapter", "com.pedrogomez.renderers.sample.model.RandomVideoCollectionGenerator", "com.pedrogomez.renderers.sample.model.Video", "com.pedrogomez.renderers.sample.ui.builder.VideoRendererBuilder", "java.util.List" ]
import com.pedrogomez.renderers.RendererAdapter; import com.pedrogomez.renderers.sample.model.RandomVideoCollectionGenerator; import com.pedrogomez.renderers.sample.model.Video; import com.pedrogomez.renderers.sample.ui.builder.VideoRendererBuilder; import java.util.List;
import com.pedrogomez.renderers.*; import com.pedrogomez.renderers.sample.model.*; import com.pedrogomez.renderers.sample.ui.builder.*; import java.util.*;
[ "com.pedrogomez.renderers", "java.util" ]
com.pedrogomez.renderers; java.util;
740,783
@Test // BEGIN SUPRESS CATCH EXCEPTION public void test_context() { // END SUPRESS CATCH EXCEPTION IViewEditpart viewEditpart = (IViewEditpart) editpartManager .createEditpart(CoreModelPackage.eNS_URI, IViewEditpart.class); assertNull(viewEditpart.getContext()); ViewContext context = new ViewContext(viewEditpart); assertSame(context, viewEditpart.getContext()); assertSame(viewEditpart, context.getViewEditpart()); }
void function() { IViewEditpart viewEditpart = (IViewEditpart) editpartManager .createEditpart(CoreModelPackage.eNS_URI, IViewEditpart.class); assertNull(viewEditpart.getContext()); ViewContext context = new ViewContext(viewEditpart); assertSame(context, viewEditpart.getContext()); assertSame(viewEditpart, context.getViewEditpart()); }
/** * Tests the context. */
Tests the context
test_context
{ "repo_name": "lunifera/lunifera-ecview", "path": "org.lunifera.ecview.core.common.tests/src/org/lunifera/ecview/core/ui/common/tests/editparts/emf/ViewEditpartTest.java", "license": "epl-1.0", "size": 17189 }
[ "org.junit.Assert", "org.lunifera.ecview.core.common.context.ViewContext", "org.lunifera.ecview.core.common.editpart.IViewEditpart", "org.lunifera.ecview.core.common.model.core.CoreModelPackage" ]
import org.junit.Assert; import org.lunifera.ecview.core.common.context.ViewContext; import org.lunifera.ecview.core.common.editpart.IViewEditpart; import org.lunifera.ecview.core.common.model.core.CoreModelPackage;
import org.junit.*; import org.lunifera.ecview.core.common.context.*; import org.lunifera.ecview.core.common.editpart.*; import org.lunifera.ecview.core.common.model.core.*;
[ "org.junit", "org.lunifera.ecview" ]
org.junit; org.lunifera.ecview;
2,413,969
public void lockRecord(int recno) throws IOException, xBaseJException { unlockRecord(); long calcpos = offset + lrecl * (recno - 1); long thisWait = fileLockWait / 5; for (long waitloop = fileLockWait; waitloop > 0; waitloop -= thisWait) { recordlock = channel.tryLock(calcpos, lrecl, false); if (recordlock != null) { return; } synchronized (this) { try { wait(thisWait); } catch (InterruptedException ie) { } } // synch } throw new xBaseJException("file lock wait timed out"); }
void function(int recno) throws IOException, xBaseJException { unlockRecord(); long calcpos = offset + lrecl * (recno - 1); long thisWait = fileLockWait / 5; for (long waitloop = fileLockWait; waitloop > 0; waitloop -= thisWait) { recordlock = channel.tryLock(calcpos, lrecl, false); if (recordlock != null) { return; } synchronized (this) { try { wait(thisWait); } catch (InterruptedException ie) { } } } throw new xBaseJException(STR); }
/** * locks a particular record, exclusively <br> * will try 5 times within the fileLockTimeOut specified in org.xBaseJ.property * fileLockTimeOut, default 5000 milliseconds (5 seconds) * * @param recno record # to be locked * @throws IOException - related to java.nio.channels and filelocks * @throws xBaseJException - file lock wait timed out, */
locks a particular record, exclusively will try 5 times within the fileLockTimeOut specified in org.xBaseJ.property fileLockTimeOut, default 5000 milliseconds (5 seconds)
lockRecord
{ "repo_name": "michael-newsrx/xBaseJ", "path": "src/main/java/org/xBaseJ/DBF.java", "license": "lgpl-3.0", "size": 68710 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
1,517,246
public ServiceFuture<VirtualNetworkTapInner> beginCreateOrUpdateAsync(String resourceGroupName, String tapName, VirtualNetworkTapInner parameters, final ServiceCallback<VirtualNetworkTapInner> serviceCallback) { return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, tapName, parameters), serviceCallback); }
ServiceFuture<VirtualNetworkTapInner> function(String resourceGroupName, String tapName, VirtualNetworkTapInner parameters, final ServiceCallback<VirtualNetworkTapInner> serviceCallback) { return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, tapName, parameters), serviceCallback); }
/** * Creates or updates a Virtual Network Tap. * * @param resourceGroupName The name of the resource group. * @param tapName The name of the virtual network tap. * @param parameters Parameters supplied to the create or update virtual network tap operation. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */
Creates or updates a Virtual Network Tap
beginCreateOrUpdateAsync
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/network/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/network/v2020_03_01/implementation/VirtualNetworkTapsInner.java", "license": "mit", "size": 64262 }
[ "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;
983,019
static public String sendHttpPutRequest(String url, String contentType, String content) { return HttpUtil.executeUrl("PUT", url, IOUtils.toInputStream(content), contentType, 1000); }
static String function(String url, String contentType, String content) { return HttpUtil.executeUrl("PUT", url, IOUtils.toInputStream(content), contentType, 1000); }
/** * Send out a PUT-HTTP request. Errors will be logged, returned values just ignored. * * @param url the URL to be used for the PUT request. * @param contentType the content type of the given <code>content</code> * @param content the content to be send to the given <code>url</code> or * <code>null</code> if no content should be send. * @return the response body or <code>NULL</code> when the request went wrong */
Send out a PUT-HTTP request. Errors will be logged, returned values just ignored
sendHttpPutRequest
{ "repo_name": "Shibonja/openhab2", "path": "bundles/core/org.openhab.core.compat1x/src/main/java/org/openhab/io/net/actions/HTTP.java", "license": "epl-1.0", "size": 3512 }
[ "org.apache.commons.io.IOUtils", "org.openhab.io.net.http.HttpUtil" ]
import org.apache.commons.io.IOUtils; import org.openhab.io.net.http.HttpUtil;
import org.apache.commons.io.*; import org.openhab.io.net.http.*;
[ "org.apache.commons", "org.openhab.io" ]
org.apache.commons; org.openhab.io;
1,440,164
public ServiceResponseWithHeaders<Void, LROSADsPost202RetryInvalidHeaderHeaders> post202RetryInvalidHeader(Product product) throws CloudException, IOException, InterruptedException { Validator.validate(product); Response<ResponseBody> result = service.post202RetryInvalidHeader(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken<Void>() { }.getType(), LROSADsPost202RetryInvalidHeaderHeaders.class); }
ServiceResponseWithHeaders<Void, LROSADsPost202RetryInvalidHeaderHeaders> function(Product product) throws CloudException, IOException, InterruptedException { Validator.validate(product); Response<ResponseBody> result = service.post202RetryInvalidHeader(product, this.client.acceptLanguage(), this.client.userAgent()).execute(); return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken<Void>() { }.getType(), LROSADsPost202RetryInvalidHeaderHeaders.class); }
/** * Long running post request, service returns a 202 to the initial request, with invalid 'Location' and 'Retry-After' headers. * * @param product Product to put * @throws CloudException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization * @throws InterruptedException exception thrown when long running operation is interrupted * @return the ServiceResponseWithHeaders object if successful. */
Long running post request, service returns a 202 to the initial request, with invalid 'Location' and 'Retry-After' headers
post202RetryInvalidHeader
{ "repo_name": "yaqiyang/autorest", "path": "src/generator/AutoRest.Java.Azure.Tests/src/main/java/fixtures/lro/implementation/LROSADsImpl.java", "license": "mit", "size": 244275 }
[ "com.google.common.reflect.TypeToken", "com.microsoft.azure.CloudException", "com.microsoft.rest.ServiceResponseWithHeaders", "com.microsoft.rest.Validator", "java.io.IOException" ]
import com.google.common.reflect.TypeToken; import com.microsoft.azure.CloudException; import com.microsoft.rest.ServiceResponseWithHeaders; import com.microsoft.rest.Validator; import java.io.IOException;
import com.google.common.reflect.*; import com.microsoft.azure.*; import com.microsoft.rest.*; import java.io.*;
[ "com.google.common", "com.microsoft.azure", "com.microsoft.rest", "java.io" ]
com.google.common; com.microsoft.azure; com.microsoft.rest; java.io;
2,798,973
protected HttpEntity createRequestEntity(Exchange exchange) throws CamelExchangeException { Message in = exchange.getIn(); if (in.getBody() == null) { return null; } HttpEntity answer = in.getBody(HttpEntity.class); if (answer == null) { try { Object data = in.getBody(); if (data != null) { String contentTypeString = ExchangeHelper.getContentType(exchange); ContentType contentType = null; //Check the contentType is valid or not, If not it throws an exception. //When ContentType.parse parse method parse "multipart/form-data;boundary=---------------------------j2radvtrk", //it removes "boundary" from Content-Type; I have to use contentType.create method. if (contentTypeString != null) { // using ContentType.parser for charset if (contentTypeString.indexOf("charset") > 0) { contentType = ContentType.parse(contentTypeString); } else { contentType = ContentType.create(contentTypeString); } } if (contentTypeString != null && HttpConstants.CONTENT_TYPE_JAVA_SERIALIZED_OBJECT.equals(contentTypeString)) { if (!getEndpoint().getComponent().isAllowJavaSerializedObject()) { throw new CamelExchangeException("Content-type " + org.apache.camel.http.common.HttpConstants.CONTENT_TYPE_JAVA_SERIALIZED_OBJECT + " is not allowed", exchange); } // serialized java object Serializable obj = in.getMandatoryBody(Serializable.class); // write object to output stream ByteArrayOutputStream bos = new ByteArrayOutputStream(); HttpHelper.writeObjectToStream(bos, obj); ByteArrayEntity entity = new ByteArrayEntity(bos.toByteArray()); entity.setContentType(HttpConstants.CONTENT_TYPE_JAVA_SERIALIZED_OBJECT); IOHelper.close(bos); answer = entity; } else if (data instanceof File || data instanceof GenericFile) { // file based (could potentially also be a FTP file etc) File file = in.getBody(File.class); if (file != null) { if (contentType != null) { answer = new FileEntity(file, contentType); } else { answer = new FileEntity(file); } } } else if (data instanceof String) { // be a bit careful with String as any type can most likely be converted to String // so we only do an instanceof check and accept String if the body is really a String // do not fallback to use the default charset as it can influence the request // (for example application/x-www-form-urlencoded forms being sent) String charset = IOHelper.getCharsetName(exchange, false); if (charset == null && contentType != null) { // okay try to get the charset from the content-type Charset cs = contentType.getCharset(); if (cs != null) { charset = cs.name(); } } StringEntity entity = new StringEntity((String) data, charset); if (contentType != null) { entity.setContentType(contentType.toString()); } answer = entity; } // fallback as input stream if (answer == null) { // force the body as an input stream since this is the fallback InputStream is = in.getMandatoryBody(InputStream.class); String length = in.getHeader(Exchange.CONTENT_LENGTH, String.class); InputStreamEntity entity = null; if (ObjectHelper.isEmpty(length)) { entity = new InputStreamEntity(is, -1); } else { entity = new InputStreamEntity(is, Long.parseLong(length)); } if (contentType != null) { entity.setContentType(contentType.toString()); } answer = entity; } } } catch (UnsupportedEncodingException e) { throw new CamelExchangeException("Error creating RequestEntity from message body", exchange, e); } catch (IOException e) { throw new CamelExchangeException("Error serializing message body", exchange, e); } } return answer; }
HttpEntity function(Exchange exchange) throws CamelExchangeException { Message in = exchange.getIn(); if (in.getBody() == null) { return null; } HttpEntity answer = in.getBody(HttpEntity.class); if (answer == null) { try { Object data = in.getBody(); if (data != null) { String contentTypeString = ExchangeHelper.getContentType(exchange); ContentType contentType = null; if (contentTypeString != null) { if (contentTypeString.indexOf(STR) > 0) { contentType = ContentType.parse(contentTypeString); } else { contentType = ContentType.create(contentTypeString); } } if (contentTypeString != null && HttpConstants.CONTENT_TYPE_JAVA_SERIALIZED_OBJECT.equals(contentTypeString)) { if (!getEndpoint().getComponent().isAllowJavaSerializedObject()) { throw new CamelExchangeException(STR + org.apache.camel.http.common.HttpConstants.CONTENT_TYPE_JAVA_SERIALIZED_OBJECT + STR, exchange); } Serializable obj = in.getMandatoryBody(Serializable.class); ByteArrayOutputStream bos = new ByteArrayOutputStream(); HttpHelper.writeObjectToStream(bos, obj); ByteArrayEntity entity = new ByteArrayEntity(bos.toByteArray()); entity.setContentType(HttpConstants.CONTENT_TYPE_JAVA_SERIALIZED_OBJECT); IOHelper.close(bos); answer = entity; } else if (data instanceof File data instanceof GenericFile) { File file = in.getBody(File.class); if (file != null) { if (contentType != null) { answer = new FileEntity(file, contentType); } else { answer = new FileEntity(file); } } } else if (data instanceof String) { String charset = IOHelper.getCharsetName(exchange, false); if (charset == null && contentType != null) { Charset cs = contentType.getCharset(); if (cs != null) { charset = cs.name(); } } StringEntity entity = new StringEntity((String) data, charset); if (contentType != null) { entity.setContentType(contentType.toString()); } answer = entity; } if (answer == null) { InputStream is = in.getMandatoryBody(InputStream.class); String length = in.getHeader(Exchange.CONTENT_LENGTH, String.class); InputStreamEntity entity = null; if (ObjectHelper.isEmpty(length)) { entity = new InputStreamEntity(is, -1); } else { entity = new InputStreamEntity(is, Long.parseLong(length)); } if (contentType != null) { entity.setContentType(contentType.toString()); } answer = entity; } } } catch (UnsupportedEncodingException e) { throw new CamelExchangeException(STR, exchange, e); } catch (IOException e) { throw new CamelExchangeException(STR, exchange, e); } } return answer; }
/** * Creates a holder object for the data to send to the remote server. * * @param exchange the exchange with the IN message with data to send * @return the data holder * @throws CamelExchangeException is thrown if error creating RequestEntity */
Creates a holder object for the data to send to the remote server
createRequestEntity
{ "repo_name": "erwelch/camel", "path": "components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpProducer.java", "license": "apache-2.0", "size": 24945 }
[ "java.io.ByteArrayOutputStream", "java.io.File", "java.io.IOException", "java.io.InputStream", "java.io.Serializable", "java.io.UnsupportedEncodingException", "java.nio.charset.Charset", "org.apache.camel.CamelExchangeException", "org.apache.camel.Exchange", "org.apache.camel.Message", "org.apache.camel.component.file.GenericFile", "org.apache.camel.http.common.HttpHelper", "org.apache.camel.util.ExchangeHelper", "org.apache.camel.util.IOHelper", "org.apache.camel.util.ObjectHelper", "org.apache.http.HttpEntity", "org.apache.http.entity.ByteArrayEntity", "org.apache.http.entity.ContentType", "org.apache.http.entity.FileEntity", "org.apache.http.entity.InputStreamEntity", "org.apache.http.entity.StringEntity" ]
import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.Serializable; import java.io.UnsupportedEncodingException; import java.nio.charset.Charset; import org.apache.camel.CamelExchangeException; import org.apache.camel.Exchange; import org.apache.camel.Message; import org.apache.camel.component.file.GenericFile; import org.apache.camel.http.common.HttpHelper; import org.apache.camel.util.ExchangeHelper; import org.apache.camel.util.IOHelper; import org.apache.camel.util.ObjectHelper; import org.apache.http.HttpEntity; import org.apache.http.entity.ByteArrayEntity; import org.apache.http.entity.ContentType; import org.apache.http.entity.FileEntity; import org.apache.http.entity.InputStreamEntity; import org.apache.http.entity.StringEntity;
import java.io.*; import java.nio.charset.*; import org.apache.camel.*; import org.apache.camel.component.file.*; import org.apache.camel.http.common.*; import org.apache.camel.util.*; import org.apache.http.*; import org.apache.http.entity.*;
[ "java.io", "java.nio", "org.apache.camel", "org.apache.http" ]
java.io; java.nio; org.apache.camel; org.apache.http;
2,132,482