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
|
|---|---|---|---|---|---|---|---|---|---|---|---|
@Override
public synchronized void controllerUpdate(ControllerEvent ce) {
Player p = (Player) ce.getSourceController();
if (p == null)
return;
// Get this when the internal players are realized.
if (ce instanceof RealizeCompleteEvent) {
p.start();
}
if (ce instanceof ControllerErrorEvent) {
p.removeControllerListener(this);
LOGGER.severe("Receiver internal error: " + ce);
}
}
|
synchronized void function(ControllerEvent ce) { Player p = (Player) ce.getSourceController(); if (p == null) return; if (ce instanceof RealizeCompleteEvent) { p.start(); } if (ce instanceof ControllerErrorEvent) { p.removeControllerListener(this); LOGGER.severe(STR + ce); } }
|
/**
* ControllerListener for the Players.
*/
|
ControllerListener for the Players
|
controllerUpdate
|
{
"repo_name": "annovanvliet/Smack",
"path": "smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/jmf/AudioReceiver.java",
"license": "apache-2.0",
"size": 5849
}
|
[
"javax.media.ControllerErrorEvent",
"javax.media.ControllerEvent",
"javax.media.Player",
"javax.media.RealizeCompleteEvent"
] |
import javax.media.ControllerErrorEvent; import javax.media.ControllerEvent; import javax.media.Player; import javax.media.RealizeCompleteEvent;
|
import javax.media.*;
|
[
"javax.media"
] |
javax.media;
| 2,197,360
|
@Test
public void testGetAll() {
List<VM> result = dao.getAll();
VmDAOTest.assertCorrectGetAllResult(result);
}
|
void function() { List<VM> result = dao.getAll(); VmDAOTest.assertCorrectGetAllResult(result); }
|
/**
* Ensures that getting all VMs works as expected.
*/
|
Ensures that getting all VMs works as expected
|
testGetAll
|
{
"repo_name": "jbeecham/ovirt-engine",
"path": "backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/VmDAOTest.java",
"license": "apache-2.0",
"size": 10041
}
|
[
"java.util.List"
] |
import java.util.List;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 1,200,279
|
public static int[] colRowFromCoordinate( Coordinate coordinate, GridGeometry2D gridGeometry, Point point ) {
try {
DirectPosition pos = new DirectPosition2D(coordinate.x, coordinate.y);
GridCoordinates2D worldToGrid = gridGeometry.worldToGrid(pos);
if (point != null) {
point.x = worldToGrid.x;
point.y = worldToGrid.y;
}
return new int[]{worldToGrid.x, worldToGrid.y};
} catch (InvalidGridGeometryException e) {
e.printStackTrace();
} catch (TransformException e) {
e.printStackTrace();
}
point.x = Integer.MAX_VALUE;
point.y = Integer.MAX_VALUE;
return null;
}
|
static int[] function( Coordinate coordinate, GridGeometry2D gridGeometry, Point point ) { try { DirectPosition pos = new DirectPosition2D(coordinate.x, coordinate.y); GridCoordinates2D worldToGrid = gridGeometry.worldToGrid(pos); if (point != null) { point.x = worldToGrid.x; point.y = worldToGrid.y; } return new int[]{worldToGrid.x, worldToGrid.y}; } catch (InvalidGridGeometryException e) { e.printStackTrace(); } catch (TransformException e) { e.printStackTrace(); } point.x = Integer.MAX_VALUE; point.y = Integer.MAX_VALUE; return null; }
|
/**
* Utility method to get col and row of a coordinate from a {@link GridGeometry2D}.
*
* @param coordinate the coordinate to transform.
* @param gridGeometry the gridgeometry to use.
* @param point if not <code>null</code>, the row col values are put inside the supplied point's x and y.
* @return the array with [col, row] or <code>null</code> if something went wrong.
*/
|
Utility method to get col and row of a coordinate from a <code>GridGeometry2D</code>
|
colRowFromCoordinate
|
{
"repo_name": "silviafranceschi/jgrasstools",
"path": "jgrassgears/src/main/java/org/jgrasstools/gears/utils/coverage/CoverageUtilities.java",
"license": "gpl-3.0",
"size": 64605
}
|
[
"com.vividsolutions.jts.geom.Coordinate",
"java.awt.Point",
"org.geotools.coverage.grid.GridCoordinates2D",
"org.geotools.coverage.grid.GridGeometry2D",
"org.geotools.coverage.grid.InvalidGridGeometryException",
"org.geotools.geometry.DirectPosition2D",
"org.opengis.geometry.DirectPosition",
"org.opengis.referencing.operation.TransformException"
] |
import com.vividsolutions.jts.geom.Coordinate; import java.awt.Point; import org.geotools.coverage.grid.GridCoordinates2D; import org.geotools.coverage.grid.GridGeometry2D; import org.geotools.coverage.grid.InvalidGridGeometryException; import org.geotools.geometry.DirectPosition2D; import org.opengis.geometry.DirectPosition; import org.opengis.referencing.operation.TransformException;
|
import com.vividsolutions.jts.geom.*; import java.awt.*; import org.geotools.coverage.grid.*; import org.geotools.geometry.*; import org.opengis.geometry.*; import org.opengis.referencing.operation.*;
|
[
"com.vividsolutions.jts",
"java.awt",
"org.geotools.coverage",
"org.geotools.geometry",
"org.opengis.geometry",
"org.opengis.referencing"
] |
com.vividsolutions.jts; java.awt; org.geotools.coverage; org.geotools.geometry; org.opengis.geometry; org.opengis.referencing;
| 1,992,248
|
public static <T, W extends BoundedWindow> boolean
skipAssignWindows(Window.Bound<T> transform, EvaluationContext context) {
@SuppressWarnings("unchecked")
WindowFn<? super T, W> windowFn = (WindowFn<? super T, W>) transform.getWindowFn();
return windowFn == null
|| (context.getInput(transform).getWindowingStrategy().getWindowFn()
instanceof GlobalWindows
&& windowFn instanceof GlobalWindows);
}
|
static <T, W extends BoundedWindow> boolean function(Window.Bound<T> transform, EvaluationContext context) { @SuppressWarnings(STR) WindowFn<? super T, W> windowFn = (WindowFn<? super T, W>) transform.getWindowFn(); return windowFn == null (context.getInput(transform).getWindowingStrategy().getWindowFn() instanceof GlobalWindows && windowFn instanceof GlobalWindows); }
|
/**
* Checks if the window transformation should be applied or skipped.
*
* <p>
* Avoid running assign windows if both source and destination are global window
* or if the user has not specified the WindowFn (meaning they are just messing
* with triggering or allowed lateness).
* </p>
*
* @param transform The {@link Window.Bound} transformation.
* @param context The {@link EvaluationContext}.
* @param <T> PCollection type.
* @param <W> {@link BoundedWindow} type.
* @return if to apply the transformation.
*/
|
Checks if the window transformation should be applied or skipped. Avoid running assign windows if both source and destination are global window or if the user has not specified the WindowFn (meaning they are just messing with triggering or allowed lateness).
|
skipAssignWindows
|
{
"repo_name": "jasonkuster/incubator-beam",
"path": "runners/spark/src/main/java/org/apache/beam/runners/spark/translation/TranslationUtils.java",
"license": "apache-2.0",
"size": 9574
}
|
[
"org.apache.beam.sdk.transforms.windowing.BoundedWindow",
"org.apache.beam.sdk.transforms.windowing.GlobalWindows",
"org.apache.beam.sdk.transforms.windowing.Window",
"org.apache.beam.sdk.transforms.windowing.WindowFn"
] |
import org.apache.beam.sdk.transforms.windowing.BoundedWindow; import org.apache.beam.sdk.transforms.windowing.GlobalWindows; import org.apache.beam.sdk.transforms.windowing.Window; import org.apache.beam.sdk.transforms.windowing.WindowFn;
|
import org.apache.beam.sdk.transforms.windowing.*;
|
[
"org.apache.beam"
] |
org.apache.beam;
| 125,377
|
BufferedImage renderPlane(PlaneDef pDef, int compression);
|
BufferedImage renderPlane(PlaneDef pDef, int compression);
|
/**
* Renders the specified plane.
*
* @param pDef The plane to render.
* @param compression The compression level.
* @return See above.
*/
|
Renders the specified plane
|
renderPlane
|
{
"repo_name": "aleksandra-tarkowska/openmicroscopy",
"path": "components/insight/SRC/org/openmicroscopy/shoola/agents/metadata/rnd/Renderer.java",
"license": "gpl-2.0",
"size": 22658
}
|
[
"java.awt.image.BufferedImage"
] |
import java.awt.image.BufferedImage;
|
import java.awt.image.*;
|
[
"java.awt"
] |
java.awt;
| 2,186,742
|
Geometry fixGeometryType(Geometry ogrGeometry, AttributeDescriptor ad) {
if (MultiPolygon.class.equals(ad.getType().getBinding())) {
if (ogrGeometry instanceof MultiPolygon) return ogrGeometry;
else return geomFactory.createMultiPolygon(new Polygon[] {(Polygon) ogrGeometry});
} else if (MultiLineString.class.equals(ad.getType().getBinding())) {
if (ogrGeometry instanceof MultiLineString) return ogrGeometry;
else
return geomFactory.createMultiLineString(
new LineString[] {(LineString) ogrGeometry});
}
return ogrGeometry;
}
|
Geometry fixGeometryType(Geometry ogrGeometry, AttributeDescriptor ad) { if (MultiPolygon.class.equals(ad.getType().getBinding())) { if (ogrGeometry instanceof MultiPolygon) return ogrGeometry; else return geomFactory.createMultiPolygon(new Polygon[] {(Polygon) ogrGeometry}); } else if (MultiLineString.class.equals(ad.getType().getBinding())) { if (ogrGeometry instanceof MultiLineString) return ogrGeometry; else return geomFactory.createMultiLineString( new LineString[] {(LineString) ogrGeometry}); } return ogrGeometry; }
|
/**
* Turns line and polygon into multiline and multipolygon. This is a stop-gap measure to make
* things works against shapefiles, I've asked the GDAL mailing list on how to properly handle
* this in the meantime
*/
|
Turns line and polygon into multiline and multipolygon. This is a stop-gap measure to make things works against shapefiles, I've asked the GDAL mailing list on how to properly handle this in the meantime
|
fixGeometryType
|
{
"repo_name": "geotools/geotools",
"path": "modules/unsupported/ogr/ogr-core/src/main/java/org/geotools/data/ogr/FeatureMapper.java",
"license": "lgpl-2.1",
"size": 14030
}
|
[
"org.locationtech.jts.geom.Geometry",
"org.locationtech.jts.geom.LineString",
"org.locationtech.jts.geom.MultiLineString",
"org.locationtech.jts.geom.MultiPolygon",
"org.locationtech.jts.geom.Polygon",
"org.opengis.feature.type.AttributeDescriptor"
] |
import org.locationtech.jts.geom.Geometry; import org.locationtech.jts.geom.LineString; import org.locationtech.jts.geom.MultiLineString; import org.locationtech.jts.geom.MultiPolygon; import org.locationtech.jts.geom.Polygon; import org.opengis.feature.type.AttributeDescriptor;
|
import org.locationtech.jts.geom.*; import org.opengis.feature.type.*;
|
[
"org.locationtech.jts",
"org.opengis.feature"
] |
org.locationtech.jts; org.opengis.feature;
| 208,751
|
@Test(expected = RuntimeException.class)
public void rejectsNullProcesses() throws Exception {
final ProcessBuilder builder = null;
new VerboseProcess(builder);
}
|
@Test(expected = RuntimeException.class) void function() throws Exception { final ProcessBuilder builder = null; new VerboseProcess(builder); }
|
/**
* VerboseProcess can reject NULL.
* @throws Exception If something goes wrong
*/
|
VerboseProcess can reject NULL
|
rejectsNullProcesses
|
{
"repo_name": "simonjenga/jcabi-log",
"path": "src/test/java/com/jcabi/log/VerboseProcessTest.java",
"license": "bsd-3-clause",
"size": 18067
}
|
[
"org.junit.Test"
] |
import org.junit.Test;
|
import org.junit.*;
|
[
"org.junit"
] |
org.junit;
| 81,968
|
public CoreContainer getCoreContainer() {
return this.coreContainer;
}
|
CoreContainer function() { return this.coreContainer; }
|
/**
* The instance of CoreContainer this handler handles. This should be the CoreContainer instance that created this
* handler.
*
* @return a CoreContainer instance
*/
|
The instance of CoreContainer this handler handles. This should be the CoreContainer instance that created this handler
|
getCoreContainer
|
{
"repo_name": "cscorley/solr-only-mirror",
"path": "core/src/java/org/apache/solr/handler/admin/CollectionsHandler.java",
"license": "apache-2.0",
"size": 40820
}
|
[
"org.apache.solr.core.CoreContainer"
] |
import org.apache.solr.core.CoreContainer;
|
import org.apache.solr.core.*;
|
[
"org.apache.solr"
] |
org.apache.solr;
| 784,698
|
public String[] similarBySound(String input) {
Set<String> result = new HashSet<String>();
similarBySound(input, result, 1);
return SetOp.toStringArray(result);
}
|
String[] function(String input) { Set<String> result = new HashSet<String>(); similarBySound(input, result, 1); return SetOp.toStringArray(result); }
|
/**
* Compares the phonemes of the input String to those of each word in the
* lexicon, returning the set of closest matches as a String[].
*/
|
Compares the phonemes of the input String to those of each word in the lexicon, returning the set of closest matches as a String[]
|
similarBySound
|
{
"repo_name": "FreeSchoolHackers/RiTa",
"path": "java/rita/RiLexicon.java",
"license": "gpl-3.0",
"size": 24041
}
|
[
"java.util.HashSet",
"java.util.Set"
] |
import java.util.HashSet; import java.util.Set;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 950,998
|
public static void removeByThemeId(java.lang.String themeId)
throws com.liferay.portal.kernel.exception.SystemException {
getPersistence().removeByThemeId(themeId);
}
|
static void function(java.lang.String themeId) throws com.liferay.portal.kernel.exception.SystemException { getPersistence().removeByThemeId(themeId); }
|
/**
* Removes all the user personalized themes where themeId = ? from the database.
*
* @param themeId the theme ID
* @throws SystemException if a system exception occurred
*/
|
Removes all the user personalized themes where themeId = ? from the database
|
removeByThemeId
|
{
"repo_name": "knowarth-technologies/theme-personalizer",
"path": "liferay-6-1-2/theme-personalizer/theme-personalizer-portlet-service/src/main/java/com/knowarth/portlets/themepersonalizer/service/persistence/UserPersonalizedThemeUtil.java",
"license": "lgpl-2.1",
"size": 49816
}
|
[
"com.liferay.portal.kernel.exception.SystemException"
] |
import com.liferay.portal.kernel.exception.SystemException;
|
import com.liferay.portal.kernel.exception.*;
|
[
"com.liferay.portal"
] |
com.liferay.portal;
| 2,245,092
|
public ActivateVoucherBatchResult activateVoucherBatch(String vsvId, int batchNumber);
|
ActivateVoucherBatchResult function(String vsvId, int batchNumber);
|
/**
* Activate a particular VoucherBatch.
*
* @param vsvId the identifier of the VoucherBatchOwner who owns the VoucherBatch
* @param batchNumber the batchNumber, a unique sequential number per VoucherBatchOwner
* @return ActivateVoucherBatchResult
*/
|
Activate a particular VoucherBatch
|
activateVoucherBatch
|
{
"repo_name": "nicodewet/vouchertool",
"path": "vouchserv/src/main/java/com/mayloom/vouchserv/dbo/DatabaseHelper.java",
"license": "apache-2.0",
"size": 12555
}
|
[
"com.mayloom.vouchserv.api.res.ActivateVoucherBatchResult"
] |
import com.mayloom.vouchserv.api.res.ActivateVoucherBatchResult;
|
import com.mayloom.vouchserv.api.res.*;
|
[
"com.mayloom.vouchserv"
] |
com.mayloom.vouchserv;
| 304,873
|
@SuppressWarnings("unchecked")
public <R> ScoredValue<R> map(Function<? super V, ? extends R> mapper) {
LettuceAssert.notNull(mapper, "Mapper function must not be null");
if (hasValue()) {
return new ScoredValue<>(score, mapper.apply(getValue()));
}
return (ScoredValue<R>) this;
}
|
@SuppressWarnings(STR) <R> ScoredValue<R> function(Function<? super V, ? extends R> mapper) { LettuceAssert.notNull(mapper, STR); if (hasValue()) { return new ScoredValue<>(score, mapper.apply(getValue())); } return (ScoredValue<R>) this; }
|
/**
* Returns a {@link ScoredValue} consisting of the results of applying the given function to the value of this element.
* Mapping is performed only if a {@link #hasValue() value is present}.
*
* @param <R> element type of the new {@link ScoredValue}.
* @param mapper a stateless function to apply to each element.
* @return the new {@link ScoredValue}.
*/
|
Returns a <code>ScoredValue</code> consisting of the results of applying the given function to the value of this element. Mapping is performed only if a <code>#hasValue() value is present</code>
|
map
|
{
"repo_name": "lettuce-io/lettuce-core",
"path": "src/main/java/io/lettuce/core/ScoredValue.java",
"license": "apache-2.0",
"size": 5455
}
|
[
"io.lettuce.core.internal.LettuceAssert",
"java.util.function.Function"
] |
import io.lettuce.core.internal.LettuceAssert; import java.util.function.Function;
|
import io.lettuce.core.internal.*; import java.util.function.*;
|
[
"io.lettuce.core",
"java.util"
] |
io.lettuce.core; java.util;
| 917,637
|
@POST
@Path("/{id}/actions/edit-offline-check-in")
@Consumes(MediaType.MULTIPART_FORM_DATA)
public ContentInfo updateContent(UploadRequest uploadRequest, @PathParam(RequestParams.KEY_ID) String targetId,
@QueryParam(VERSION) String version) {
uploadRequest.setTargetId(targetId);
uploadRequest.setInstanceVersion(version);
return (ContentInfo) actions.callAction(uploadRequest);
}
|
@Path(STR) @Consumes(MediaType.MULTIPART_FORM_DATA) ContentInfo function(UploadRequest uploadRequest, @PathParam(RequestParams.KEY_ID) String targetId, @QueryParam(VERSION) String version) { uploadRequest.setTargetId(targetId); uploadRequest.setInstanceVersion(version); return (ContentInfo) actions.callAction(uploadRequest); }
|
/**
* Performs a check-in or plain update operation of the provided file. Its content is updated and the associated
* instance is unlocked, if it meets all validation requirements.
*
* @param uploadRequest
* the upload request
* @param targetId
* the updated instance ID
* @param version
* the affected instance version
* @return a content info containing information for the uploaded file
*/
|
Performs a check-in or plain update operation of the provided file. Its content is updated and the associated instance is unlocked, if it meets all validation requirements
|
updateContent
|
{
"repo_name": "SirmaITT/conservation-space-1.7.0",
"path": "docker/sirma-platform/platform/seip-parent/platform/domain-model/instance-content/src/main/java/com/sirma/itt/seip/instance/editoffline/actions/EditOfflineRestService.java",
"license": "lgpl-3.0",
"size": 2704
}
|
[
"com.sirma.itt.seip.rest.utils.request.params.RequestParams",
"com.sirma.sep.content.ContentInfo",
"com.sirma.sep.content.upload.UploadRequest",
"javax.ws.rs.Consumes",
"javax.ws.rs.Path",
"javax.ws.rs.PathParam",
"javax.ws.rs.QueryParam",
"javax.ws.rs.core.MediaType"
] |
import com.sirma.itt.seip.rest.utils.request.params.RequestParams; import com.sirma.sep.content.ContentInfo; import com.sirma.sep.content.upload.UploadRequest; import javax.ws.rs.Consumes; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.QueryParam; import javax.ws.rs.core.MediaType;
|
import com.sirma.itt.seip.rest.utils.request.params.*; import com.sirma.sep.content.*; import com.sirma.sep.content.upload.*; import javax.ws.rs.*; import javax.ws.rs.core.*;
|
[
"com.sirma.itt",
"com.sirma.sep",
"javax.ws"
] |
com.sirma.itt; com.sirma.sep; javax.ws;
| 1,184,404
|
public void run() {
try {
while (!this.disposed) {
ITransferable object = this.getNextMessageFromQueue();
this.sendMessageToAllClients(object, null);
}
} catch (InterruptedException ie) {
this.errorHandler.errorHasOccurred(new EventArgs<ITransferable>(this, TransferableObjectFactory.CreateServerMessage("ServerDispatcher thread interrupted, stopped its execution", MessageType.Error)));
this.dispose();
}
}
|
void function() { try { while (!this.disposed) { ITransferable object = this.getNextMessageFromQueue(); this.sendMessageToAllClients(object, null); } } catch (InterruptedException ie) { this.errorHandler.errorHasOccurred(new EventArgs<ITransferable>(this, TransferableObjectFactory.CreateServerMessage(STR, MessageType.Error))); this.dispose(); } }
|
/**
* Infinitely reads messages from the queue and dispatch them
* to all clients connected to the server.
*/
|
Infinitely reads messages from the queue and dispatch them to all clients connected to the server
|
run
|
{
"repo_name": "cschaf/java-multithreaded-chat",
"path": "src/main/java/de/hsbremen/chat/server/ServerDispatcher.java",
"license": "mit",
"size": 9142
}
|
[
"de.hsbremen.chat.events.EventArgs",
"de.hsbremen.chat.network.ITransferable",
"de.hsbremen.chat.network.MessageType",
"de.hsbremen.chat.network.TransferableObjectFactory"
] |
import de.hsbremen.chat.events.EventArgs; import de.hsbremen.chat.network.ITransferable; import de.hsbremen.chat.network.MessageType; import de.hsbremen.chat.network.TransferableObjectFactory;
|
import de.hsbremen.chat.events.*; import de.hsbremen.chat.network.*;
|
[
"de.hsbremen.chat"
] |
de.hsbremen.chat;
| 2,282,074
|
public int getMonths() {
return getInt(DatatypeConstants.MONTHS);
}
|
int function() { return getInt(DatatypeConstants.MONTHS); }
|
/**
* Obtains the value of the MONTHS field as an integer value,
* or 0 if not present.
*
* This method works just like {@link #getYears()} except
* that this method works on the MONTHS field.
*
* @return Months of this <code>Duration</code>.
*/
|
Obtains the value of the MONTHS field as an integer value, or 0 if not present. This method works just like <code>#getYears()</code> except that this method works on the MONTHS field
|
getMonths
|
{
"repo_name": "lostdj/Jaklin-OpenJDK-JAXP",
"path": "src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/datatype/DurationImpl.java",
"license": "gpl-2.0",
"size": 64698
}
|
[
"javax.xml.datatype.DatatypeConstants"
] |
import javax.xml.datatype.DatatypeConstants;
|
import javax.xml.datatype.*;
|
[
"javax.xml"
] |
javax.xml;
| 2,477,218
|
public void testCompare_SingleThreadedPool_And_ResourceLimitingPool_Max10_Gets20_SmallPoolables()
throws Exception
{
String name = "SingleThreadedPool_And_ResourceLimitingPool_Max10_Gets20_SmallPoolables";
Class poolableClass = SmallPoolable.class;
ObjectFactory factory = new ClassInstanceObjectFactory( poolableClass, m_poolLogger );
int min = 0;
int max = 10;
boolean maxStrict = false;
boolean blocking = false;
long blockTimeout = 0;
long trimInterval = 0;
SingleThreadedPool poolA = new SingleThreadedPool( factory, min, max );
poolA.enableLogging( m_poolLogger );
poolA.initialize();
ResourceLimitingPool poolB = new ResourceLimitingPool( factory, max, maxStrict, blocking, blockTimeout, trimInterval );
poolB.enableLogging( m_poolLogger );
generalTest( name, poolA, poolB, 20, factory );
}
|
void function() throws Exception { String name = STR; Class poolableClass = SmallPoolable.class; ObjectFactory factory = new ClassInstanceObjectFactory( poolableClass, m_poolLogger ); int min = 0; int max = 10; boolean maxStrict = false; boolean blocking = false; long blockTimeout = 0; long trimInterval = 0; SingleThreadedPool poolA = new SingleThreadedPool( factory, min, max ); poolA.enableLogging( m_poolLogger ); poolA.initialize(); ResourceLimitingPool poolB = new ResourceLimitingPool( factory, max, maxStrict, blocking, blockTimeout, trimInterval ); poolB.enableLogging( m_poolLogger ); generalTest( name, poolA, poolB, 20, factory ); }
|
/**
* Compare the SingleThreadedPool and ResourceLimitingPool when the
* ResourceLimitingPool is configured to act like a SingleThreadedPool.
* <p>
* Test will use pools with a max size of 10, while getting up to 20 at a time,
* Poolables are small objects.
*/
|
Compare the SingleThreadedPool and ResourceLimitingPool when the ResourceLimitingPool is configured to act like a SingleThreadedPool. Test will use pools with a max size of 10, while getting up to 20 at a time, Poolables are small objects
|
testCompare_SingleThreadedPool_And_ResourceLimitingPool_Max10_Gets20_SmallPoolables
|
{
"repo_name": "eva-xuyen/excalibur",
"path": "components/pool/impl/src/test/java/org/apache/avalon/excalibur/pool/test/SingleThreadedPoolComparisonProfile.java",
"license": "apache-2.0",
"size": 10606
}
|
[
"org.apache.avalon.excalibur.pool.ObjectFactory",
"org.apache.avalon.excalibur.pool.ResourceLimitingPool",
"org.apache.avalon.excalibur.pool.SingleThreadedPool"
] |
import org.apache.avalon.excalibur.pool.ObjectFactory; import org.apache.avalon.excalibur.pool.ResourceLimitingPool; import org.apache.avalon.excalibur.pool.SingleThreadedPool;
|
import org.apache.avalon.excalibur.pool.*;
|
[
"org.apache.avalon"
] |
org.apache.avalon;
| 2,739,378
|
EAttribute getNilValueType_NilReason();
|
EAttribute getNilValueType_NilReason();
|
/**
* Returns the meta object for the attribute '{@link net.opengis.ows20.NilValueType#getNilReason <em>Nil Reason</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the attribute '<em>Nil Reason</em>'.
* @see net.opengis.ows20.NilValueType#getNilReason()
* @see #getNilValueType()
* @generated
*/
|
Returns the meta object for the attribute '<code>net.opengis.ows20.NilValueType#getNilReason Nil Reason</code>'.
|
getNilValueType_NilReason
|
{
"repo_name": "geotools/geotools",
"path": "modules/ogc/net.opengis.ows/src/net/opengis/ows20/Ows20Package.java",
"license": "lgpl-2.1",
"size": 356067
}
|
[
"org.eclipse.emf.ecore.EAttribute"
] |
import org.eclipse.emf.ecore.EAttribute;
|
import org.eclipse.emf.ecore.*;
|
[
"org.eclipse.emf"
] |
org.eclipse.emf;
| 1,706,387
|
@ServiceMethod(returns = ReturnType.SINGLE)
Response<SqlPoolSecurityAlertPolicyInner> getWithResponse(
String resourceGroupName,
String workspaceName,
String sqlPoolName,
SecurityAlertPolicyName securityAlertPolicyName,
Context context);
|
@ServiceMethod(returns = ReturnType.SINGLE) Response<SqlPoolSecurityAlertPolicyInner> getWithResponse( String resourceGroupName, String workspaceName, String sqlPoolName, SecurityAlertPolicyName securityAlertPolicyName, Context context);
|
/**
* Get a Sql pool's security alert policy.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param workspaceName The name of the workspace.
* @param sqlPoolName SQL pool name.
* @param securityAlertPolicyName The name of the security alert policy.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a Sql pool's security alert policy along with {@link Response}.
*/
|
Get a Sql pool's security alert policy
|
getWithResponse
|
{
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/synapse/azure-resourcemanager-synapse/src/main/java/com/azure/resourcemanager/synapse/fluent/SqlPoolSecurityAlertPoliciesClient.java",
"license": "mit",
"size": 6750
}
|
[
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.core.http.rest.Response",
"com.azure.core.util.Context",
"com.azure.resourcemanager.synapse.fluent.models.SqlPoolSecurityAlertPolicyInner",
"com.azure.resourcemanager.synapse.models.SecurityAlertPolicyName"
] |
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.Response; import com.azure.core.util.Context; import com.azure.resourcemanager.synapse.fluent.models.SqlPoolSecurityAlertPolicyInner; import com.azure.resourcemanager.synapse.models.SecurityAlertPolicyName;
|
import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.util.*; import com.azure.resourcemanager.synapse.fluent.models.*; import com.azure.resourcemanager.synapse.models.*;
|
[
"com.azure.core",
"com.azure.resourcemanager"
] |
com.azure.core; com.azure.resourcemanager;
| 2,443,249
|
public Date getPeriodStart() {
// one usage periods for one-time orders have no distinct billing periods
if (usagePeriod.getBillingPeriods() == null) {
return usagePeriod.getCycleStartDate();
}
// get the first period entry in the list - will be N number of periods in the past
PeriodOfTime start = usagePeriod.getBillingPeriods().get(0);
return start.getStart();
}
|
Date function() { if (usagePeriod.getBillingPeriods() == null) { return usagePeriod.getCycleStartDate(); } PeriodOfTime start = usagePeriod.getBillingPeriods().get(0); return start.getStart(); }
|
/**
* Returns the start date for the defined period of usage (period of time spanning
* back N number of periods; {@link #getPeriods()}).
*
* @return usage period start date.
*/
|
Returns the start date for the defined period of usage (period of time spanning back N number of periods; <code>#getPeriods()</code>)
|
getPeriodStart
|
{
"repo_name": "liquidJbilling/LT-Jbilling-MsgQ-3.1",
"path": "src/java/com/sapienter/jbilling/server/order/UsageBL.java",
"license": "agpl-3.0",
"size": 17946
}
|
[
"com.sapienter.jbilling.server.process.PeriodOfTime",
"java.util.Date"
] |
import com.sapienter.jbilling.server.process.PeriodOfTime; import java.util.Date;
|
import com.sapienter.jbilling.server.process.*; import java.util.*;
|
[
"com.sapienter.jbilling",
"java.util"
] |
com.sapienter.jbilling; java.util;
| 1,198,244
|
private void extractMethodsInvoked(List<Invoke> invokedMethodsInsideProject,
List<Method> methods)
{
for (Method m : methods)
{
List<Instruction> instructions = m.getInstructions();
for (Instruction instr : instructions)
{
if (instr instanceof Invoke)
{
Invoke invoke = (Invoke) instr;
invokedMethodsInsideProject.add(invoke);
}
}
}
}
|
void function(List<Invoke> invokedMethodsInsideProject, List<Method> methods) { for (Method m : methods) { List<Instruction> instructions = m.getInstructions(); for (Instruction instr : instructions) { if (instr instanceof Invoke) { Invoke invoke = (Invoke) instr; invokedMethodsInsideProject.add(invoke); } } } }
|
/**
* Lists all methods invoked by a APK, given a list of methods.
*
* @param invokedMethodsInsideProject List of {@link Invoke} methods inside
* the project.
* @param methods List of methods where the search will be done.
*/
|
Lists all methods invoked by a APK, given a list of methods
|
extractMethodsInvoked
|
{
"repo_name": "rex-xxx/mt6572_x201",
"path": "tools/motodev/src/plugins/preflighting.core/src/com/motorolamobility/preflighting/core/applicationdata/SourceFolderElement.java",
"license": "gpl-2.0",
"size": 14630
}
|
[
"com.motorolamobility.preflighting.core.source.model.Instruction",
"com.motorolamobility.preflighting.core.source.model.Invoke",
"com.motorolamobility.preflighting.core.source.model.Method",
"java.util.List"
] |
import com.motorolamobility.preflighting.core.source.model.Instruction; import com.motorolamobility.preflighting.core.source.model.Invoke; import com.motorolamobility.preflighting.core.source.model.Method; import java.util.List;
|
import com.motorolamobility.preflighting.core.source.model.*; import java.util.*;
|
[
"com.motorolamobility.preflighting",
"java.util"
] |
com.motorolamobility.preflighting; java.util;
| 683,936
|
public static void main(String[] args) {
try {
//=============================================================
// Authenticate
//
System.out.println("AZURE_AUTH_LOCATION_2=" + System.getenv("AZURE_AUTH_LOCATION_2"));
final File credFile = new File(System.getenv("AZURE_AUTH_LOCATION_2"));
Azure azure = Azure
.configure()
.withLogLevel(LogLevel.NONE)
.authenticate(credFile)
.withDefaultSubscription();
// Print selected subscription
System.out.println("Selected subscription: " + azure.subscriptionId());
runSample(azure);
} catch (Exception e) {
System.out.println(e.getMessage());
e.printStackTrace();
}
}
private CreateVirtualMachinesInParallel() {
}
|
static void function(String[] args) { try { final File credFile = new File(System.getenv(STR)); Azure azure = Azure .configure() .withLogLevel(LogLevel.NONE) .authenticate(credFile) .withDefaultSubscription(); System.out.println(STR + azure.subscriptionId()); runSample(azure); } catch (Exception e) { System.out.println(e.getMessage()); e.printStackTrace(); } } private CreateVirtualMachinesInParallel() { }
|
/**
* Main entry point.
* @param args the parameters
*/
|
Main entry point
|
main
|
{
"repo_name": "pomortaz/azure-sdk-for-java",
"path": "azure-samples/src/main/java/com/microsoft/azure/management/compute/samples/CreateVirtualMachinesInParallel.java",
"license": "mit",
"size": 11900
}
|
[
"com.microsoft.azure.management.Azure",
"com.microsoft.rest.LogLevel",
"java.io.File"
] |
import com.microsoft.azure.management.Azure; import com.microsoft.rest.LogLevel; import java.io.File;
|
import com.microsoft.azure.management.*; import com.microsoft.rest.*; import java.io.*;
|
[
"com.microsoft.azure",
"com.microsoft.rest",
"java.io"
] |
com.microsoft.azure; com.microsoft.rest; java.io;
| 106,959
|
protected void checkOperation(OperationCategory op, boolean supported)
throws RouterSafeModeException, UnsupportedOperationException {
checkOperation(op);
if (!supported) {
if (rpcMonitor != null) {
rpcMonitor.proxyOpNotImplemented();
}
String methodName = getMethodName();
throw new UnsupportedOperationException(
"Operation \"" + methodName + "\" is not supported");
}
}
|
void function(OperationCategory op, boolean supported) throws RouterSafeModeException, UnsupportedOperationException { checkOperation(op); if (!supported) { if (rpcMonitor != null) { rpcMonitor.proxyOpNotImplemented(); } String methodName = getMethodName(); throw new UnsupportedOperationException( STRSTR\STR); } }
|
/**
* Check if the Router is in safe mode. We should only see READ, WRITE, and
* UNCHECKED. It includes a default handler when we haven't implemented an
* operation. If not supported, it always throws an exception reporting the
* operation.
*
* @param op Category of the operation to check.
* @param supported If the operation is supported or not. If not, it will
* throw an UnsupportedOperationException.
* @throws SafeModeException If the Router is in safe mode and cannot serve
* client requests.
* @throws UnsupportedOperationException If the operation is not supported.
*/
|
Check if the Router is in safe mode. We should only see READ, WRITE, and UNCHECKED. It includes a default handler when we haven't implemented an operation. If not supported, it always throws an exception reporting the operation
|
checkOperation
|
{
"repo_name": "dennishuo/hadoop",
"path": "hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RouterRpcServer.java",
"license": "apache-2.0",
"size": 89622
}
|
[
"org.apache.hadoop.hdfs.server.namenode.NameNode"
] |
import org.apache.hadoop.hdfs.server.namenode.NameNode;
|
import org.apache.hadoop.hdfs.server.namenode.*;
|
[
"org.apache.hadoop"
] |
org.apache.hadoop;
| 2,596,868
|
public void setPropertyStringValueCache(SimpleCache<Serializable, Object> propertyStringValueCache)
{
this.propertyStringValueCache = new EntityLookupCache<Long, String, Pair<String, Long>>(
propertyStringValueCache,
CACHE_REGION_PROPERTY_STRING_VALUE,
propertyStringValueCallback);
}
|
void function(SimpleCache<Serializable, Object> propertyStringValueCache) { this.propertyStringValueCache = new EntityLookupCache<Long, String, Pair<String, Long>>( propertyStringValueCache, CACHE_REGION_PROPERTY_STRING_VALUE, propertyStringValueCallback); }
|
/**
* Set the cache to use for <b>alf_prop_string_value</b> lookups (optional).
*
* @param propertyStringValueCache the cache of IDs to property string values
*/
|
Set the cache to use for alf_prop_string_value lookups (optional)
|
setPropertyStringValueCache
|
{
"repo_name": "Alfresco/alfresco-repository",
"path": "src/main/java/org/alfresco/repo/domain/propval/AbstractPropertyValueDAOImpl.java",
"license": "lgpl-3.0",
"size": 62653
}
|
[
"java.io.Serializable",
"org.alfresco.repo.cache.SimpleCache",
"org.alfresco.repo.cache.lookup.EntityLookupCache",
"org.alfresco.util.Pair"
] |
import java.io.Serializable; import org.alfresco.repo.cache.SimpleCache; import org.alfresco.repo.cache.lookup.EntityLookupCache; import org.alfresco.util.Pair;
|
import java.io.*; import org.alfresco.repo.cache.*; import org.alfresco.repo.cache.lookup.*; import org.alfresco.util.*;
|
[
"java.io",
"org.alfresco.repo",
"org.alfresco.util"
] |
java.io; org.alfresco.repo; org.alfresco.util;
| 220,817
|
public boolean hasBinding(AstroBindingConfig bindingConfig);
|
boolean function(AstroBindingConfig bindingConfig);
|
/**
* Returns true, if the specified binding is available.
*/
|
Returns true, if the specified binding is available
|
hasBinding
|
{
"repo_name": "jowiho/openhab",
"path": "bundles/binding/org.openhab.binding.astro/src/main/java/org/openhab/binding/astro/AstroBindingProvider.java",
"license": "epl-1.0",
"size": 1077
}
|
[
"org.openhab.binding.astro.internal.config.AstroBindingConfig"
] |
import org.openhab.binding.astro.internal.config.AstroBindingConfig;
|
import org.openhab.binding.astro.internal.config.*;
|
[
"org.openhab.binding"
] |
org.openhab.binding;
| 477,721
|
// Instantiate a client that will be used to call the service.
TextAnalyticsClient client = new TextAnalyticsClientBuilder()
.credential(new AzureKeyCredential("{key}"))
.endpoint("{endpoint}")
.buildClient();
// The texts that need be analyzed.
List<TextDocumentInput> documents = Arrays.asList(
new TextDocumentInput("1", "My name is Joe and SSN is 859-98-0987").setLanguage("en"),
new TextDocumentInput("2", "Visa card 4111 1111 1111 1111").setLanguage("en")
);
// Show statistics, model version, and PII entities that only related to the given Pii entity categories.
RecognizePiiEntitiesOptions options = new RecognizePiiEntitiesOptions()
.setCategoriesFilter(
PiiEntityCategory.US_SOCIAL_SECURITY_NUMBER,
PiiEntityCategory.CREDIT_CARD_NUMBER)
.setIncludeStatistics(true)
.setModelVersion("latest");
// Recognizing Personally Identifiable Information entities for each document in a batch of documents
Response<RecognizePiiEntitiesResultCollection> piiEntitiesBatchResultResponse =
client.recognizePiiEntitiesBatchWithResponse(documents, options, Context.NONE);
// Response's status code
System.out.printf("Status code of request response: %d%n", piiEntitiesBatchResultResponse.getStatusCode());
RecognizePiiEntitiesResultCollection recognizePiiEntitiesResultCollection = piiEntitiesBatchResultResponse.getValue();
// Model version
System.out.printf("Results of Azure Text Analytics \"Personally Identifiable Information Entities Recognition\" Model, version: %s%n", recognizePiiEntitiesResultCollection.getModelVersion());
// Batch statistics
TextDocumentBatchStatistics batchStatistics = recognizePiiEntitiesResultCollection.getStatistics();
System.out.printf("Documents statistics: document count = %s, erroneous document count = %s, transaction count = %s, valid document count = %s.%n",
batchStatistics.getDocumentCount(), batchStatistics.getInvalidDocumentCount(), batchStatistics.getTransactionCount(), batchStatistics.getValidDocumentCount());
// Recognized Personally Identifiable Information entities for each document in a batch of documents
AtomicInteger counter = new AtomicInteger();
for (RecognizePiiEntitiesResult entitiesResult : recognizePiiEntitiesResultCollection) {
// Recognized entities for each document in a batch of documents
System.out.printf("%n%s%n", documents.get(counter.getAndIncrement()));
if (entitiesResult.isError()) {
// Erroneous document
System.out.printf("Cannot recognize Personally Identifiable Information entities. Error: %s%n", entitiesResult.getError().getMessage());
} else {
// Valid document
PiiEntityCollection piiEntityCollection = entitiesResult.getEntities();
System.out.printf("Redacted Text: %s%n", piiEntityCollection.getRedactedText());
piiEntityCollection.forEach(entity -> System.out.printf(
"Recognized Personally Identifiable Information entity: %s, entity category: %s, entity subcategory: %s, offset: %s, confidence score: %f.%n",
entity.getText(), entity.getCategory(), entity.getSubcategory(), entity.getOffset(), entity.getConfidenceScore()));
}
}
}
|
TextAnalyticsClient client = new TextAnalyticsClientBuilder() .credential(new AzureKeyCredential("{key}")) .endpoint(STR) .buildClient(); List<TextDocumentInput> documents = Arrays.asList( new TextDocumentInput("1", STR).setLanguage("en"), new TextDocumentInput("2", STR).setLanguage("en") ); RecognizePiiEntitiesOptions options = new RecognizePiiEntitiesOptions() .setCategoriesFilter( PiiEntityCategory.US_SOCIAL_SECURITY_NUMBER, PiiEntityCategory.CREDIT_CARD_NUMBER) .setIncludeStatistics(true) .setModelVersion(STR); Response<RecognizePiiEntitiesResultCollection> piiEntitiesBatchResultResponse = client.recognizePiiEntitiesBatchWithResponse(documents, options, Context.NONE); System.out.printf(STR, piiEntitiesBatchResultResponse.getStatusCode()); RecognizePiiEntitiesResultCollection recognizePiiEntitiesResultCollection = piiEntitiesBatchResultResponse.getValue(); System.out.printf(STRPersonally Identifiable Information Entities Recognition\STR, recognizePiiEntitiesResultCollection.getModelVersion()); TextDocumentBatchStatistics batchStatistics = recognizePiiEntitiesResultCollection.getStatistics(); System.out.printf(STR, batchStatistics.getDocumentCount(), batchStatistics.getInvalidDocumentCount(), batchStatistics.getTransactionCount(), batchStatistics.getValidDocumentCount()); AtomicInteger counter = new AtomicInteger(); for (RecognizePiiEntitiesResult entitiesResult : recognizePiiEntitiesResultCollection) { System.out.printf(STR, documents.get(counter.getAndIncrement())); if (entitiesResult.isError()) { System.out.printf(STR, entitiesResult.getError().getMessage()); } else { PiiEntityCollection piiEntityCollection = entitiesResult.getEntities(); System.out.printf(STR, piiEntityCollection.getRedactedText()); piiEntityCollection.forEach(entity -> System.out.printf( STR, entity.getText(), entity.getCategory(), entity.getSubcategory(), entity.getOffset(), entity.getConfidenceScore())); } } }
|
/**
* Main method to invoke this demo about how to recognize the Personally Identifiable Information entities of
* documents.
*
* @param args Unused arguments to the program.
*/
|
Main method to invoke this demo about how to recognize the Personally Identifiable Information entities of documents
|
main
|
{
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/RecognizePiiEntitiesBatchDocuments.java",
"license": "mit",
"size": 5113
}
|
[
"com.azure.ai.textanalytics.TextAnalyticsClient",
"com.azure.ai.textanalytics.TextAnalyticsClientBuilder",
"com.azure.ai.textanalytics.models.PiiEntityCategory",
"com.azure.ai.textanalytics.models.PiiEntityCollection",
"com.azure.ai.textanalytics.models.RecognizePiiEntitiesOptions",
"com.azure.ai.textanalytics.models.RecognizePiiEntitiesResult",
"com.azure.ai.textanalytics.models.TextDocumentBatchStatistics",
"com.azure.ai.textanalytics.models.TextDocumentInput",
"com.azure.ai.textanalytics.util.RecognizePiiEntitiesResultCollection",
"com.azure.core.credential.AzureKeyCredential",
"com.azure.core.http.rest.Response",
"com.azure.core.util.Context",
"java.util.Arrays",
"java.util.List",
"java.util.concurrent.atomic.AtomicInteger"
] |
import com.azure.ai.textanalytics.TextAnalyticsClient; import com.azure.ai.textanalytics.TextAnalyticsClientBuilder; import com.azure.ai.textanalytics.models.PiiEntityCategory; import com.azure.ai.textanalytics.models.PiiEntityCollection; import com.azure.ai.textanalytics.models.RecognizePiiEntitiesOptions; import com.azure.ai.textanalytics.models.RecognizePiiEntitiesResult; import com.azure.ai.textanalytics.models.TextDocumentBatchStatistics; import com.azure.ai.textanalytics.models.TextDocumentInput; import com.azure.ai.textanalytics.util.RecognizePiiEntitiesResultCollection; import com.azure.core.credential.AzureKeyCredential; import com.azure.core.http.rest.Response; import com.azure.core.util.Context; import java.util.Arrays; import java.util.List; import java.util.concurrent.atomic.AtomicInteger;
|
import com.azure.ai.textanalytics.*; import com.azure.ai.textanalytics.models.*; import com.azure.ai.textanalytics.util.*; import com.azure.core.credential.*; import com.azure.core.http.rest.*; import com.azure.core.util.*; import java.util.*; import java.util.concurrent.atomic.*;
|
[
"com.azure.ai",
"com.azure.core",
"java.util"
] |
com.azure.ai; com.azure.core; java.util;
| 2,565,601
|
public String getDigest(MessageDigest md, String message) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DigestOutputStream dos = new DigestOutputStream(baos, md);
PrintWriter pw = new PrintWriter(dos);
pw.print(message);
pw.flush();
byte digest[] = dos.getMessageDigest().digest();
StringBuffer sb = new StringBuffer();
for (int offset = 0; offset < digest.length; offset++) {
byte b = digest[offset];
if ((b & 0xF0) == 0) {
sb.append("0");
}
sb.append(Integer.toHexString(b & 0xFF));
}
return sb.toString();
}
|
String function(MessageDigest md, String message) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); DigestOutputStream dos = new DigestOutputStream(baos, md); PrintWriter pw = new PrintWriter(dos); pw.print(message); pw.flush(); byte digest[] = dos.getMessageDigest().digest(); StringBuffer sb = new StringBuffer(); for (int offset = 0; offset < digest.length; offset++) { byte b = digest[offset]; if ((b & 0xF0) == 0) { sb.append("0"); } sb.append(Integer.toHexString(b & 0xFF)); } return sb.toString(); }
|
/**
* Produce a message digest with a given algorithm instance.
*
* @param md MessageDigest instance to use.
* @param message Message to get message digest for.
* @return A string representation of the message digest.
* @throws NoSuchAlgorithmException if by some miracle the algorithm is not available.
*/
|
Produce a message digest with a given algorithm instance
|
getDigest
|
{
"repo_name": "marcass/dz",
"path": "jukebox-master/jukebox-common/src/main/java/net/sf/jukebox/util/MessageDigestFactory.java",
"license": "gpl-3.0",
"size": 3005
}
|
[
"java.io.ByteArrayOutputStream",
"java.io.PrintWriter",
"java.security.DigestOutputStream",
"java.security.MessageDigest"
] |
import java.io.ByteArrayOutputStream; import java.io.PrintWriter; import java.security.DigestOutputStream; import java.security.MessageDigest;
|
import java.io.*; import java.security.*;
|
[
"java.io",
"java.security"
] |
java.io; java.security;
| 2,438,927
|
@Test
public void test1Byte() throws SQLException {
byte[] data = {(byte) 'a'};
readWrite(data);
}
|
void function() throws SQLException { byte[] data = {(byte) 'a'}; readWrite(data); }
|
/**
* Test the writing and reading of a single byte.
*/
|
Test the writing and reading of a single byte
|
test1Byte
|
{
"repo_name": "panchenko/pgjdbc",
"path": "pgjdbc/src/test/java/org/postgresql/test/jdbc3/Jdbc3BlobTest.java",
"license": "bsd-2-clause",
"size": 7478
}
|
[
"java.sql.SQLException"
] |
import java.sql.SQLException;
|
import java.sql.*;
|
[
"java.sql"
] |
java.sql;
| 2,578,887
|
protected VariableSpace getVariables() {
return variables;
}
|
VariableSpace function() { return variables; }
|
/**
* Gets the variable bindings for the job entry.
*
* @return the variable bindings for the job entry.
*/
|
Gets the variable bindings for the job entry
|
getVariables
|
{
"repo_name": "TatsianaKasiankova/pentaho-kettle",
"path": "engine/src/main/java/org/pentaho/di/job/entry/JobEntryBase.java",
"license": "apache-2.0",
"size": 43772
}
|
[
"org.pentaho.di.core.variables.VariableSpace"
] |
import org.pentaho.di.core.variables.VariableSpace;
|
import org.pentaho.di.core.variables.*;
|
[
"org.pentaho.di"
] |
org.pentaho.di;
| 1,971,281
|
private View buildIndicator(String text) {
final TextView indicator = (TextView) getLayoutInflater().inflate(R.layout.tab_indicator,
getTabWidget(), false);
indicator.setText(text);
return indicator;
}
|
View function(String text) { final TextView indicator = (TextView) getLayoutInflater().inflate(R.layout.tab_indicator, getTabWidget(), false); indicator.setText(text); return indicator; }
|
/**
* Build a {@link View} to be used as a tab indicator, setting the requested
* string resource as its label.
*/
|
Build a <code>View</code> to be used as a tab indicator, setting the requested string resource as its label
|
buildIndicator
|
{
"repo_name": "russenreaktor/gddsched",
"path": "src/com/kupriyanov/android/apps/gddsched/de/ui/ScheduleActivity.java",
"license": "apache-2.0",
"size": 6875
}
|
[
"android.view.View",
"android.widget.TextView"
] |
import android.view.View; import android.widget.TextView;
|
import android.view.*; import android.widget.*;
|
[
"android.view",
"android.widget"
] |
android.view; android.widget;
| 2,567,247
|
public PimRegistryEntry getEntryById(long id)
throws PimListenerException {
try {
PimRegistryEntry entry = dao.getEntryById(id);
return entry;
} catch (DataAccessException ex) {
throw new PimListenerException("Error performing getEntry with id: " + id, ex);
}
}
|
PimRegistryEntry function(long id) throws PimListenerException { try { PimRegistryEntry entry = dao.getEntryById(id); return entry; } catch (DataAccessException ex) { throw new PimListenerException(STR + id, ex); } }
|
/**
* Returns the entry with the given id
* @param id the entry id
* @return the entry with the given id. <code>null</code> if not found
* @throws com.funambol.pimlistener.service.PimListenerException if an error occurs
*/
|
Returns the entry with the given id
|
getEntryById
|
{
"repo_name": "accesstest3/cfunambol",
"path": "modules/foundation/pim-listener/src/main/java/com/funambol/pimlistener/registry/PimRegistryEntryManager.java",
"license": "agpl-3.0",
"size": 9404
}
|
[
"com.funambol.pimlistener.service.PimListenerException",
"com.funambol.pushlistener.service.registry.dao.DataAccessException"
] |
import com.funambol.pimlistener.service.PimListenerException; import com.funambol.pushlistener.service.registry.dao.DataAccessException;
|
import com.funambol.pimlistener.service.*; import com.funambol.pushlistener.service.registry.dao.*;
|
[
"com.funambol.pimlistener",
"com.funambol.pushlistener"
] |
com.funambol.pimlistener; com.funambol.pushlistener;
| 1,683,164
|
public void handleContentOutlineSelection(ISelection selection) {
if (currentViewerPane != null && !selection.isEmpty() && selection instanceof IStructuredSelection) {
Iterator<?> selectedElements = ((IStructuredSelection)selection).iterator();
if (selectedElements.hasNext()) {
// Get the first selected element.
//
Object selectedElement = selectedElements.next();
// If it's the selection viewer, then we want it to select the same selection as this selection.
//
if (currentViewerPane.getViewer() == selectionViewer) {
ArrayList<Object> selectionList = new ArrayList<Object>();
selectionList.add(selectedElement);
while (selectedElements.hasNext()) {
selectionList.add(selectedElements.next());
}
// Set the selection to the widget.
//
selectionViewer.setSelection(new StructuredSelection(selectionList));
}
else {
// Set the input to the widget.
//
if (currentViewerPane.getViewer().getInput() != selectedElement) {
currentViewerPane.getViewer().setInput(selectedElement);
currentViewerPane.setTitle(selectedElement);
}
}
}
}
}
|
void function(ISelection selection) { if (currentViewerPane != null && !selection.isEmpty() && selection instanceof IStructuredSelection) { Iterator<?> selectedElements = ((IStructuredSelection)selection).iterator(); if (selectedElements.hasNext()) { ArrayList<Object> selectionList = new ArrayList<Object>(); selectionList.add(selectedElement); while (selectedElements.hasNext()) { selectionList.add(selectedElements.next()); } } else { currentViewerPane.getViewer().setInput(selectedElement); currentViewerPane.setTitle(selectedElement); } } } } }
|
/**
* This deals with how we want selection in the outliner to affect the other views.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
|
This deals with how we want selection in the outliner to affect the other views.
|
handleContentOutlineSelection
|
{
"repo_name": "mlanoe/x-vhdl",
"path": "plugins/net.mlanoe.language.vhdl.editor/src-gen/net/mlanoe/language/vhdl/presentation/VhdlEditor.java",
"license": "gpl-3.0",
"size": 55190
}
|
[
"java.util.ArrayList",
"java.util.Iterator",
"org.eclipse.jface.viewers.ISelection",
"org.eclipse.jface.viewers.IStructuredSelection"
] |
import java.util.ArrayList; import java.util.Iterator; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection;
|
import java.util.*; import org.eclipse.jface.viewers.*;
|
[
"java.util",
"org.eclipse.jface"
] |
java.util; org.eclipse.jface;
| 1,492,755
|
public synchronized PrimaryContext startRelocationHandoff() {
assert invariant();
assert primaryMode;
assert handoffInProgress == false;
assert pendingInSync.isEmpty() : "relocation handoff started while there are still shard copies pending in-sync: " + pendingInSync;
handoffInProgress = true;
// copy clusterStateVersion and checkpoints and return
// all the entries from checkpoints that are inSync: the reason we don't need to care about initializing non-insync entries
// is that they will have to undergo a recovery attempt on the relocation target, and will hence be supplied by the cluster state
// update on the relocation target once relocation completes). We could alternatively also copy the map as-is (it’s safe), and it
// would be cleaned up on the target by cluster state updates.
Map<String, CheckpointState> localCheckpointsCopy = new HashMap<>();
for (Map.Entry<String, CheckpointState> entry : checkpoints.entrySet()) {
localCheckpointsCopy.put(entry.getKey(), entry.getValue().copy());
}
assert invariant();
return new PrimaryContext(appliedClusterStateVersion, localCheckpointsCopy, routingTable);
}
|
synchronized PrimaryContext function() { assert invariant(); assert primaryMode; assert handoffInProgress == false; assert pendingInSync.isEmpty() : STR + pendingInSync; handoffInProgress = true; Map<String, CheckpointState> localCheckpointsCopy = new HashMap<>(); for (Map.Entry<String, CheckpointState> entry : checkpoints.entrySet()) { localCheckpointsCopy.put(entry.getKey(), entry.getValue().copy()); } assert invariant(); return new PrimaryContext(appliedClusterStateVersion, localCheckpointsCopy, routingTable); }
|
/**
* Initiates a relocation handoff and returns the corresponding primary context.
*/
|
Initiates a relocation handoff and returns the corresponding primary context
|
startRelocationHandoff
|
{
"repo_name": "rajanm/elasticsearch",
"path": "server/src/main/java/org/elasticsearch/index/seqno/ReplicationTracker.java",
"license": "apache-2.0",
"size": 46777
}
|
[
"java.util.HashMap",
"java.util.Map"
] |
import java.util.HashMap; import java.util.Map;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 2,213,806
|
public void insert(NodeDescriptor parent, int index, List<Node> children) {
int initialCount = parent.getChildren().size();
parent.addChildren(index, wrap(children));
if (initialCount != parent.getChildren().size()) {
List<Node> addedChildren = new ArrayList<>();
List<NodeDescriptor> currentChildren = parent.getChildren();
if (isSorted()) {
int currentChildrenSize = currentChildren.size();
for (int i = 0; i < currentChildrenSize; i++) {
int childrenSize = children.size();
for (int j = 0; j < childrenSize; j++) {
Node currentData = currentChildren.get(i).getNode();
Node child = children.get(j);
if (child == currentData) {
addedChildren.add(child);
break;
}
}
}
} else {
int i = index;
int childrenSize = children.size();
for (int j = 0; j < childrenSize; j++) {
if (currentChildren.get(i) == children.get(j)) {
addedChildren.add(children.get(j));
i++;
}
}
}
if (addedChildren.size() != 0) {
fireEvent(new StoreAddEvent(index, addedChildren));
}
}
}
|
void function(NodeDescriptor parent, int index, List<Node> children) { int initialCount = parent.getChildren().size(); parent.addChildren(index, wrap(children)); if (initialCount != parent.getChildren().size()) { List<Node> addedChildren = new ArrayList<>(); List<NodeDescriptor> currentChildren = parent.getChildren(); if (isSorted()) { int currentChildrenSize = currentChildren.size(); for (int i = 0; i < currentChildrenSize; i++) { int childrenSize = children.size(); for (int j = 0; j < childrenSize; j++) { Node currentData = currentChildren.get(i).getNode(); Node child = children.get(j); if (child == currentData) { addedChildren.add(child); break; } } } } else { int i = index; int childrenSize = children.size(); for (int j = 0; j < childrenSize; j++) { if (currentChildren.get(i) == children.get(j)) { addedChildren.add(children.get(j)); i++; } } } if (addedChildren.size() != 0) { fireEvent(new StoreAddEvent(index, addedChildren)); } } }
|
/**
* Inserts the child models at the given position in the parent's list of
* visible children.
*
* @param parent
* @param index
* @param children
*/
|
Inserts the child models at the given position in the parent's list of visible children
|
insert
|
{
"repo_name": "codenvy/che-core",
"path": "ide/che-core-ide-ui/src/main/java/org/eclipse/che/ide/ui/smartTree/TreeNodeStorage.java",
"license": "epl-1.0",
"size": 25153
}
|
[
"java.util.ArrayList",
"java.util.List",
"org.eclipse.che.ide.api.project.node.Node",
"org.eclipse.che.ide.ui.smartTree.event.StoreAddEvent"
] |
import java.util.ArrayList; import java.util.List; import org.eclipse.che.ide.api.project.node.Node; import org.eclipse.che.ide.ui.smartTree.event.StoreAddEvent;
|
import java.util.*; import org.eclipse.che.ide.api.project.node.*; import org.eclipse.che.ide.ui.*;
|
[
"java.util",
"org.eclipse.che"
] |
java.util; org.eclipse.che;
| 296,982
|
public static IdResolver getIdResolverByOrganism(Set<String> taxonIds) {
// HACK - for worm in ncbi
IdResolverService.getWormIdResolver();
Set<String> validTaxonIds = new HashSet<String>(taxonIds);
validTaxonIds.remove("6239");
return new EntrezGeneIdResolverFactory().getIdResolver(validTaxonIds);
}
|
static IdResolver function(Set<String> taxonIds) { IdResolverService.getWormIdResolver(); Set<String> validTaxonIds = new HashSet<String>(taxonIds); validTaxonIds.remove("6239"); return new EntrezGeneIdResolverFactory().getIdResolver(validTaxonIds); }
|
/**
* Create a Entrez Gene Id Resolver by given taxonId set
* @param taxonIds set of taxon ids
* @return an IdResolver
*/
|
Create a Entrez Gene Id Resolver by given taxonId set
|
getIdResolverByOrganism
|
{
"repo_name": "JoeCarlson/intermine",
"path": "bio/core/main/src/org/intermine/bio/dataconversion/IdResolverService.java",
"license": "lgpl-2.1",
"size": 10671
}
|
[
"java.util.HashSet",
"java.util.Set"
] |
import java.util.HashSet; import java.util.Set;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 2,644,825
|
public static KeyProviderCryptoExtension createKeyProviderCryptoExtension(
final Configuration conf) throws IOException {
KeyProvider keyProvider = HdfsKMSUtil.createKeyProvider(conf);
if (keyProvider == null) {
return null;
}
KeyProviderCryptoExtension cryptoProvider = KeyProviderCryptoExtension
.createKeyProviderCryptoExtension(keyProvider);
return cryptoProvider;
}
|
static KeyProviderCryptoExtension function( final Configuration conf) throws IOException { KeyProvider keyProvider = HdfsKMSUtil.createKeyProvider(conf); if (keyProvider == null) { return null; } KeyProviderCryptoExtension cryptoProvider = KeyProviderCryptoExtension .createKeyProviderCryptoExtension(keyProvider); return cryptoProvider; }
|
/**
* Creates a new KeyProviderCryptoExtension by wrapping the
* KeyProvider specified in the given Configuration.
*
* @param conf Configuration
* @return new KeyProviderCryptoExtension, or null if no provider was found.
* @throws IOException if the KeyProvider is improperly specified in
* the Configuration
*/
|
Creates a new KeyProviderCryptoExtension by wrapping the KeyProvider specified in the given Configuration
|
createKeyProviderCryptoExtension
|
{
"repo_name": "plusplusjiajia/hadoop",
"path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSUtil.java",
"license": "apache-2.0",
"size": 69159
}
|
[
"java.io.IOException",
"org.apache.hadoop.conf.Configuration",
"org.apache.hadoop.crypto.key.KeyProvider",
"org.apache.hadoop.crypto.key.KeyProviderCryptoExtension"
] |
import java.io.IOException; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.crypto.key.KeyProvider; import org.apache.hadoop.crypto.key.KeyProviderCryptoExtension;
|
import java.io.*; import org.apache.hadoop.conf.*; import org.apache.hadoop.crypto.key.*;
|
[
"java.io",
"org.apache.hadoop"
] |
java.io; org.apache.hadoop;
| 2,820,634
|
@Test
public void testGetSteps_1()
throws Exception {
ScriptContainer fixture = new ScriptContainer();
fixture.setRuntime(1);
fixture.setComments("");
fixture.setCreator("");
fixture.setProductName("");
fixture.setName("");
fixture.setId(new Integer(1));
fixture.setSteps(new LinkedList());
fixture.setCreated(new Date());
fixture.setModified(new Date());
List<ScriptStep> result = fixture.getSteps();
assertNotNull(result);
assertEquals(0, result.size());
}
|
void function() throws Exception { ScriptContainer fixture = new ScriptContainer(); fixture.setRuntime(1); fixture.setComments(STRSTRSTR"); fixture.setId(new Integer(1)); fixture.setSteps(new LinkedList()); fixture.setCreated(new Date()); fixture.setModified(new Date()); List<ScriptStep> result = fixture.getSteps(); assertNotNull(result); assertEquals(0, result.size()); }
|
/**
* Run the List<ScriptStep> getSteps() method test.
*
* @throws Exception
*
* @generatedBy CodePro at 12/15/14 1:34 PM
*/
|
Run the List getSteps() method test
|
testGetSteps_1
|
{
"repo_name": "intuit/Tank",
"path": "data_model/src/test/java/com/intuit/tank/project/ScriptContainerTest.java",
"license": "epl-1.0",
"size": 17554
}
|
[
"com.intuit.tank.project.ScriptContainer",
"com.intuit.tank.project.ScriptStep",
"java.util.Date",
"java.util.LinkedList",
"java.util.List",
"org.junit.jupiter.api.Assertions"
] |
import com.intuit.tank.project.ScriptContainer; import com.intuit.tank.project.ScriptStep; import java.util.Date; import java.util.LinkedList; import java.util.List; import org.junit.jupiter.api.Assertions;
|
import com.intuit.tank.project.*; import java.util.*; import org.junit.jupiter.api.*;
|
[
"com.intuit.tank",
"java.util",
"org.junit.jupiter"
] |
com.intuit.tank; java.util; org.junit.jupiter;
| 254,618
|
public FancyMessage text(final String text) {
final MessagePart latest = latest();
latest.text = rawText(text);
dirty = true;
return this;
}
|
FancyMessage function(final String text) { final MessagePart latest = latest(); latest.text = rawText(text); dirty = true; return this; }
|
/**
* Sets the text of the current editing component to a value.
* @param text The new text of the current editing component.
* @return This builder instance.
*/
|
Sets the text of the current editing component to a value
|
text
|
{
"repo_name": "SilverCory/PlotSquared",
"path": "Bukkit/src/main/java/com/plotsquared/bukkit/chat/FancyMessage.java",
"license": "gpl-3.0",
"size": 41847
}
|
[
"com.plotsquared.bukkit.chat.TextualComponent"
] |
import com.plotsquared.bukkit.chat.TextualComponent;
|
import com.plotsquared.bukkit.chat.*;
|
[
"com.plotsquared.bukkit"
] |
com.plotsquared.bukkit;
| 958,113
|
public static Metric<ILSingleDimensional> createDiscernabilityMetric(boolean monotonic, double numTuples) {
if (monotonic) {
MetricSDDiscernability result = new MetricSDDiscernability();
result.setNumTuples(numTuples);
return result;
} else {
MetricSDNMDiscernability result = new MetricSDNMDiscernability();
result.setNumTuples(numTuples);
return result;
}
}
|
static Metric<ILSingleDimensional> function(boolean monotonic, double numTuples) { if (monotonic) { MetricSDDiscernability result = new MetricSDDiscernability(); result.setNumTuples(numTuples); return result; } else { MetricSDNMDiscernability result = new MetricSDNMDiscernability(); result.setNumTuples(numTuples); return result; } }
|
/**
* Creates an instance of the discernability metric. The monotonic variant is DM*.
*
* @param monotonic If set to true, the monotonic variant (DM*) will be created
* @param numTuples Pre-initialization
* @return
*/
|
Creates an instance of the discernability metric. The monotonic variant is DM*
|
createDiscernabilityMetric
|
{
"repo_name": "RaffaelBild/arx",
"path": "src/main/org/deidentifier/arx/metric/v2/__MetricV2.java",
"license": "apache-2.0",
"size": 36238
}
|
[
"org.deidentifier.arx.metric.Metric"
] |
import org.deidentifier.arx.metric.Metric;
|
import org.deidentifier.arx.metric.*;
|
[
"org.deidentifier.arx"
] |
org.deidentifier.arx;
| 938,600
|
public String getShortBranch(Repository repository) throws IOException {
Ref head = repository.getRef(Constants.HEAD);
if (head == null || head.getObjectId() == null)
return CoreText.RepositoryUtil_noHead;
if (head.isSymbolic())
return repository.getBranch();
String id = head.getObjectId().name();
String ref = mapCommitToRef(repository, id, false);
if (ref != null)
return Repository.shortenRefName(ref) + ' ' + id.substring(0, 7);
else
return id.substring(0, 7);
}
|
String function(Repository repository) throws IOException { Ref head = repository.getRef(Constants.HEAD); if (head == null head.getObjectId() == null) return CoreText.RepositoryUtil_noHead; if (head.isSymbolic()) return repository.getBranch(); String id = head.getObjectId().name(); String ref = mapCommitToRef(repository, id, false); if (ref != null) return Repository.shortenRefName(ref) + ' ' + id.substring(0, 7); else return id.substring(0, 7); }
|
/**
* Get short branch text for given repository
*
* @param repository
* @return short branch text
* @throws IOException
*/
|
Get short branch text for given repository
|
getShortBranch
|
{
"repo_name": "wdliu/egit",
"path": "org.eclipse.egit.core/src/org/eclipse/egit/core/RepositoryUtil.java",
"license": "epl-1.0",
"size": 17901
}
|
[
"java.io.IOException",
"org.eclipse.egit.core.internal.CoreText",
"org.eclipse.jgit.lib.Constants",
"org.eclipse.jgit.lib.Ref",
"org.eclipse.jgit.lib.Repository"
] |
import java.io.IOException; import org.eclipse.egit.core.internal.CoreText; import org.eclipse.jgit.lib.Constants; import org.eclipse.jgit.lib.Ref; import org.eclipse.jgit.lib.Repository;
|
import java.io.*; import org.eclipse.egit.core.internal.*; import org.eclipse.jgit.lib.*;
|
[
"java.io",
"org.eclipse.egit",
"org.eclipse.jgit"
] |
java.io; org.eclipse.egit; org.eclipse.jgit;
| 708,725
|
@Override
public CountingResult sortIntegerArrayCounting(int[] arrayToSort) {
InsertionSort.comps = 0;
InsertionSort.swaps = 0;
InsertionSort.insertionSortIntCounting(arrayToSort);
return new CountingResult(InsertionSort.comps, InsertionSort.swaps);
}
|
CountingResult function(int[] arrayToSort) { InsertionSort.comps = 0; InsertionSort.swaps = 0; InsertionSort.insertionSortIntCounting(arrayToSort); return new CountingResult(InsertionSort.comps, InsertionSort.swaps); }
|
/**
* Sort the specified integer array and count the number of
* comparisons/swaps
*
* @param arrayToSort
* The array to sort
* @return The counting result
*/
|
Sort the specified integer array and count the number of comparisons/swaps
|
sortIntegerArrayCounting
|
{
"repo_name": "markuskorbel/adt.assignment.reference",
"path": "src/ie/lyit/adt/assignment/algorithms/InsertionSortRunner.java",
"license": "gpl-2.0",
"size": 1115
}
|
[
"ie.lyit.adt.assignment.algorithms.implementations.InsertionSort"
] |
import ie.lyit.adt.assignment.algorithms.implementations.InsertionSort;
|
import ie.lyit.adt.assignment.algorithms.implementations.*;
|
[
"ie.lyit.adt"
] |
ie.lyit.adt;
| 53,160
|
void license(Action<? super MavenPomLicense> action);
|
void license(Action<? super MavenPomLicense> action);
|
/**
* Creates, configures and adds a license to the publication.
*/
|
Creates, configures and adds a license to the publication
|
license
|
{
"repo_name": "lsmaira/gradle",
"path": "subprojects/maven/src/main/java/org/gradle/api/publish/maven/MavenPomLicenseSpec.java",
"license": "apache-2.0",
"size": 1032
}
|
[
"org.gradle.api.Action"
] |
import org.gradle.api.Action;
|
import org.gradle.api.*;
|
[
"org.gradle.api"
] |
org.gradle.api;
| 2,123,253
|
public static DateIterable createDateIterable(
String rdata, Date start, TimeZone tzid, boolean strict)
throws ParseException {
return new RecurrenceIterableWrapper(
RecurrenceIteratorFactory.createRecurrenceIterable(
rdata, dateToDateValue(start, true),
tzid, strict));
}
|
static DateIterable function( String rdata, Date start, TimeZone tzid, boolean strict) throws ParseException { return new RecurrenceIterableWrapper( RecurrenceIteratorFactory.createRecurrenceIterable( rdata, dateToDateValue(start, true), tzid, strict)); }
|
/**
* given a block of RRULE, EXRULE, RDATE, and EXDATE content lines, parse
* them into a single date iterable.
* @param rdata RRULE, EXRULE, RDATE, and EXDATE lines.
* @param start the first occurrence of the series.
* @param tzid the local timezone -- used to interpret start and any dates in
* RDATE and EXDATE lines that don't have TZID params.
* @param strict true if any failure to parse should result in a
* ParseException. false causes bad content lines to be logged and ignored.
*/
|
given a block of RRULE, EXRULE, RDATE, and EXDATE content lines, parse them into a single date iterable
|
createDateIterable
|
{
"repo_name": "imario42/CalendarFX",
"path": "CalendarFXRecurrence/src/main/java/com/google/ical/compat/javautil/DateIteratorFactory.java",
"license": "apache-2.0",
"size": 6471
}
|
[
"com.google.ical.iter.RecurrenceIteratorFactory",
"java.text.ParseException",
"java.util.Date",
"java.util.TimeZone"
] |
import com.google.ical.iter.RecurrenceIteratorFactory; import java.text.ParseException; import java.util.Date; import java.util.TimeZone;
|
import com.google.ical.iter.*; import java.text.*; import java.util.*;
|
[
"com.google.ical",
"java.text",
"java.util"
] |
com.google.ical; java.text; java.util;
| 858,114
|
public static TableDataListOption startIndex(long index) {
checkArgument(index >= 0);
return new TableDataListOption(BigQueryRpc.Option.START_INDEX, index);
}
}
class JobListOption extends Option {
private static final long serialVersionUID = -8207122131226481423L;
private JobListOption(BigQueryRpc.Option option, Object value) {
super(option, value);
}
|
static TableDataListOption function(long index) { checkArgument(index >= 0); return new TableDataListOption(BigQueryRpc.Option.START_INDEX, index); } } class JobListOption extends Option { private static final long serialVersionUID = -8207122131226481423L; private JobListOption(BigQueryRpc.Option option, Object value) { super(option, value); }
|
/**
* Returns an option that sets the zero-based index of the row from which to start listing table
* data.
*/
|
Returns an option that sets the zero-based index of the row from which to start listing table data
|
startIndex
|
{
"repo_name": "rborer/google-cloud-java",
"path": "google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/BigQuery.java",
"license": "apache-2.0",
"size": 35938
}
|
[
"com.google.cloud.bigquery.spi.v2.BigQueryRpc",
"com.google.common.base.Preconditions"
] |
import com.google.cloud.bigquery.spi.v2.BigQueryRpc; import com.google.common.base.Preconditions;
|
import com.google.cloud.bigquery.spi.v2.*; import com.google.common.base.*;
|
[
"com.google.cloud",
"com.google.common"
] |
com.google.cloud; com.google.common;
| 891,158
|
public static InetAddress ioctlInetAddress(FileDescriptor fd, int cmd, String interfaceName) throws ErrnoException { return Libcore.os.ioctlInetAddress(fd, cmd, interfaceName); }
|
public static InetAddress ioctlInetAddress(FileDescriptor fd, int cmd, String interfaceName) throws ErrnoException { return Libcore.os.ioctlInetAddress(fd, cmd, interfaceName); }
|
/**
* See <a href="http://man7.org/linux/man-pages/man3/inet_pton.3.html">inet_pton(3)</a>.
*/
|
See inet_pton(3)
|
inet_pton
|
{
"repo_name": "google/desugar_jdk_libs",
"path": "jdk11/src/libcore/luni/src/main/java/android/system/Os.java",
"license": "gpl-2.0",
"size": 48512
}
|
[
"java.io.FileDescriptor",
"java.net.InetAddress"
] |
import java.io.FileDescriptor; import java.net.InetAddress;
|
import java.io.*; import java.net.*;
|
[
"java.io",
"java.net"
] |
java.io; java.net;
| 1,131,247
|
@Override
public void setPropertyFont(String key, Font font) {
String value = null;
if (font != null) {
value = FontConverter.INSTANCE.format(font);
}
set(key, value);
}
|
void function(String key, Font font) { String value = null; if (font != null) { value = FontConverter.INSTANCE.format(font); } set(key, value); }
|
/**
* Sets a font of type <code>Font</code>. The method actually puts three keys in this property set in order to store
* the font's properties:
* <ul>
* <li><code><key>.name</code> for the font's name</li>
* <li><code><key>.style</code> for the font's style (an integer font)</li>
* <li><code><key>.name</code> for the font's size in points (an integer font)</li>
* </ul>
*
* @param key the key
* @param font the font
* @throws IllegalArgumentException
*/
|
Sets a font of type <code>Font</code>. The method actually puts three keys in this property set in order to store the font's properties: <code><key>.name</code> for the font's name <code><key>.style</code> for the font's style (an integer font) <code><key>.name</code> for the font's size in points (an integer font)
|
setPropertyFont
|
{
"repo_name": "arraydev/snap-engine",
"path": "snap-core/src/main/java/org/esa/snap/util/AbstractPropertyMap.java",
"license": "gpl-3.0",
"size": 9088
}
|
[
"com.bc.ceres.binding.converters.FontConverter",
"java.awt.Font"
] |
import com.bc.ceres.binding.converters.FontConverter; import java.awt.Font;
|
import com.bc.ceres.binding.converters.*; import java.awt.*;
|
[
"com.bc.ceres",
"java.awt"
] |
com.bc.ceres; java.awt;
| 1,347,547
|
public final GraphObjectList<GraphObject> getGraphObjectList() {
return graphObjectList;
}
|
final GraphObjectList<GraphObject> function() { return graphObjectList; }
|
/**
* The list of graph objects returned for this request, if any.
*
* @return the list of graph objects returned, or null if none was returned (or if the result was not a list)
*/
|
The list of graph objects returned for this request, if any
|
getGraphObjectList
|
{
"repo_name": "dmeyer3691/PetTinder",
"path": "workspace/FacebookSDK/src/com/facebook/Response.java",
"license": "gpl-2.0",
"size": 20092
}
|
[
"com.facebook.model.GraphObject",
"com.facebook.model.GraphObjectList"
] |
import com.facebook.model.GraphObject; import com.facebook.model.GraphObjectList;
|
import com.facebook.model.*;
|
[
"com.facebook.model"
] |
com.facebook.model;
| 1,201,639
|
private void drawRoundedRect(int rx1, int ry1, int w, int h, int curvex,
int curvey, int c, boolean fill)
{
if (fill)
{
RoundRectangle2D rr = new RoundRectangle2D.Double(rx1, ry1, w, h,
curvex, curvey);
for (int x = rx1; x <= rx1 + w; x++)
for (int y = ry1; y <= ry1 + h; y++)
if (rr.contains(x, y))
drawPoint(x, y, c);
}
else
{
// TODO draw a real unfilled rounded rectangle
this.drawRect(rx1, ry1, w, h, c, fill);
}
}
|
void function(int rx1, int ry1, int w, int h, int curvex, int curvey, int c, boolean fill) { if (fill) { RoundRectangle2D rr = new RoundRectangle2D.Double(rx1, ry1, w, h, curvex, curvey); for (int x = rx1; x <= rx1 + w; x++) for (int y = ry1; y <= ry1 + h; y++) if (rr.contains(x, y)) drawPoint(x, y, c); } else { this.drawRect(rx1, ry1, w, h, c, fill); } }
|
/**
* Draws a rounded rectangle ( <strong>Warning: doesn't work right unfilled
* </strong>). Unfilled draws a regular rectangle instead, ways to do it
* better are welcome.
*
* @param rx1 X-Coordinate of top-left corner of the rectangle containing
* this.
* @param ry1 Y-Coordinate of top-left corner of the rectangle containing
* this.
* @param w Width
* @param h Height
* @param curvex the width of the arc to use to round off the corners
* @param curvey the height of the arc to use to round off the corners
* @param c Color
* @param fill If true, shape is filled in.
*/
|
Draws a rounded rectangle ( Warning: doesn't work right unfilled ). Unfilled draws a regular rectangle instead, ways to do it better are welcome
|
drawRoundedRect
|
{
"repo_name": "dperelman/jhack",
"path": "src/net/starmen/pkhack/IntArrDrawingArea.java",
"license": "gpl-3.0",
"size": 33395
}
|
[
"java.awt.geom.RoundRectangle2D"
] |
import java.awt.geom.RoundRectangle2D;
|
import java.awt.geom.*;
|
[
"java.awt"
] |
java.awt;
| 2,345,111
|
@Test
public void rotate() {
Vector2 v = new Vector2(2.0, 1.0);
v.rotate(Math.toRadians(90));
TestCase.assertEquals(-1.000, v.x, 1.0e-3);
TestCase.assertEquals( 2.000, v.y, 1.0e-3);
v.rotate(Math.toRadians(60), 0.0, 1.0);
TestCase.assertEquals(-1.366, v.x, 1.0e-3);
TestCase.assertEquals( 0.634, v.y, 1.0e-3);
}
|
void function() { Vector2 v = new Vector2(2.0, 1.0); v.rotate(Math.toRadians(90)); TestCase.assertEquals(-1.000, v.x, 1.0e-3); TestCase.assertEquals( 2.000, v.y, 1.0e-3); v.rotate(Math.toRadians(60), 0.0, 1.0); TestCase.assertEquals(-1.366, v.x, 1.0e-3); TestCase.assertEquals( 0.634, v.y, 1.0e-3); }
|
/**
* Tests the rotate methods.
*/
|
Tests the rotate methods
|
rotate
|
{
"repo_name": "satishbabusee/dyn4j",
"path": "junit/org/dyn4j/geometry/Vector2Test.java",
"license": "bsd-3-clause",
"size": 13186
}
|
[
"junit.framework.TestCase",
"org.dyn4j.geometry.Vector2"
] |
import junit.framework.TestCase; import org.dyn4j.geometry.Vector2;
|
import junit.framework.*; import org.dyn4j.geometry.*;
|
[
"junit.framework",
"org.dyn4j.geometry"
] |
junit.framework; org.dyn4j.geometry;
| 1,619,588
|
public List<CategoryLevel> fetchByCodeColumn(String... values) {
return fetch(CategoryLevelTable.CATEGORY_LEVEL.CODE_COLUMN, values);
}
|
List<CategoryLevel> function(String... values) { return fetch(CategoryLevelTable.CATEGORY_LEVEL.CODE_COLUMN, values); }
|
/**
* Fetch records that have <code>code_column IN (values)</code>
*/
|
Fetch records that have <code>code_column IN (values)</code>
|
fetchByCodeColumn
|
{
"repo_name": "openforis/calc",
"path": "calc-core/src/generated/java/org/openforis/calc/persistence/jooq/tables/daos/CategoryLevelDao.java",
"license": "mit",
"size": 3518
}
|
[
"java.util.List",
"org.openforis.calc.metadata.CategoryLevel",
"org.openforis.calc.persistence.jooq.tables.CategoryLevelTable"
] |
import java.util.List; import org.openforis.calc.metadata.CategoryLevel; import org.openforis.calc.persistence.jooq.tables.CategoryLevelTable;
|
import java.util.*; import org.openforis.calc.metadata.*; import org.openforis.calc.persistence.jooq.tables.*;
|
[
"java.util",
"org.openforis.calc"
] |
java.util; org.openforis.calc;
| 1,735,931
|
default AdvancedAhcEndpointBuilder clientConfigOptions(Map values) {
doSetMultiValueProperties("clientConfigOptions", "clientConfig.", values);
return this;
}
|
default AdvancedAhcEndpointBuilder clientConfigOptions(Map values) { doSetMultiValueProperties(STR, STR, values); return this; }
|
/**
* To configure the AsyncHttpClientConfig using the key/values from the
* Map.
*
* The option is a: <code>java.util.Map<java.lang.String,
* java.lang.Object></code> type.
* The option is multivalued, and you can use the
* clientConfigOptions(String, Object) method to add a value (call the
* method multiple times to set more values).
*
* Group: advanced
*/
|
To configure the AsyncHttpClientConfig using the key/values from the Map. The option is a: <code>java.util.Map<java.lang.String, java.lang.Object></code> type. The option is multivalued, and you can use the clientConfigOptions(String, Object) method to add a value (call the method multiple times to set more values). Group: advanced
|
clientConfigOptions
|
{
"repo_name": "nicolaferraro/camel",
"path": "core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/AhcEndpointBuilderFactory.java",
"license": "apache-2.0",
"size": 21272
}
|
[
"java.util.Map"
] |
import java.util.Map;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 35,714
|
public Altitude cruiseAltitude() {
if (this.flightLevelRecords != null) {
Altitude alt = null;
double fuel;
int tas;
double tempEfficiency;
double efficiency = 0.0;
for (FlightLevelRecord flr : this.flightLevelRecords) {
fuel = flr.cruiseFuelUsage[Range.NOMINAL.ordinal()];
tas = flr.trueAirSpeed[FlightStage.CRUISE.ordinal()];
if (!Double.isNaN(fuel) && tas != Integer.MIN_VALUE) {
tempEfficiency = tas / (60 * fuel);
if (tempEfficiency > efficiency) {
efficiency = tempEfficiency;
alt = flr.altitude;
}
}
}
return alt;
}
return null;
}
/**
* Returns the maximum cruise altitude achievable based on the highest
* flight level with a non-zero rate of climb/descent for the given
* {@link Range}.<br>
* NOTE:<br>
* - Not necessarily equal to the "Max Alt." listed in the BADA file header.<br>
* - Not to be confused with {@link #maxAltitude()}
|
Altitude function() { if (this.flightLevelRecords != null) { Altitude alt = null; double fuel; int tas; double tempEfficiency; double efficiency = 0.0; for (FlightLevelRecord flr : this.flightLevelRecords) { fuel = flr.cruiseFuelUsage[Range.NOMINAL.ordinal()]; tas = flr.trueAirSpeed[FlightStage.CRUISE.ordinal()]; if (!Double.isNaN(fuel) && tas != Integer.MIN_VALUE) { tempEfficiency = tas / (60 * fuel); if (tempEfficiency > efficiency) { efficiency = tempEfficiency; alt = flr.altitude; } } } return alt; } return null; } /** * Returns the maximum cruise altitude achievable based on the highest * flight level with a non-zero rate of climb/descent for the given * {@link Range}.<br> * NOTE:<br> * - Not necessarily equal to the STR listed in the BADA file header.<br> * - Not to be confused with {@link #maxAltitude()}
|
/**
* Returns the altitude at which nominal cruise fuel efficiency (kg/nm) is
* optimal.<br>
*
* @return
*/
|
Returns the altitude at which nominal cruise fuel efficiency (kg/nm) is optimal
|
cruiseAltitude
|
{
"repo_name": "csmith932/uas-schedule-generator",
"path": "swac-common/src/main/java/gov/faa/ang/swac/common/flightmodeling/fileio/BadaRecord.java",
"license": "apache-2.0",
"size": 38309
}
|
[
"gov.faa.ang.swac.common.datatypes.Altitude"
] |
import gov.faa.ang.swac.common.datatypes.Altitude;
|
import gov.faa.ang.swac.common.datatypes.*;
|
[
"gov.faa.ang"
] |
gov.faa.ang;
| 2,233,581
|
@Override
public void fromStream(ObjectInput in) throws CacheLoaderException {
try {
int count = 0;
while (true) {
count++;
InternalCacheEntry entry = (InternalCacheEntry) getMarshaller().objectFromObjectStream(
in);
if (entry == null)
break;
store(entry);
}
} catch (IOException e) {
throw new CacheLoaderException(e);
} catch (ClassNotFoundException e) {
throw new CacheLoaderException(e);
} catch (InterruptedException ie) {
if (log.isTraceEnabled())
log.trace("Interrupted while reading from stream");
Thread.currentThread().interrupt();
}
}
|
void function(ObjectInput in) throws CacheLoaderException { try { int count = 0; while (true) { count++; InternalCacheEntry entry = (InternalCacheEntry) getMarshaller().objectFromObjectStream( in); if (entry == null) break; store(entry); } } catch (IOException e) { throw new CacheLoaderException(e); } catch (ClassNotFoundException e) { throw new CacheLoaderException(e); } catch (InterruptedException ie) { if (log.isTraceEnabled()) log.trace(STR); Thread.currentThread().interrupt(); } }
|
/**
* Reads from a stream the number of entries (long) then the entries themselves.
*/
|
Reads from a stream the number of entries (long) then the entries themselves
|
fromStream
|
{
"repo_name": "oscerd/infinispan-cachestore-cassandra",
"path": "src/main/java/org/infinispan/loaders/cassandra/CassandraCacheStore.java",
"license": "apache-2.0",
"size": 24410
}
|
[
"java.io.IOException",
"java.io.ObjectInput",
"org.infinispan.container.entries.InternalCacheEntry",
"org.infinispan.loaders.CacheLoaderException"
] |
import java.io.IOException; import java.io.ObjectInput; import org.infinispan.container.entries.InternalCacheEntry; import org.infinispan.loaders.CacheLoaderException;
|
import java.io.*; import org.infinispan.container.entries.*; import org.infinispan.loaders.*;
|
[
"java.io",
"org.infinispan.container",
"org.infinispan.loaders"
] |
java.io; org.infinispan.container; org.infinispan.loaders;
| 641,415
|
public static DnsServerAddresses sequential(Iterable<? extends InetSocketAddress> addresses) {
return sequential0(sanitize(addresses));
}
|
static DnsServerAddresses function(Iterable<? extends InetSocketAddress> addresses) { return sequential0(sanitize(addresses)); }
|
/**
* Returns the {@link DnsServerAddresses} that yields the specified {@code addresses} sequentially. Once the
* last address is yielded, it will start again from the first address.
*/
|
Returns the <code>DnsServerAddresses</code> that yields the specified addresses sequentially. Once the last address is yielded, it will start again from the first address
|
sequential
|
{
"repo_name": "joansmith/netty",
"path": "resolver-dns/src/main/java/io/netty/resolver/dns/DnsServerAddresses.java",
"license": "apache-2.0",
"size": 10626
}
|
[
"java.net.InetSocketAddress"
] |
import java.net.InetSocketAddress;
|
import java.net.*;
|
[
"java.net"
] |
java.net;
| 2,379,944
|
protected static GeometricAlgebraMultivectorElem<TestDimensionThree,GeometricAlgebraOrd<TestDimensionThree>,DoubleElem,DoubleElemFactory> convToVector( double x , double y , double z )
{
final DoubleElemFactory de = new DoubleElemFactory();
final TestDimensionThree td = new TestDimensionThree();
final GeometricAlgebraOrd<TestDimensionThree> ord = new GeometricAlgebraOrd<TestDimensionThree>( );
final GeometricAlgebraMultivectorElem<TestDimensionThree,GeometricAlgebraOrd<TestDimensionThree>,DoubleElem,DoubleElemFactory>
ret = new GeometricAlgebraMultivectorElem<TestDimensionThree,GeometricAlgebraOrd<TestDimensionThree>,DoubleElem,DoubleElemFactory>(de, td, ord);
{
final HashSet<BigInteger> h = new HashSet<BigInteger>();
h.add( BigInteger.ZERO );
ret.setVal( h , new DoubleElem( x ) );
}
{
final HashSet<BigInteger> h = new HashSet<BigInteger>();
h.add( BigInteger.ONE );
ret.setVal( h , new DoubleElem( y ) );
}
{
final HashSet<BigInteger> h = new HashSet<BigInteger>();
h.add( BigInteger.valueOf( 2 ) );
ret.setVal( h , new DoubleElem( z ) );
}
return( ret );
}
|
static GeometricAlgebraMultivectorElem<TestDimensionThree,GeometricAlgebraOrd<TestDimensionThree>,DoubleElem,DoubleElemFactory> function( double x , double y , double z ) { final DoubleElemFactory de = new DoubleElemFactory(); final TestDimensionThree td = new TestDimensionThree(); final GeometricAlgebraOrd<TestDimensionThree> ord = new GeometricAlgebraOrd<TestDimensionThree>( ); final GeometricAlgebraMultivectorElem<TestDimensionThree,GeometricAlgebraOrd<TestDimensionThree>,DoubleElem,DoubleElemFactory> ret = new GeometricAlgebraMultivectorElem<TestDimensionThree,GeometricAlgebraOrd<TestDimensionThree>,DoubleElem,DoubleElemFactory>(de, td, ord); { final HashSet<BigInteger> h = new HashSet<BigInteger>(); h.add( BigInteger.ZERO ); ret.setVal( h , new DoubleElem( x ) ); } { final HashSet<BigInteger> h = new HashSet<BigInteger>(); h.add( BigInteger.ONE ); ret.setVal( h , new DoubleElem( y ) ); } { final HashSet<BigInteger> h = new HashSet<BigInteger>(); h.add( BigInteger.valueOf( 2 ) ); ret.setVal( h , new DoubleElem( z ) ); } return( ret ); }
|
/**
* Generates a 3-D vector from its ordinates.
* @param x The X-Ordinate.
* @param y The Y-Ordinate.
* @param z The Z-Ordinate.
* @return The 3-D vector.
*/
|
Generates a 3-D vector from its ordinates
|
convToVector
|
{
"repo_name": "viridian1138/SimpleAlgebra_V2",
"path": "src/test_simplealgebra/TestDf2WriterAnim.java",
"license": "gpl-3.0",
"size": 7745
}
|
[
"java.math.BigInteger",
"java.util.HashSet"
] |
import java.math.BigInteger; import java.util.HashSet;
|
import java.math.*; import java.util.*;
|
[
"java.math",
"java.util"
] |
java.math; java.util;
| 473,592
|
@javax.annotation.Nullable
@ApiModelProperty(value = "UID of the referent.")
public String getUid() {
return uid;
}
|
@javax.annotation.Nullable @ApiModelProperty(value = STR) String function() { return uid; }
|
/**
* UID of the referent.
*
* @return uid
*/
|
UID of the referent
|
getUid
|
{
"repo_name": "kubernetes-client/java",
"path": "kubernetes/src/main/java/io/kubernetes/client/openapi/models/V1BoundObjectReference.java",
"license": "apache-2.0",
"size": 4643
}
|
[
"io.swagger.annotations.ApiModelProperty"
] |
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.*;
|
[
"io.swagger.annotations"
] |
io.swagger.annotations;
| 1,762,871
|
protected final void def(String name, Parser parser) {
if (parsers.containsKey(name)) {
throw new IllegalStateException("Duplicate production: " + name);
}
parsers.put(Objects.requireNonNull(name), Objects.requireNonNull(parser));
}
|
final void function(String name, Parser parser) { if (parsers.containsKey(name)) { throw new IllegalStateException(STR + name); } parsers.put(Objects.requireNonNull(name), Objects.requireNonNull(parser)); }
|
/**
* Defines a production with a {@code name} and a {@code parser}.
*/
|
Defines a production with a name and a parser
|
def
|
{
"repo_name": "petitparser/java-petitparser",
"path": "petitparser-core/src/main/java/org/petitparser/tools/GrammarDefinition.java",
"license": "mit",
"size": 5768
}
|
[
"java.util.Objects",
"org.petitparser.parser.Parser"
] |
import java.util.Objects; import org.petitparser.parser.Parser;
|
import java.util.*; import org.petitparser.parser.*;
|
[
"java.util",
"org.petitparser.parser"
] |
java.util; org.petitparser.parser;
| 2,317,903
|
private void makeRoom() {
if (size <= MAX_SIZE) {
return;
}
indexFiles();
// Delete LRUed files.
int removals = size - MAX_SIZE;
Iterator<File> i = accessOrder.values().iterator();
do {
delete(i.next());
i.remove();
} while (--removals > 0);
}
|
void function() { if (size <= MAX_SIZE) { return; } indexFiles(); int removals = size - MAX_SIZE; Iterator<File> i = accessOrder.values().iterator(); do { delete(i.next()); i.remove(); } while (--removals > 0); }
|
/**
* Deletes old files if necessary.
*/
|
Deletes old files if necessary
|
makeRoom
|
{
"repo_name": "rex-xxx/mt6572_x201",
"path": "libcore/luni/src/main/java/org/apache/harmony/xnet/provider/jsse/FileClientSessionCache.java",
"license": "gpl-2.0",
"size": 12715
}
|
[
"java.io.File",
"java.util.Iterator"
] |
import java.io.File; import java.util.Iterator;
|
import java.io.*; import java.util.*;
|
[
"java.io",
"java.util"
] |
java.io; java.util;
| 805,630
|
public MetaProperty<Failure> failure() {
return failure;
}
|
MetaProperty<Failure> function() { return failure; }
|
/**
* The meta-property for the {@code failure} property.
* @return the meta-property, not null
*/
|
The meta-property for the failure property
|
failure
|
{
"repo_name": "nssales/Strata",
"path": "modules/collect/src/main/java/com/opengamma/strata/collect/result/Result.java",
"license": "apache-2.0",
"size": 37953
}
|
[
"org.joda.beans.MetaProperty"
] |
import org.joda.beans.MetaProperty;
|
import org.joda.beans.*;
|
[
"org.joda.beans"
] |
org.joda.beans;
| 2,577,671
|
@Test
public void testToString() {
Assert.assertNotNull(new RemoveCoincidantSectors(null, null).toString());
}
|
void function() { Assert.assertNotNull(new RemoveCoincidantSectors(null, null).toString()); }
|
/**
* Test method for
* {@link br.odb.worldprocessing.RemoveCoincidantSectors#toString()}.
*/
|
Test method for <code>br.odb.worldprocessing.RemoveCoincidantSectors#toString()</code>
|
testToString
|
{
"repo_name": "TheFakeMontyOnTheRun/libworldproc",
"path": "src/test/java/libworldproc/RemoveCoincidantSectorsTest.java",
"license": "bsd-3-clause",
"size": 2906
}
|
[
"br.odb.worldprocessing.RemoveCoincidantSectors",
"org.junit.Assert"
] |
import br.odb.worldprocessing.RemoveCoincidantSectors; import org.junit.Assert;
|
import br.odb.worldprocessing.*; import org.junit.*;
|
[
"br.odb.worldprocessing",
"org.junit"
] |
br.odb.worldprocessing; org.junit;
| 547,941
|
public static void addCustomTagToState(State state, Tag<?> tag) {
state.appendToListProp(METRICS_STATE_CUSTOM_TAGS, tag.toString());
}
/**
* Add {@link List} of {@link Tag}s to a {@link Properties} with key {@link #METRICS_STATE_CUSTOM_TAGS}.
* <p>
* Also see {@link #addCustomTagToState(State, Tag)} , {@link #addCustomTagToProperties(Properties, Tag)}
|
static void function(State state, Tag<?> tag) { state.appendToListProp(METRICS_STATE_CUSTOM_TAGS, tag.toString()); } /** * Add {@link List} of {@link Tag}s to a {@link Properties} with key {@link #METRICS_STATE_CUSTOM_TAGS}. * <p> * Also see {@link #addCustomTagToState(State, Tag)} , {@link #addCustomTagToProperties(Properties, Tag)}
|
/**
* Add a {@link Tag} to a {@link org.apache.gobblin.configuration.State} with key {@link #METRICS_STATE_CUSTOM_TAGS}.
*
* <p>
* {@link org.apache.gobblin.metrics.Tag}s under this key can later be parsed using the method {@link #getCustomTagsFromState}.
* </p>
*
* @param state {@link org.apache.gobblin.configuration.State} state to add the tag to.
* @param tag {@link Tag} to add.
*/
|
Add a <code>Tag</code> to a <code>org.apache.gobblin.configuration.State</code> with key <code>#METRICS_STATE_CUSTOM_TAGS</code>. <code>org.apache.gobblin.metrics.Tag</code>s under this key can later be parsed using the method <code>#getCustomTagsFromState</code>.
|
addCustomTagToState
|
{
"repo_name": "jenniferzheng/gobblin",
"path": "gobblin-metrics-libs/gobblin-metrics/src/main/java/org/apache/gobblin/metrics/GobblinMetrics.java",
"license": "apache-2.0",
"size": 29327
}
|
[
"java.util.List",
"java.util.Properties",
"org.apache.gobblin.configuration.State"
] |
import java.util.List; import java.util.Properties; import org.apache.gobblin.configuration.State;
|
import java.util.*; import org.apache.gobblin.configuration.*;
|
[
"java.util",
"org.apache.gobblin"
] |
java.util; org.apache.gobblin;
| 2,030,655
|
@Test
public void telemetryShouldStartAtFirstCheckpointOfTrack()
throws TrackAlreadyStartedException, NoTrackCrossingException,
NoActiveTrackException, NoSuchCheckpointException {
ITrack track = getTrack();
when(tc.getTrack()).thenReturn(track);
when(tc.getLastCrossed()).thenReturn(mock(CheckpointCrossing.class));
manager.enable();
manager.onCheckpointCrossed();
CheckpointReachedTelemetryEvent crte =
(CheckpointReachedTelemetryEvent)
manager.getEvents().iterator().next();
assertTrue(crte.checkpointNumber() == 1);
assertTrue(crte.timestamp() >= 0);
}
|
void function() throws TrackAlreadyStartedException, NoTrackCrossingException, NoActiveTrackException, NoSuchCheckpointException { ITrack track = getTrack(); when(tc.getTrack()).thenReturn(track); when(tc.getLastCrossed()).thenReturn(mock(CheckpointCrossing.class)); manager.enable(); manager.onCheckpointCrossed(); CheckpointReachedTelemetryEvent crte = (CheckpointReachedTelemetryEvent) manager.getEvents().iterator().next(); assertTrue(crte.checkpointNumber() == 1); assertTrue(crte.timestamp() >= 0); }
|
/**
* Verifica che, se abilitato, il Tracciamento venga avviato
* all'attraversamento del primo checkpoint del Percorso.
*/
|
Verifica che, se abilitato, il Tracciamento venga avviato all'attraversamento del primo checkpoint del Percorso
|
telemetryShouldStartAtFirstCheckpointOfTrack
|
{
"repo_name": "tobiatesan/serleena-android",
"path": "serleena/app/src/test/java/com/kyloth/serleena/sensors/TelemetryManagerTest.java",
"license": "mit",
"size": 10747
}
|
[
"com.kyloth.serleena.common.CheckpointReachedTelemetryEvent",
"com.kyloth.serleena.common.NoTrackCrossingException",
"com.kyloth.serleena.model.ITrack",
"junit.framework.Assert",
"org.mockito.Mockito"
] |
import com.kyloth.serleena.common.CheckpointReachedTelemetryEvent; import com.kyloth.serleena.common.NoTrackCrossingException; import com.kyloth.serleena.model.ITrack; import junit.framework.Assert; import org.mockito.Mockito;
|
import com.kyloth.serleena.common.*; import com.kyloth.serleena.model.*; import junit.framework.*; import org.mockito.*;
|
[
"com.kyloth.serleena",
"junit.framework",
"org.mockito"
] |
com.kyloth.serleena; junit.framework; org.mockito;
| 1,655,231
|
protected Pair<Double, ServerHolder> chooseBestServer(
final DataSegment proposalSegment,
final Iterable<ServerHolder> serverHolders,
final boolean includeCurrentServer
)
{
Pair<Double, ServerHolder> bestServer = Pair.of(Double.POSITIVE_INFINITY, null);
List<ListenableFuture<Pair<Double, ServerHolder>>> futures = Lists.newArrayList();
|
Pair<Double, ServerHolder> function( final DataSegment proposalSegment, final Iterable<ServerHolder> serverHolders, final boolean includeCurrentServer ) { Pair<Double, ServerHolder> bestServer = Pair.of(Double.POSITIVE_INFINITY, null); List<ListenableFuture<Pair<Double, ServerHolder>>> futures = Lists.newArrayList();
|
/**
* For assignment, we want to move to the lowest cost server that isn't already serving the segment.
*
* @param proposalSegment A DataSegment that we are proposing to move.
* @param serverHolders An iterable of ServerHolders for a particular tier.
*
* @return A ServerHolder with the new home for a segment.
*/
|
For assignment, we want to move to the lowest cost server that isn't already serving the segment
|
chooseBestServer
|
{
"repo_name": "praveev/druid",
"path": "server/src/main/java/io/druid/server/coordinator/CostBalancerStrategy.java",
"license": "apache-2.0",
"size": 13319
}
|
[
"com.google.common.collect.Lists",
"com.google.common.util.concurrent.ListenableFuture",
"io.druid.java.util.common.Pair",
"io.druid.timeline.DataSegment",
"java.util.List"
] |
import com.google.common.collect.Lists; import com.google.common.util.concurrent.ListenableFuture; import io.druid.java.util.common.Pair; import io.druid.timeline.DataSegment; import java.util.List;
|
import com.google.common.collect.*; import com.google.common.util.concurrent.*; import io.druid.java.util.common.*; import io.druid.timeline.*; import java.util.*;
|
[
"com.google.common",
"io.druid.java",
"io.druid.timeline",
"java.util"
] |
com.google.common; io.druid.java; io.druid.timeline; java.util;
| 2,749,492
|
public JsonBuilder addDoc(byte[] doc) {
bytes.add(ByteBuffer.wrap(doc));
return this;
}
|
JsonBuilder function(byte[] doc) { bytes.add(ByteBuffer.wrap(doc)); return this; }
|
/**
* Add a document via a {@code byte[]} array
*
* @param doc {@code byte[]} array of a serialized JSON object
*/
|
Add a document via a byte[] array
|
addDoc
|
{
"repo_name": "nknize/elasticsearch",
"path": "client/rest-high-level/src/main/java/org/elasticsearch/client/ml/PostDataRequest.java",
"license": "apache-2.0",
"size": 8193
}
|
[
"java.nio.ByteBuffer"
] |
import java.nio.ByteBuffer;
|
import java.nio.*;
|
[
"java.nio"
] |
java.nio;
| 600,505
|
@Bean(name = AbstractSecurityWebApplicationInitializer.DEFAULT_FILTER_NAME)
public Filter springSecurityFilterChain() throws Exception {
boolean hasConfigurers = webSecurityConfigurers != null
&& !webSecurityConfigurers.isEmpty();
if (!hasConfigurers) {
WebSecurityConfigurerAdapter adapter = objectObjectPostProcessor
.postProcess(new WebSecurityConfigurerAdapter() {
});
webSecurity.apply(adapter);
}
return webSecurity.build();
}
/**
* Creates the {@link WebInvocationPrivilegeEvaluator} that is necessary for the JSP
* tag support.
* @return the {@link WebInvocationPrivilegeEvaluator}
|
@Bean(name = AbstractSecurityWebApplicationInitializer.DEFAULT_FILTER_NAME) Filter function() throws Exception { boolean hasConfigurers = webSecurityConfigurers != null && !webSecurityConfigurers.isEmpty(); if (!hasConfigurers) { WebSecurityConfigurerAdapter adapter = objectObjectPostProcessor .postProcess(new WebSecurityConfigurerAdapter() { }); webSecurity.apply(adapter); } return webSecurity.build(); } /** * Creates the {@link WebInvocationPrivilegeEvaluator} that is necessary for the JSP * tag support. * @return the {@link WebInvocationPrivilegeEvaluator}
|
/**
* Creates the Spring Security Filter Chain
* @return
* @throws Exception
*/
|
Creates the Spring Security Filter Chain
|
springSecurityFilterChain
|
{
"repo_name": "ollie314/spring-security",
"path": "config/src/main/java/org/springframework/security/config/annotation/web/configuration/WebSecurityConfiguration.java",
"license": "apache-2.0",
"size": 8458
}
|
[
"javax.servlet.Filter",
"org.springframework.context.annotation.Bean",
"org.springframework.security.web.access.WebInvocationPrivilegeEvaluator",
"org.springframework.security.web.context.AbstractSecurityWebApplicationInitializer"
] |
import javax.servlet.Filter; import org.springframework.context.annotation.Bean; import org.springframework.security.web.access.WebInvocationPrivilegeEvaluator; import org.springframework.security.web.context.AbstractSecurityWebApplicationInitializer;
|
import javax.servlet.*; import org.springframework.context.annotation.*; import org.springframework.security.web.access.*; import org.springframework.security.web.context.*;
|
[
"javax.servlet",
"org.springframework.context",
"org.springframework.security"
] |
javax.servlet; org.springframework.context; org.springframework.security;
| 154,350
|
public static String format( String vapScheme, String resourceUri, Map<String,Object> args ) {
Map<String,String> largs;
if ( args!=null ) {
largs= new LinkedHashMap(); //
for ( Entry<String,Object> e: args.entrySet() ) {
if ( e.getValue()==null ) {
largs.put( e.getKey(), "" );
} else {
largs.put( e.getKey(), String.valueOf(e.getValue()) );
}
}
} else {
largs= null;
}
if ( resourceUri==null ) {
if ( vapScheme==null ) {
throw new IllegalArgumentException("vapScheme must be specified when resourceUri is null");
}
if ( largs!=null ) {
return vapScheme + formatParams(largs);
} else {
return vapScheme;
}
} else {
URISplit split= URISplit.parse(resourceUri);
if ( vapScheme!=null ) {
split.vapScheme= vapScheme;
}
if ( largs!=null ) {
split.params= formatParams(largs);
}
return URISplit.format(split);
}
}
|
static String function( String vapScheme, String resourceUri, Map<String,Object> args ) { Map<String,String> largs; if ( args!=null ) { largs= new LinkedHashMap(); if ( e.getValue()==null ) { largs.put( e.getKey(), STRvapScheme must be specified when resourceUri is null"); } if ( largs!=null ) { return vapScheme + formatParams(largs); } else { return vapScheme; } } else { URISplit split= URISplit.parse(resourceUri); if ( vapScheme!=null ) { split.vapScheme= vapScheme; } if ( largs!=null ) { split.params= formatParams(largs); } return URISplit.format(split); } }
|
/**
* convenience method for creating URIs.
* @param vapScheme null or the data source scheme, such as "vap+das2server" or "vap+cdaweb"
* @param resourceUri null or the resource uri, such as "http://www-pw.physics.uiowa.edu/das/das2Server"
* @param args null or a map of arguments, including "arg_0" for a positional argument.
* @return the URI. If vapScheme is null, then the URI will be implicit.
* @see org.autoplot.jythonsupport#uri
*/
|
convenience method for creating URIs
|
format
|
{
"repo_name": "autoplot/app",
"path": "DataSource/src/org/autoplot/datasource/URISplit.java",
"license": "gpl-2.0",
"size": 40709
}
|
[
"java.util.LinkedHashMap",
"java.util.Map"
] |
import java.util.LinkedHashMap; import java.util.Map;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 684,736
|
public void testAddAccount() throws IOException, AuthenticatorException,
OperationCanceledException {
Bundle resultBundle = addAccount(am,
ACCOUNT_TYPE,
AUTH_TOKEN_TYPE,
REQUIRED_FEATURES,
OPTIONS_BUNDLE,
mActivity,
null ,
null );
// Assert parameters has been passed correctly
validateAccountAndAuthTokenType();
validateFeatures();
validateOptions(OPTIONS_BUNDLE, mockAuthenticator.mOptionsAddAccount);
validateSystemOptions(mockAuthenticator.mOptionsAddAccount);
validateOptions(null, mockAuthenticator.mOptionsUpdateCredentials);
validateOptions(null, mockAuthenticator.mOptionsConfirmCredentials);
validateOptions(null, mockAuthenticator.mOptionsGetAuthToken);
// Assert returned result
validateAccountAndNoAuthTokenResult(resultBundle);
}
|
void function() throws IOException, AuthenticatorException, OperationCanceledException { Bundle resultBundle = addAccount(am, ACCOUNT_TYPE, AUTH_TOKEN_TYPE, REQUIRED_FEATURES, OPTIONS_BUNDLE, mActivity, null , null ); validateAccountAndAuthTokenType(); validateFeatures(); validateOptions(OPTIONS_BUNDLE, mockAuthenticator.mOptionsAddAccount); validateSystemOptions(mockAuthenticator.mOptionsAddAccount); validateOptions(null, mockAuthenticator.mOptionsUpdateCredentials); validateOptions(null, mockAuthenticator.mOptionsConfirmCredentials); validateOptions(null, mockAuthenticator.mOptionsGetAuthToken); validateAccountAndNoAuthTokenResult(resultBundle); }
|
/**
* Test a basic addAccount()
*/
|
Test a basic addAccount()
|
testAddAccount
|
{
"repo_name": "wiki2014/Learning-Summary",
"path": "alps/cts/tests/tests/accounts/src/android/accounts/cts/AccountManagerTest.java",
"license": "gpl-3.0",
"size": 79160
}
|
[
"android.accounts.AuthenticatorException",
"android.accounts.OperationCanceledException",
"android.os.Bundle",
"java.io.IOException"
] |
import android.accounts.AuthenticatorException; import android.accounts.OperationCanceledException; import android.os.Bundle; import java.io.IOException;
|
import android.accounts.*; import android.os.*; import java.io.*;
|
[
"android.accounts",
"android.os",
"java.io"
] |
android.accounts; android.os; java.io;
| 807,326
|
public static void main(String... args) throws FileNotFoundException {
final String accessKeyId = FeedsConfig.ACCESS_KEY_ID;
final String secretAccessKey = FeedsConfig.SECRET_ACCESS_KEY;
final String appName = FeedsConfig.APPLICATION_NAME;
final String appVersion = FeedsConfig.APPLICATION_VERSION;
MarketplaceWebServiceConfig config = new MarketplaceWebServiceConfig();
// US
config.setServiceURL("https://mws.amazonservices.com");
// UK
// config.setServiceURL("https://mws.amazonservices.co.uk");
// Germany
// config.setServiceURL("https://mws.amazonservices.de");
// France
// config.setServiceURL("https://mws.amazonservices.fr");
// Italy
// config.setServiceURL("https://mws.amazonservices.it");
// Japan
// config.setServiceURL("https://mws.amazonservices.jp");
// China
// config.setServiceURL("https://mws.amazonservices.com.cn");
// Canada
// config.setServiceURL("https://mws.amazonservices.ca");
// India
// config.setServiceURL("https://mws.amazonservices.in");
MarketplaceWebService service = new MarketplaceWebServiceClient(
accessKeyId, secretAccessKey, appName, appVersion, config);
final String merchantId = FeedsConfig.SELLER_ID;
GetFeedSubmissionResultRequest request = new GetFeedSubmissionResultRequest();
request.setMerchant(merchantId);
request.setFeedSubmissionId( "10026369570" );
// Note that depending on the size of the feed sent in, and the number of errors and warnings,
// the result can reach sizes greater than 1GB. For this reason we recommend that you _always_
// program to MWS in a streaming fashion. Otherwise, as your business grows you may silently reach
// the in-memory size limit and have to re-work your solution.
//
OutputStream processingResult = new ByteArrayOutputStream();//new FileOutputStream( "feedSubmissionResult.xml" );
request.setFeedSubmissionResultOutputStream( processingResult );
invokeGetFeedSubmissionResult(service, request);
}
|
static void function(String... args) throws FileNotFoundException { final String accessKeyId = FeedsConfig.ACCESS_KEY_ID; final String secretAccessKey = FeedsConfig.SECRET_ACCESS_KEY; final String appName = FeedsConfig.APPLICATION_NAME; final String appVersion = FeedsConfig.APPLICATION_VERSION; MarketplaceWebServiceConfig config = new MarketplaceWebServiceConfig(); config.setServiceURL(STR10026369570" ); request.setFeedSubmissionResultOutputStream( processingResult ); invokeGetFeedSubmissionResult(service, request); }
|
/**
* Just add a few required parameters, and try the service
* Get Feed Submission Result functionality
*
* @param args unused
* @throws FileNotFoundException
*/
|
Just add a few required parameters, and try the service Get Feed Submission Result functionality
|
main
|
{
"repo_name": "VDuda/SyncRunner-Pub",
"path": "src/API/amazon/mws/feeds/actions/GetFeedSubmissionResultSample.java",
"license": "mit",
"size": 8386
}
|
[
"java.io.FileNotFoundException"
] |
import java.io.FileNotFoundException;
|
import java.io.*;
|
[
"java.io"
] |
java.io;
| 1,639,999
|
URL url = new URL(fileURL);
httpConn = (HttpURLConnection) url.openConnection();
int responseCode = httpConn.getResponseCode();
// always check HTTP response code first
if (responseCode == HttpURLConnection.HTTP_OK) {
String disposition = httpConn.getHeaderField("Content-Disposition");
String contentType = httpConn.getContentType();
contentLength = httpConn.getContentLength();
if (disposition != null) {
// extracts file name from header field
int index = disposition.indexOf("filename=");
if (index > 0) {
fileName = disposition.substring(index + 10,
disposition.length() - 1);
}
} else {
// extracts file name from URL
fileName = fileURL.substring(fileURL.lastIndexOf("/") + 1,
fileURL.length());
}
// output for debugging purpose only
System.out.println("Content-Type = " + contentType);
System.out.println("Content-Disposition = " + disposition);
System.out.println("Content-Length = " + contentLength);
System.out.println("fileName = " + fileName);
// opens input stream from the HTTP connection
inputStream = httpConn.getInputStream();
} else {
throw new IOException(
"No file to download. Server replied HTTP code: "
+ responseCode);
}
}
|
URL url = new URL(fileURL); httpConn = (HttpURLConnection) url.openConnection(); int responseCode = httpConn.getResponseCode(); if (responseCode == HttpURLConnection.HTTP_OK) { String disposition = httpConn.getHeaderField(STR); String contentType = httpConn.getContentType(); contentLength = httpConn.getContentLength(); if (disposition != null) { int index = disposition.indexOf(STR); if (index > 0) { fileName = disposition.substring(index + 10, disposition.length() - 1); } } else { fileName = fileURL.substring(fileURL.lastIndexOf("/") + 1, fileURL.length()); } System.out.println(STR + contentType); System.out.println(STR + disposition); System.out.println(STR + contentLength); System.out.println(STR + fileName); inputStream = httpConn.getInputStream(); } else { throw new IOException( STR + responseCode); } }
|
/**
* Downloads a file from a URL
*
* @param fileURL
* HTTP URL of the file to be downloaded
* @throws IOException
*/
|
Downloads a file from a URL
|
downloadFile
|
{
"repo_name": "SciGaP/SEAGrid-Desktop-GUI",
"path": "src/main/java/org/apache/airavata/gridchem/file/HTTPDownloadUtil.java",
"license": "apache-2.0",
"size": 2568
}
|
[
"java.io.IOException",
"java.net.HttpURLConnection"
] |
import java.io.IOException; import java.net.HttpURLConnection;
|
import java.io.*; import java.net.*;
|
[
"java.io",
"java.net"
] |
java.io; java.net;
| 1,780,997
|
public static <T extends DataSet> void assertCan( IDataStockMetaData dsm, String negativeMessage, ProtectionType... canWhat ) throws AuthorizationException {
if ( dsm == null ) {
throw new AuthorizationException( negativeMessage );
}
SecurityUtil.assertPermission( SecurityUtil.toWildcardString( ProtectableType.STOCK, canWhat, String.valueOf( dsm.getId() ) ), negativeMessage );
}
|
static <T extends DataSet> void function( IDataStockMetaData dsm, String negativeMessage, ProtectionType... canWhat ) throws AuthorizationException { if ( dsm == null ) { throw new AuthorizationException( negativeMessage ); } SecurityUtil.assertPermission( SecurityUtil.toWildcardString( ProtectableType.STOCK, canWhat, String.valueOf( dsm.getId() ) ), negativeMessage ); }
|
/**
* Assert that current user has provided right for provided data stock,
* exception is being thrown otherwise
*
* @param <T>
* data set type
* @param dsm
* data stock meta to check for current user
* @param negativeMessage
* message of exception if permission is not to be granted
* @param canWhat
* type of permissions to check
* @throws AuthorizationException
* if access is not to be granted (provided message)
*/
|
Assert that current user has provided right for provided data stock, exception is being thrown otherwise
|
assertCan
|
{
"repo_name": "PE-INTERNATIONAL/soda4lca",
"path": "Node/src/main/java/de/iai/ilcd/security/SecurityUtil.java",
"license": "gpl-3.0",
"size": 15791
}
|
[
"de.iai.ilcd.model.common.DataSet",
"de.iai.ilcd.model.datastock.IDataStockMetaData",
"org.apache.shiro.authz.AuthorizationException"
] |
import de.iai.ilcd.model.common.DataSet; import de.iai.ilcd.model.datastock.IDataStockMetaData; import org.apache.shiro.authz.AuthorizationException;
|
import de.iai.ilcd.model.common.*; import de.iai.ilcd.model.datastock.*; import org.apache.shiro.authz.*;
|
[
"de.iai.ilcd",
"org.apache.shiro"
] |
de.iai.ilcd; org.apache.shiro;
| 1,483,553
|
private void attributes( RuleDescrBuilder rule ) throws RecognitionException {
if ( helper.validateIdentifierKey( DroolsSoftKeywords.ATTRIBUTES ) ) {
match( input,
DRL5Lexer.ID,
DroolsSoftKeywords.ATTRIBUTES,
null,
DroolsEditorType.IDENTIFIER );
if ( state.failed ) return;
if ( input.LA( 1 ) == DRL5Lexer.COLON ) {
match( input,
DRL5Lexer.COLON,
null,
null,
DroolsEditorType.SYMBOL );
if ( state.failed ) return;
}
}
if ( helper.validateAttribute( 1 ) ) {
attribute( rule );
if ( state.failed ) return;
while ( input.LA( 1 ) == DRL5Lexer.COMMA || helper.validateAttribute( 1 ) ) {
if ( input.LA( 1 ) == DRL5Lexer.COMMA ) {
match( input,
DRL5Lexer.COMMA,
null,
null,
DroolsEditorType.SYMBOL );
if ( state.failed ) return;
}
attribute( rule );
if ( state.failed ) return;
}
}
}
|
void function( RuleDescrBuilder rule ) throws RecognitionException { if ( helper.validateIdentifierKey( DroolsSoftKeywords.ATTRIBUTES ) ) { match( input, DRL5Lexer.ID, DroolsSoftKeywords.ATTRIBUTES, null, DroolsEditorType.IDENTIFIER ); if ( state.failed ) return; if ( input.LA( 1 ) == DRL5Lexer.COLON ) { match( input, DRL5Lexer.COLON, null, null, DroolsEditorType.SYMBOL ); if ( state.failed ) return; } } if ( helper.validateAttribute( 1 ) ) { attribute( rule ); if ( state.failed ) return; while ( input.LA( 1 ) == DRL5Lexer.COMMA helper.validateAttribute( 1 ) ) { if ( input.LA( 1 ) == DRL5Lexer.COMMA ) { match( input, DRL5Lexer.COMMA, null, null, DroolsEditorType.SYMBOL ); if ( state.failed ) return; } attribute( rule ); if ( state.failed ) return; } } }
|
/**
* attributes := (ATTRIBUTES COLON?)? [ attribute ( COMMA? attribute )* ]
* @param rule
* @throws RecognitionException
*/
|
attributes := (ATTRIBUTES COLON?)? [ attribute ( COMMA? attribute )* ]
|
attributes
|
{
"repo_name": "yurloc/drools",
"path": "drools-compiler/src/main/java/org/drools/lang/DRL5Parser.java",
"license": "apache-2.0",
"size": 169427
}
|
[
"org.antlr.runtime.RecognitionException",
"org.drools.lang.api.RuleDescrBuilder"
] |
import org.antlr.runtime.RecognitionException; import org.drools.lang.api.RuleDescrBuilder;
|
import org.antlr.runtime.*; import org.drools.lang.api.*;
|
[
"org.antlr.runtime",
"org.drools.lang"
] |
org.antlr.runtime; org.drools.lang;
| 1,133,081
|
@Modified
protected void update(final Map<String, Object> props, final Config config) {
this.disabledDistribution = config.job_consumermanager_disableDistribution();
this.backgroundLoadDelay = PropertiesUtil.toLong(props.get(PROPERTY_BACKGROUND_LOAD_DELAY), DEFAULT_BACKGROUND_LOAD_DELAY);
// SLING-5560: note that currently you can't change the startupDelay to have
// an immediate effect - it will only have an effect on next activation.
// (as 'startup delay runnable' is already scheduled in activate)
this.startupDelay = config.startup_delay();
}
|
void function(final Map<String, Object> props, final Config config) { this.disabledDistribution = config.job_consumermanager_disableDistribution(); this.backgroundLoadDelay = PropertiesUtil.toLong(props.get(PROPERTY_BACKGROUND_LOAD_DELAY), DEFAULT_BACKGROUND_LOAD_DELAY); this.startupDelay = config.startup_delay(); }
|
/**
* Update with a new configuration
*/
|
Update with a new configuration
|
update
|
{
"repo_name": "tmaret/sling",
"path": "bundles/extensions/event/resource/src/main/java/org/apache/sling/event/impl/jobs/config/JobManagerConfiguration.java",
"license": "apache-2.0",
"size": 23504
}
|
[
"java.util.Map",
"org.apache.sling.commons.osgi.PropertiesUtil"
] |
import java.util.Map; import org.apache.sling.commons.osgi.PropertiesUtil;
|
import java.util.*; import org.apache.sling.commons.osgi.*;
|
[
"java.util",
"org.apache.sling"
] |
java.util; org.apache.sling;
| 1,674,042
|
int createTrueCondition(PointerByReference condition);
|
int createTrueCondition(PointerByReference condition);
|
/**
* Retrieves a predefined condition that selects all elements.
* @param condition The created condition
* @return Error code
*/
|
Retrieves a predefined condition that selects all elements
|
createTrueCondition
|
{
"repo_name": "mmarquee/ui-automation",
"path": "src/main/java/mmarquee/uiautomation/IUIAutomation.java",
"license": "apache-2.0",
"size": 9653
}
|
[
"com.sun.jna.ptr.PointerByReference"
] |
import com.sun.jna.ptr.PointerByReference;
|
import com.sun.jna.ptr.*;
|
[
"com.sun.jna"
] |
com.sun.jna;
| 2,893,769
|
public void removeRunnableResources(String runnableName, String containerId) {
TwillRunResources toRemove = null;
// could be faster if usedResources was a Table, but that makes returning the
// report a little more complex, and this does not need to be terribly fast.
for (TwillRunResources resources : usedResources.get(runnableName)) {
if (resources.getContainerId().equals(containerId)) {
toRemove = resources;
break;
}
}
usedResources.remove(runnableName, toRemove);
}
|
void function(String runnableName, String containerId) { TwillRunResources toRemove = null; for (TwillRunResources resources : usedResources.get(runnableName)) { if (resources.getContainerId().equals(containerId)) { toRemove = resources; break; } } usedResources.remove(runnableName, toRemove); }
|
/**
* Remove the resource corresponding to the given runnable and container.
*
* @param runnableName name of runnable.
* @param containerId container id of the runnable.
*/
|
Remove the resource corresponding to the given runnable and container
|
removeRunnableResources
|
{
"repo_name": "serranom/twill",
"path": "twill-core/src/main/java/org/apache/twill/internal/DefaultResourceReport.java",
"license": "apache-2.0",
"size": 5303
}
|
[
"org.apache.twill.api.TwillRunResources"
] |
import org.apache.twill.api.TwillRunResources;
|
import org.apache.twill.api.*;
|
[
"org.apache.twill"
] |
org.apache.twill;
| 1,208,350
|
protected static InputStream getResourceAsStream(String resource)
{
String stripped = resource.startsWith("/") ?
resource.substring(1) : resource;
InputStream stream = null;
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
if (classLoader!=null) {
stream = classLoader.getResourceAsStream( stripped );
}
if ( stream == null ) {
ConfigurationDBAdapterParser.class.getResourceAsStream( resource );
}
if ( stream == null ) {
stream = ConfigurationDBAdapterParser.class.getClassLoader().getResourceAsStream( stripped );
}
if ( stream == null ) {
throw new RuntimeException( resource + " not found" );
}
return stream;
}
|
static InputStream function(String resource) { String stripped = resource.startsWith("/") ? resource.substring(1) : resource; InputStream stream = null; ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); if (classLoader!=null) { stream = classLoader.getResourceAsStream( stripped ); } if ( stream == null ) { ConfigurationDBAdapterParser.class.getResourceAsStream( resource ); } if ( stream == null ) { stream = ConfigurationDBAdapterParser.class.getClassLoader().getResourceAsStream( stripped ); } if ( stream == null ) { throw new RuntimeException( resource + STR ); } return stream; }
|
/**
* Returns an input stream from an application resource in the classpath.
* @param resource to get input stream for
* @return input stream for resource
*/
|
Returns an input stream from an application resource in the classpath
|
getResourceAsStream
|
{
"repo_name": "intelie/esper",
"path": "esperio-db/src/main/java/com/espertech/esperio/db/config/ConfigurationDBAdapterParser.java",
"license": "gpl-2.0",
"size": 16076
}
|
[
"java.io.InputStream"
] |
import java.io.InputStream;
|
import java.io.*;
|
[
"java.io"
] |
java.io;
| 271,410
|
void variableNotAlwaysInitialized(VariableExpression var);
}
|
void variableNotAlwaysInitialized(VariableExpression var); }
|
/**
* Callback used whenever a variable is declared as final, but can remain in an uninitialized state
* @param var the variable detected as potentially uninitialized
*/
|
Callback used whenever a variable is declared as final, but can remain in an uninitialized state
|
variableNotAlwaysInitialized
|
{
"repo_name": "christoph-frick/groovy-core",
"path": "src/main/org/codehaus/groovy/classgen/FinalVariableAnalyzer.java",
"license": "apache-2.0",
"size": 14271
}
|
[
"org.codehaus.groovy.ast.expr.VariableExpression"
] |
import org.codehaus.groovy.ast.expr.VariableExpression;
|
import org.codehaus.groovy.ast.expr.*;
|
[
"org.codehaus.groovy"
] |
org.codehaus.groovy;
| 551,042
|
@Override
protected void cleanup( TestParameters tParam, PrintWriter log ) {
log.println( " disposing document " );
xImpressDoc.dispose();
}
|
void function( TestParameters tParam, PrintWriter log ) { log.println( STR ); xImpressDoc.dispose(); }
|
/**
* Impress document destroyed.
*/
|
Impress document destroyed
|
cleanup
|
{
"repo_name": "jvanz/core",
"path": "qadevOOo/tests/java/mod/_xmloff/Impress/XMLMetaImporter.java",
"license": "gpl-3.0",
"size": 5966
}
|
[
"java.io.PrintWriter"
] |
import java.io.PrintWriter;
|
import java.io.*;
|
[
"java.io"
] |
java.io;
| 867,706
|
public Integer[] getUnpaidInvoices(Integer userId) {
try {
CachedRowSet rs = new InvoiceBL().getPayableInvoicesByUser(userId);
Integer[] invoiceIds = new Integer[rs.size()];
int i = 0;
while (rs.next())
invoiceIds[i++] = rs.getInt(1);
rs.close();
return invoiceIds;
} catch (SQLException e) {
throw new SessionInternalError("Exception occurred querying payable invoices.");
} catch (Exception e) {
throw new SessionInternalError("An un-handled exception occurred querying payable invoices.");
}
}
|
Integer[] function(Integer userId) { try { CachedRowSet rs = new InvoiceBL().getPayableInvoicesByUser(userId); Integer[] invoiceIds = new Integer[rs.size()]; int i = 0; while (rs.next()) invoiceIds[i++] = rs.getInt(1); rs.close(); return invoiceIds; } catch (SQLException e) { throw new SessionInternalError(STR); } catch (Exception e) { throw new SessionInternalError(STR); } }
|
/**
* Returns an array of IDs for all unpaid invoices under the given user ID.
*
* @param userId user IDs
* @return array of un-paid invoice IDs
*/
|
Returns an array of IDs for all unpaid invoices under the given user ID
|
getUnpaidInvoices
|
{
"repo_name": "tarique313/nBilling",
"path": "src/java/com/sapienter/jbilling/server/util/WebServicesSessionSpringBean.java",
"license": "agpl-3.0",
"size": 119293
}
|
[
"com.sapienter.jbilling.common.SessionInternalError",
"com.sapienter.jbilling.server.invoice.InvoiceBL",
"java.sql.SQLException",
"javax.sql.rowset.CachedRowSet"
] |
import com.sapienter.jbilling.common.SessionInternalError; import com.sapienter.jbilling.server.invoice.InvoiceBL; import java.sql.SQLException; import javax.sql.rowset.CachedRowSet;
|
import com.sapienter.jbilling.common.*; import com.sapienter.jbilling.server.invoice.*; import java.sql.*; import javax.sql.rowset.*;
|
[
"com.sapienter.jbilling",
"java.sql",
"javax.sql"
] |
com.sapienter.jbilling; java.sql; javax.sql;
| 274,176
|
public Font getFont() {
return this.font;
}
|
Font function() { return this.font; }
|
/**
* Returns the font.
*
* @return The font (never <code>null</code>).
*
* @see #getFont()
*/
|
Returns the font
|
getFont
|
{
"repo_name": "JSansalone/JFreeChart",
"path": "source/org/jfree/chart/plot/dial/DialValueIndicator.java",
"license": "lgpl-2.1",
"size": 23421
}
|
[
"java.awt.Font"
] |
import java.awt.Font;
|
import java.awt.*;
|
[
"java.awt"
] |
java.awt;
| 526,561
|
private void setupMethodInfo() throws NoSuchMethodException {
try {
String firstChar = propertyName.substring(0, 1);
String remainder = propertyName.substring(1);
Class propertyType = getType();
String propertySetterName = "set" + firstChar.toUpperCase() + remainder;
PropertyDescriptor prop = new PropertyDescriptor(propertyName, object.getClass(),
null, propertySetterName);
propertySetter = prop.getWriteMethod();
if (isToAnimation()) {
// Only need the getter for "to" animations
String propertyGetterName = "get" + firstChar.toUpperCase() +
remainder;
prop = new PropertyDescriptor(propertyName,
object.getClass(), propertyGetterName, null);
propertyGetter = prop.getReadMethod();
}
} catch (Exception e) {
throw new NoSuchMethodException("Cannot find property methods: " + e);
}
}
//
// TimingTargetAdapter overrides
//
|
void function() throws NoSuchMethodException { try { String firstChar = propertyName.substring(0, 1); String remainder = propertyName.substring(1); Class propertyType = getType(); String propertySetterName = "set" + firstChar.toUpperCase() + remainder; PropertyDescriptor prop = new PropertyDescriptor(propertyName, object.getClass(), null, propertySetterName); propertySetter = prop.getWriteMethod(); if (isToAnimation()) { String propertyGetterName = "get" + firstChar.toUpperCase() + remainder; prop = new PropertyDescriptor(propertyName, object.getClass(), propertyGetterName, null); propertyGetter = prop.getReadMethod(); } } catch (Exception e) { throw new NoSuchMethodException(STR + e); } }
|
/**
* Translates the property name used in the PropertyRange object into
* the appropriate Method in the Object to be modified. This uses
* standard JavaBean naming convention (e.g., propertyName would
* become setPropertyName).
* @throws NoSuchMethodException if there is no method on the
* object with the appropriate name
* @throws SecurityException if the application does not have
* appropriate permissions to request access to the Method
*/
|
Translates the property name used in the PropertyRange object into the appropriate Method in the Object to be modified. This uses standard JavaBean naming convention (e.g., propertyName would become setPropertyName)
|
setupMethodInfo
|
{
"repo_name": "KEOpenSource/CAExplorer",
"path": "org/jdesktop/animation/timing/interpolation/PropertySetter.java",
"license": "apache-2.0",
"size": 17236
}
|
[
"java.beans.PropertyDescriptor"
] |
import java.beans.PropertyDescriptor;
|
import java.beans.*;
|
[
"java.beans"
] |
java.beans;
| 1,879,330
|
@Override
public COSBase getCOSObject() {
return rangeArray;
}
|
COSBase function() { return rangeArray; }
|
/**
* Convert this standard java object to a COS object.
*
* @return The cos object that matches this Java object.
*/
|
Convert this standard java object to a COS object
|
getCOSObject
|
{
"repo_name": "gavanx/pdflearn",
"path": "pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDRange.java",
"license": "apache-2.0",
"size": 3607
}
|
[
"org.apache.pdfbox.cos.COSBase"
] |
import org.apache.pdfbox.cos.COSBase;
|
import org.apache.pdfbox.cos.*;
|
[
"org.apache.pdfbox"
] |
org.apache.pdfbox;
| 2,458,177
|
public final String generateXref(String name) throws IOException {
final File sourceFile = new File(name);
final Path dest = getDestinationPath(name);
codeTransform.transform(sourceFile.getAbsolutePath(),
dest.toString(), Locale.ENGLISH,
ENCODING, ENCODING, "", "", "");
return sitePath.relativize(dest).toString();
}
|
final String function(String name) throws IOException { final File sourceFile = new File(name); final Path dest = getDestinationPath(name); codeTransform.transform(sourceFile.getAbsolutePath(), dest.toString(), Locale.ENGLISH, ENCODING, ENCODING, STRSTR"); return sitePath.relativize(dest).toString(); }
|
/**
* Generates XREF file from source file.
*
* @param name
* path to the source file.
* @return relative path to the resulting file.
* @throws IOException
* on maven-jxr internal failure.
*/
|
Generates XREF file from source file
|
generateXref
|
{
"repo_name": "rnveach/contribution",
"path": "patch-diff-report-tool/src/main/java/com/github/checkstyle/site/XrefGenerator.java",
"license": "lgpl-2.1",
"size": 4119
}
|
[
"java.io.File",
"java.io.IOException",
"java.nio.file.Path",
"java.util.Locale"
] |
import java.io.File; import java.io.IOException; import java.nio.file.Path; import java.util.Locale;
|
import java.io.*; import java.nio.file.*; import java.util.*;
|
[
"java.io",
"java.nio",
"java.util"
] |
java.io; java.nio; java.util;
| 1,475,056
|
public static boolean isValidName(String src) {
// Path must be absolute.
if (!src.startsWith(Path.SEPARATOR)) {
return false;
}
// Check for ".." "." ":" "/"
String[] components = StringUtils.split(src, '/');
for (int i = 0; i < components.length; i++) {
String element = components[i];
if (element.equals(".") ||
(element.contains(":")) ||
(element.contains("/"))) {
return false;
}
// ".." is allowed in path starting with /.reserved/.inodes
if (element.equals("..")) {
if (components.length > 4
&& components[1].equals(".reserved")
&& components[2].equals(".inodes")) {
continue;
}
return false;
}
// The string may start or end with a /, but not have
// "//" in the middle.
if (element.isEmpty() && i != components.length - 1 &&
i != 0) {
return false;
}
}
return true;
}
|
static boolean function(String src) { if (!src.startsWith(Path.SEPARATOR)) { return false; } String[] components = StringUtils.split(src, '/'); for (int i = 0; i < components.length; i++) { String element = components[i]; if (element.equals(".") (element.contains(":")) (element.contains("/"))) { return false; } if (element.equals("..")) { if (components.length > 4 && components[1].equals(STR) && components[2].equals(STR)) { continue; } return false; } if (element.isEmpty() && i != components.length - 1 && i != 0) { return false; } } return true; }
|
/**
* Whether the pathname is valid. Currently prohibits relative paths,
* names which contain a ":" or "//", or other non-canonical paths.
*/
|
Whether the pathname is valid. Currently prohibits relative paths, names which contain a ":" or "//", or other non-canonical paths
|
isValidName
|
{
"repo_name": "plusplusjiajia/hadoop",
"path": "hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DFSUtilClient.java",
"license": "apache-2.0",
"size": 38937
}
|
[
"org.apache.hadoop.fs.Path",
"org.apache.hadoop.util.StringUtils"
] |
import org.apache.hadoop.fs.Path; import org.apache.hadoop.util.StringUtils;
|
import org.apache.hadoop.fs.*; import org.apache.hadoop.util.*;
|
[
"org.apache.hadoop"
] |
org.apache.hadoop;
| 1,682,577
|
public ReportGenerator getReportGenerator() {
return reportGenerator;
}
|
ReportGenerator function() { return reportGenerator; }
|
/**
* The parameterized report generator, that must be passed to HTML generator
* template.
*
* @return
*/
|
The parameterized report generator, that must be passed to HTML generator template
|
getReportGenerator
|
{
"repo_name": "qgears/qgears-review-tool",
"path": "hu.qgears.review.eclipse.ui/src/hu/qgears/review/eclipse/ui/wizard/ExportReportWizard.java",
"license": "epl-1.0",
"size": 4222
}
|
[
"hu.qgears.review.report.ReportGenerator"
] |
import hu.qgears.review.report.ReportGenerator;
|
import hu.qgears.review.report.*;
|
[
"hu.qgears.review"
] |
hu.qgears.review;
| 995,930
|
@Test
public void testMappingToNodes() {
String n1 = "node #1";
String n2 = "node #2";
String n3 = "node #3";
String n4 = "node #4";
List<String> nodes = Arrays.asList(n1, n2, n3, n4);
GridClientConsistentHash<String> hash = new GridClientConsistentHash<>();
for (String node : nodes)
hash.addNode(node, 5);
Map<Object, String> data = new LinkedHashMap<>();
data.put("", n1);
data.put("asdf", n3);
data.put("224ea4cd-f449-4dcb-869a-5317c63bd619", n2);
data.put("fdc9ec54-ff53-4fdb-8239-5a3ac1fb31bd", n4);
data.put("0f9c9b94-02ae-45a6-9d5c-a066dbdf2636", n1);
data.put("d8f1f916-4357-4cfe-a7df-49d4721690bf", n3);
data.put("c77ffeae-78a1-4ee6-a0fd-8d197a794412", n4);
data.put("35de9f21-3c9b-4f4a-a7d5-3e2c6cb01564", n4);
data.put("d67eb652-4e76-47fb-ad4e-cd902d9b868a", n4);
data.put(0, n1);
data.put(1, n4);
data.put(12, n3);
data.put(123, n3);
data.put(1234, n3);
data.put(12345, n4);
data.put(123456, n3);
data.put(1234567, n4);
data.put(12345678, n4);
data.put(123456789, n4);
data.put(1234567890, n3);
data.put(1234567890L, n3);
data.put(12345678901L, n4);
data.put(123456789012L, n2);
data.put(1234567890123L, n4);
data.put(12345678901234L, n1);
data.put(123456789012345L, n1);
data.put(1234567890123456L, n3);
data.put(-23456789012345L, n2);
data.put(-2345678901234L, n1);
data.put(-234567890123L, n4);
data.put(-23456789012L, n3);
data.put(-2345678901L, n3);
data.put(-234567890L, n1);
data.put(-234567890, n4);
data.put(-23456789, n4);
data.put(-2345678, n4);
data.put(-234567, n4);
data.put(-23456, n4);
data.put(-2345, n1);
data.put(-234, n4);
data.put(-23, n3);
data.put(-2, n4);
data.put(0x80000000, n2);
data.put(0x7fffffff, n4);
data.put(0x8000000000000000L, n2);
data.put(0x7fffffffffffffffL, n2);
data.put(+1.1, n1);
data.put(-10.01, n3);
data.put(+100.001, n3);
data.put(-1000.0001, n4);
data.put(+1.7976931348623157E+308, n4);
data.put(-1.7976931348623157E+308, n4);
data.put(+4.9E-324, n4);
data.put(-4.9E-324, n3);
for (Map.Entry<Object, String> entry : data.entrySet())
assertEquals("Validate key '" + entry.getKey() + "'.", entry.getValue(), hash.node(entry.getKey()));
for (Map.Entry<Object, String> entry : data.entrySet())
assertEquals("Validate key '" + entry.getKey() + "'.", entry.getValue(), hash.node(entry.getKey(), nodes));
//
// Change order nodes were added.
//
nodes = new ArrayList<>(nodes);
Collections.reverse(nodes);
// Reset consistent hash with new nodes order.
hash = new GridClientConsistentHash<>();
for (String node : nodes)
hash.addNode(node, 5);
for (Map.Entry<Object, String> entry : data.entrySet())
assertEquals("Validate key '" + entry.getKey() + "'.", entry.getValue(), hash.node(entry.getKey()));
for (Map.Entry<Object, String> entry : data.entrySet())
assertEquals("Validate key '" + entry.getKey() + "'.", entry.getValue(), hash.node(entry.getKey(), nodes));
}
|
void function() { String n1 = STR; String n2 = STR; String n3 = STR; String n4 = STR; List<String> nodes = Arrays.asList(n1, n2, n3, n4); GridClientConsistentHash<String> hash = new GridClientConsistentHash<>(); for (String node : nodes) hash.addNode(node, 5); Map<Object, String> data = new LinkedHashMap<>(); data.put(STRasdfSTR224ea4cd-f449-4dcb-869a-5317c63bd619STRfdc9ec54-ff53-4fdb-8239-5a3ac1fb31bdSTR0f9c9b94-02ae-45a6-9d5c-a066dbdf2636STRd8f1f916-4357-4cfe-a7df-49d4721690bfSTRc77ffeae-78a1-4ee6-a0fd-8d197a794412STR35de9f21-3c9b-4f4a-a7d5-3e2c6cb01564STRd67eb652-4e76-47fb-ad4e-cd902d9b868aSTRValidate key 'STR'.STRValidate key 'STR'.STRValidate key 'STR'.STRValidate key 'STR'.", entry.getValue(), hash.node(entry.getKey(), nodes)); }
|
/**
* Test mapping to nodes.
*/
|
Test mapping to nodes
|
testMappingToNodes
|
{
"repo_name": "ilantukh/ignite",
"path": "modules/clients/src/test/java/org/apache/ignite/internal/client/util/ClientConsistentHashSelfTest.java",
"license": "apache-2.0",
"size": 10424
}
|
[
"java.util.Arrays",
"java.util.LinkedHashMap",
"java.util.List",
"java.util.Map"
] |
import java.util.Arrays; import java.util.LinkedHashMap; import java.util.List; import java.util.Map;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 1,036,407
|
@Override
public String toString() {
return String.format("<PyCursor object at %s>", Py.idstr(this));
}
|
String function() { return String.format(STR, Py.idstr(this)); }
|
/**
* String representation of the object.
*
* @return a string representation of the object.
*/
|
String representation of the object
|
toString
|
{
"repo_name": "alvin319/CarnotKE",
"path": "jyhton/src/com/ziclix/python/sql/PyCursor.java",
"license": "apache-2.0",
"size": 36242
}
|
[
"org.python.core.Py"
] |
import org.python.core.Py;
|
import org.python.core.*;
|
[
"org.python.core"
] |
org.python.core;
| 111,548
|
public BigInteger getCrtCoefficient();
|
BigInteger function();
|
/**
* Returns the CRT coefficient, {@code q^-1 mod p}.
*
* @return the CRT coefficient.
*/
|
Returns the CRT coefficient, q^-1 mod p
|
getCrtCoefficient
|
{
"repo_name": "openweave/openweave-core",
"path": "third_party/android/platform-libcore/android-platform-libcore/luni/src/main/java/java/security/interfaces/RSAMultiPrimePrivateCrtKey.java",
"license": "apache-2.0",
"size": 2588
}
|
[
"java.math.BigInteger"
] |
import java.math.BigInteger;
|
import java.math.*;
|
[
"java.math"
] |
java.math;
| 635,169
|
private void removePropertyFilters() {
PropertyManagement propertyManagement = ServiceLocator.instance().getService(
PropertyManagement.class);
for (PropertyType type : PropertyType.values()) {
try {
propertyManagement.removeObjectPropertyFilter(type, KEY_GROUP, KEY);
} catch (Exception e) {
LOGGER.warn("Filter for property type {} can't be removed.", type);
}
}
}
|
void function() { PropertyManagement propertyManagement = ServiceLocator.instance().getService( PropertyManagement.class); for (PropertyType type : PropertyType.values()) { try { propertyManagement.removeObjectPropertyFilter(type, KEY_GROUP, KEY); } catch (Exception e) { LOGGER.warn(STR, type); } } }
|
/**
* Removes the filter.
*/
|
Removes the filter
|
removePropertyFilters
|
{
"repo_name": "Communote/communote-server",
"path": "communote/plugins/rest-api/test-plugin/src/main/java/com/communote/plugins/api/rest/test/Activator.java",
"license": "apache-2.0",
"size": 7382
}
|
[
"com.communote.server.api.ServiceLocator",
"com.communote.server.api.core.property.PropertyManagement",
"com.communote.server.api.core.property.PropertyType"
] |
import com.communote.server.api.ServiceLocator; import com.communote.server.api.core.property.PropertyManagement; import com.communote.server.api.core.property.PropertyType;
|
import com.communote.server.api.*; import com.communote.server.api.core.property.*;
|
[
"com.communote.server"
] |
com.communote.server;
| 288,850
|
Paint.Style getDecreasingPaintStyle();
|
Paint.Style getDecreasingPaintStyle();
|
/**
* Returns paint style when open > close
*
* @return
*/
|
Returns paint style when open > close
|
getDecreasingPaintStyle
|
{
"repo_name": "xsingHu/xs-android-architecture",
"path": "study-view/xs-MPAndroidChartDemo/MPChartLib/src/main/java/com/github/mikephil/charting/interfaces/datasets/ICandleDataSet.java",
"license": "apache-2.0",
"size": 1623
}
|
[
"android.graphics.Paint"
] |
import android.graphics.Paint;
|
import android.graphics.*;
|
[
"android.graphics"
] |
android.graphics;
| 238,205
|
EAttribute getCategoryDef_Shortname();
|
EAttribute getCategoryDef_Shortname();
|
/**
* Returns the meta object for the attribute '{@link com.euclideanspace.spad.editor.CategoryDef#getShortname <em>Shortname</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the attribute '<em>Shortname</em>'.
* @see com.euclideanspace.spad.editor.CategoryDef#getShortname()
* @see #getCategoryDef()
* @generated
*/
|
Returns the meta object for the attribute '<code>com.euclideanspace.spad.editor.CategoryDef#getShortname Shortname</code>'.
|
getCategoryDef_Shortname
|
{
"repo_name": "martinbaker/euclideanspace",
"path": "com.euclideanspace.spad/src-gen/com/euclideanspace/spad/editor/EditorPackage.java",
"license": "agpl-3.0",
"size": 593321
}
|
[
"org.eclipse.emf.ecore.EAttribute"
] |
import org.eclipse.emf.ecore.EAttribute;
|
import org.eclipse.emf.ecore.*;
|
[
"org.eclipse.emf"
] |
org.eclipse.emf;
| 1,228,500
|
private String[] listInternal(String path, boolean recursive) throws IOException {
path = stripPrefixIfPresent(path);
path = PathUtils.normalizePath(path, PATH_SEPARATOR);
path = path.equals(PATH_SEPARATOR) ? "" : path;
String delimiter = recursive ? "" : PATH_SEPARATOR;
Set<String> children = new HashSet<>();
try {
ListObjectsV2Request request =
new ListObjectsV2Request().withBucketName(mBucketName).withPrefix(path)
.withDelimiter(delimiter).withMaxKeys(LISTING_LENGTH);
ListObjectsV2Result result = null;
while (result == null || result.isTruncated()) {
// Query S3 for the next batch of objects
result = mClient.listObjectsV2(request);
// Advance the request continuation token to the next set of objects
request.setContinuationToken(result.getNextContinuationToken());
// Directories in S3 UFS can be possibly encoded in two different ways:
// (1) as file objects with FOLDER_SUFFIX for directories created through Alluxio or
// (2) as "common prefixes" of other files objects for directories not created through
// Alluxio
//
// Case (1) (and file objects) is accounted for by iterating over chunk.getObjects() while
// case (2) is accounted for by iterating over chunk.getCommonPrefixes().
//
// An example, with prefix="ufs" and delimiter="/" and LISTING_LENGTH=5
// - objects.key = ufs/, child =
// - objects.key = ufs/dir1_$folder$, child = dir1
// - objects.key = ufs/file, child = file
// - commonPrefix = ufs/dir1/, child = dir1
// - commonPrefix = ufs/dir2/, child = dir2
// Handle case (1)
for (S3ObjectSummary obj : result.getObjectSummaries()) {
// Remove parent portion of the key
String child = getChildName(obj.getKey(), path);
// Prune the special folder suffix
child = CommonUtils.stripSuffixIfPresent(child, FOLDER_SUFFIX);
// Only add if the path is not empty (removes results equal to the path)
if (!child.isEmpty()) {
children.add(child);
}
}
// Handle case (2)
for (String commonPrefix : result.getCommonPrefixes()) {
// Remove parent portion of the key
String child = getChildName(commonPrefix, path);
if (child != null) {
// Remove any portion after the last path delimiter
int childNameIndex = child.lastIndexOf(PATH_SEPARATOR);
child = childNameIndex != -1 ? child.substring(0, childNameIndex) : child;
if (!child.isEmpty() && !children.contains(child)) {
// This directory has not been created through Alluxio.
mkdirsInternal(commonPrefix);
children.add(child);
}
}
}
}
return children.toArray(new String[children.size()]);
} catch (AmazonClientException e) {
LOG.error("Failed to list path {}", path, e);
return null;
}
}
|
String[] function(String path, boolean recursive) throws IOException { path = stripPrefixIfPresent(path); path = PathUtils.normalizePath(path, PATH_SEPARATOR); path = path.equals(PATH_SEPARATOR) ? STRSTRFailed to list path {}", path, e); return null; } }
|
/**
* Lists the files in the given path, the paths will be their logical names and not contain the
* folder suffix. Note that, the list results are unsorted.
*
* @param path the key to list
* @param recursive if true will list children directories as well
* @return an array of the file and folder names in this directory
* @throws IOException if an I/O error occurs
*/
|
Lists the files in the given path, the paths will be their logical names and not contain the folder suffix. Note that, the list results are unsorted
|
listInternal
|
{
"repo_name": "bit-zyl/Alluxio-Nvdimm",
"path": "underfs/s3a/src/main/java/alluxio/underfs/s3a/S3AUnderFileSystem.java",
"license": "apache-2.0",
"size": 30027
}
|
[
"java.io.IOException"
] |
import java.io.IOException;
|
import java.io.*;
|
[
"java.io"
] |
java.io;
| 403,695
|
public static <T> List<T> assertListSize(List<T> list, int size) {
return assertListSize("List", list, size);
}
|
static <T> List<T> function(List<T> list, int size) { return assertListSize("List", list, size); }
|
/**
* Asserts that a list is of the given size
*/
|
Asserts that a list is of the given size
|
assertListSize
|
{
"repo_name": "kingargyle/turmeric-bot",
"path": "components/camel-test/src/main/java/org/apache/camel/test/junit4/TestSupport.java",
"license": "apache-2.0",
"size": 17638
}
|
[
"java.util.List"
] |
import java.util.List;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 1,037,581
|
public List<StorageAccount> storageaccounts() {
return this.storageaccounts;
}
|
List<StorageAccount> function() { return this.storageaccounts; }
|
/**
* Get the list of storage accounts in the cluster.
*
* @return the storageaccounts value
*/
|
Get the list of storage accounts in the cluster
|
storageaccounts
|
{
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/hdinsight/mgmt-v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/StorageProfile.java",
"license": "mit",
"size": 1178
}
|
[
"java.util.List"
] |
import java.util.List;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 2,739,409
|
public CarrierInfo getCarrierInfo() {
return carrierInfo;
}
|
CarrierInfo function() { return carrierInfo; }
|
/**
* Get the unit that is transferring the commander.
*
* @return the unit that is transferring the commander.
*/
|
Get the unit that is transferring the commander
|
getCarrierInfo
|
{
"repo_name": "EaW1805/data",
"path": "src/main/java/com/eaw1805/data/model/army/Commander.java",
"license": "mit",
"size": 12958
}
|
[
"com.eaw1805.data.model.map.CarrierInfo"
] |
import com.eaw1805.data.model.map.CarrierInfo;
|
import com.eaw1805.data.model.map.*;
|
[
"com.eaw1805.data"
] |
com.eaw1805.data;
| 1,791,650
|
@Test
public void isCellEditable()
{
assertFalse(_tableModel.isCellEditable(0, 0));
assertFalse(_tableModel.isCellEditable(0, 1));
assertTrue(_tableModel.isCellEditable(0, 2));
}
|
void function() { assertFalse(_tableModel.isCellEditable(0, 0)); assertFalse(_tableModel.isCellEditable(0, 1)); assertTrue(_tableModel.isCellEditable(0, 2)); }
|
/**
* Test the <code>isCellEditable()</code> method.
*/
|
Test the <code>isCellEditable()</code> method
|
isCellEditable
|
{
"repo_name": "jmthompson2015/rivalry",
"path": "swingui/src/test/java/org/rivalry/swingui/table/CriterionTableModelTest.java",
"license": "mit",
"size": 4617
}
|
[
"org.junit.Assert"
] |
import org.junit.Assert;
|
import org.junit.*;
|
[
"org.junit"
] |
org.junit;
| 2,873,762
|
public void loadFromNodeSettings(NodeSettingsRO settings) {
id = SettingsHelper.getInteger("ID", settings);
name = SettingsHelper.getString("Name", settings);
comment = SettingsHelper.getString("Comment", settings);
qualityScore = SettingsHelper.getInteger("QualityScore", settings);
checked = SettingsHelper.getBoolean("Checked", settings);
}
|
void function(NodeSettingsRO settings) { id = SettingsHelper.getInteger("ID", settings); name = SettingsHelper.getString("Name", settings); comment = SettingsHelper.getString(STR, settings); qualityScore = SettingsHelper.getInteger(STR, settings); checked = SettingsHelper.getBoolean(STR, settings); }
|
/**
* Loads model info properties from a {@link NodeSettingsRO} with properties:
* <ul>
* <li>Integer "ID"
* <li>String "Name"
* <li>String "Comment"
* <li>String "QualityScore"
* <li>String "Checked"
* </ul>
*/
|
Loads model info properties from a <code>NodeSettingsRO</code> with properties: Integer "ID" String "Name" String "Comment" String "QualityScore" String "Checked"
|
loadFromNodeSettings
|
{
"repo_name": "SiLeBAT/FSK-Lab",
"path": "de.bund.bfr.knime.pmm.nodes/src/de/bund/bfr/knime/pmm/js/common/MdInfo.java",
"license": "gpl-3.0",
"size": 2518
}
|
[
"org.knime.core.node.NodeSettingsRO"
] |
import org.knime.core.node.NodeSettingsRO;
|
import org.knime.core.node.*;
|
[
"org.knime.core"
] |
org.knime.core;
| 816,233
|
public Shape modelToView(int pos, Shape a, Position.Bias b)
throws BadLocationException
{
int p0 = getStartOffset();
int p1 = getEndOffset();
if((pos >= p0) && (pos <= p1))
{
Rectangle r = a.getBounds();
if(pos == p1)
{
r.x += r.width;
}
r.width = 0;
return r;
}
return null;
}
|
Shape function(int pos, Shape a, Position.Bias b) throws BadLocationException { int p0 = getStartOffset(); int p1 = getEndOffset(); if((pos >= p0) && (pos <= p1)) { Rectangle r = a.getBounds(); if(pos == p1) { r.x += r.width; } r.width = 0; return r; } return null; }
|
/** Provides a mapping from the document model coordinate space
* to the coordinate space of the view mapped to it.
*
* @param pos the position to convert
* @param a the allocated region to render into
* @return the bounding box of the given position
* @exception BadLocationException if the given position does not represent a
* valid location in the associated document
* @see View#modelToView
*/
|
Provides a mapping from the document model coordinate space to the coordinate space of the view mapped to it
|
modelToView
|
{
"repo_name": "Esleelkartea/hermes",
"path": "hermes_v1.0.0_src/bgc/gui/wysiwyg/draganddrop/clases/RelativeImageView.java",
"license": "gpl-2.0",
"size": 22843
}
|
[
"java.awt.Rectangle",
"java.awt.Shape",
"javax.swing.text.BadLocationException",
"javax.swing.text.Position"
] |
import java.awt.Rectangle; import java.awt.Shape; import javax.swing.text.BadLocationException; import javax.swing.text.Position;
|
import java.awt.*; import javax.swing.text.*;
|
[
"java.awt",
"javax.swing"
] |
java.awt; javax.swing;
| 1,084,430
|
public Container read(int type, int file, int[] keys) throws IOException {
if (type == 255)
throw new IOException("Reference tables can only be read with the low level FileStore API!");
return Container.decode(store.read(type, file), keys);
}
|
Container function(int type, int file, int[] keys) throws IOException { if (type == 255) throw new IOException(STR); return Container.decode(store.read(type, file), keys); }
|
/**
* Reads a file from the cache.
*
* @param type
* The type of file.
* @param file
* The file id.
* @param keys
* The decryption keys.
* @return The file.
* @throws IOException
* if an I/O error occurred.
*/
|
Reads a file from the cache
|
read
|
{
"repo_name": "im-frizzy/OpenRS",
"path": "source/net/openrs/cache/Cache.java",
"license": "gpl-3.0",
"size": 14410
}
|
[
"java.io.IOException"
] |
import java.io.IOException;
|
import java.io.*;
|
[
"java.io"
] |
java.io;
| 9,790
|
void setChannelAcquisitionData(int index, ChannelAcquisitionData data)
{
if (channelAcquisitionDataMap == null)
channelAcquisitionDataMap = new HashMap<Integer,
ChannelAcquisitionData>();
channelAcquisitionDataMap.put(index, data);
}
|
void setChannelAcquisitionData(int index, ChannelAcquisitionData data) { if (channelAcquisitionDataMap == null) channelAcquisitionDataMap = new HashMap<Integer, ChannelAcquisitionData>(); channelAcquisitionDataMap.put(index, data); }
|
/**
* Sets the acquisition data for the specified channel.
*
* @param index The index of the channel.
* @param data The value to set.
*/
|
Sets the acquisition data for the specified channel
|
setChannelAcquisitionData
|
{
"repo_name": "dpwrussell/openmicroscopy",
"path": "components/insight/SRC/org/openmicroscopy/shoola/agents/metadata/editor/EditorModel.java",
"license": "gpl-2.0",
"size": 130987
}
|
[
"java.util.HashMap"
] |
import java.util.HashMap;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 2,735,762
|
@Nullable
public CertificateBasedAuthConfiguration post(@Nonnull final CertificateBasedAuthConfiguration newCertificateBasedAuthConfiguration) throws ClientException {
return send(HttpMethod.POST, newCertificateBasedAuthConfiguration);
}
|
CertificateBasedAuthConfiguration function(@Nonnull final CertificateBasedAuthConfiguration newCertificateBasedAuthConfiguration) throws ClientException { return send(HttpMethod.POST, newCertificateBasedAuthConfiguration); }
|
/**
* Creates a CertificateBasedAuthConfiguration with a new object
*
* @param newCertificateBasedAuthConfiguration the new object to create
* @return the created CertificateBasedAuthConfiguration
* @throws ClientException this exception occurs if the request was unable to complete for any reason
*/
|
Creates a CertificateBasedAuthConfiguration with a new object
|
post
|
{
"repo_name": "microsoftgraph/msgraph-sdk-java",
"path": "src/main/java/com/microsoft/graph/requests/CertificateBasedAuthConfigurationRequest.java",
"license": "mit",
"size": 6929
}
|
[
"com.microsoft.graph.core.ClientException",
"com.microsoft.graph.http.HttpMethod",
"com.microsoft.graph.models.CertificateBasedAuthConfiguration",
"javax.annotation.Nonnull"
] |
import com.microsoft.graph.core.ClientException; import com.microsoft.graph.http.HttpMethod; import com.microsoft.graph.models.CertificateBasedAuthConfiguration; import javax.annotation.Nonnull;
|
import com.microsoft.graph.core.*; import com.microsoft.graph.http.*; import com.microsoft.graph.models.*; import javax.annotation.*;
|
[
"com.microsoft.graph",
"javax.annotation"
] |
com.microsoft.graph; javax.annotation;
| 703,614
|
public CreatedByType createdByType() {
return this.createdByType;
}
|
CreatedByType function() { return this.createdByType; }
|
/**
* Get the createdByType property: The type of identity that created the resource.
*
* @return the createdByType value.
*/
|
Get the createdByType property: The type of identity that created the resource
|
createdByType
|
{
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/azurestackhci/azure-resourcemanager-azurestackhci/src/main/java/com/azure/resourcemanager/azurestackhci/fluent/models/ClusterInner.java",
"license": "mit",
"size": 11648
}
|
[
"com.azure.resourcemanager.azurestackhci.models.CreatedByType"
] |
import com.azure.resourcemanager.azurestackhci.models.CreatedByType;
|
import com.azure.resourcemanager.azurestackhci.models.*;
|
[
"com.azure.resourcemanager"
] |
com.azure.resourcemanager;
| 2,787,363
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.