method
stringlengths 13
441k
| clean_method
stringlengths 7
313k
| doc
stringlengths 17
17.3k
| comment
stringlengths 3
1.42k
| method_name
stringlengths 1
273
| extra
dict | imports
sequence | imports_info
stringlengths 19
34.8k
| cluster_imports_info
stringlengths 15
3.66k
| libraries
sequence | libraries_info
stringlengths 6
661
| id
int64 0
2.92M
|
---|---|---|---|---|---|---|---|---|---|---|---|
WithStandardAttach<ParentT> withGeoFilter(String relativePath, GeoFilterActions action, Collection<CountryIsoCode> countryCodes); | WithStandardAttach<ParentT> withGeoFilter(String relativePath, GeoFilterActions action, Collection<CountryIsoCode> countryCodes); | /**
* Sets the geo filters list for the specified countries list.
*
* @param relativePath a relative path
* @param action an action value
* @param countryCodes a list of the ISO 2 letter country codes.
* @return the next stage of the definition
*/ | Sets the geo filters list for the specified countries list | withGeoFilter | {
"repo_name": "jianghaolu/azure-sdk-for-java",
"path": "azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/CdnEndpoint.java",
"license": "mit",
"size": 38532
} | [
"com.microsoft.azure.management.resources.fluentcore.arm.CountryIsoCode",
"java.util.Collection"
] | import com.microsoft.azure.management.resources.fluentcore.arm.CountryIsoCode; import java.util.Collection; | import com.microsoft.azure.management.resources.fluentcore.arm.*; import java.util.*; | [
"com.microsoft.azure",
"java.util"
] | com.microsoft.azure; java.util; | 2,310,011 |
public ILibrariesList onLibrariesListEnd() throws SAXException {
return new LibrariesList(libraries);
}
| ILibrariesList function() throws SAXException { return new LibrariesList(libraries); } | /**
* Parse <libraries-list>.
*
* @return instruction list.
* @throws SAXException
* parse errors.
*/ | Parse <libraries-list> | onLibrariesListEnd | {
"repo_name": "Nauja/Minecraft-NaujaModManager",
"path": "org/minecraftnauja/manager/xml/UpdateHandler.java",
"license": "gpl-3.0",
"size": 11547
} | [
"org.minecraftnauja.manager.xml.library.ILibrariesList",
"org.minecraftnauja.manager.xml.library.LibrariesList",
"org.xml.sax.SAXException"
] | import org.minecraftnauja.manager.xml.library.ILibrariesList; import org.minecraftnauja.manager.xml.library.LibrariesList; import org.xml.sax.SAXException; | import org.minecraftnauja.manager.xml.library.*; import org.xml.sax.*; | [
"org.minecraftnauja.manager",
"org.xml.sax"
] | org.minecraftnauja.manager; org.xml.sax; | 480,470 |
public void change(ChangeEvent event);
}
public static class ClickEvent extends MouseEvents.ClickEvent {
private int index;
public ClickEvent(long timestamp, ImageSequenceTile source, MouseEventDetails mouseEventDetails, int index) {
super(timestamp, source, mouseEventDetails);
this.index = index;
} | void function(ChangeEvent event); } public static class ClickEvent extends MouseEvents.ClickEvent { private int index; public ClickEvent(long timestamp, ImageSequenceTile source, MouseEventDetails mouseEventDetails, int index) { super(timestamp, source, mouseEventDetails); this.index = index; } | /**
* Called when an image of {@link ImageSequenceTile} has been changed. A
* reference to the tile is given by {@link ChangeEvent#getTile()}.
*
* @param event
* An event containing information about the click.
*/ | Called when an image of <code>ImageSequenceTile</code> has been changed. A reference to the tile is given by <code>ChangeEvent#getTile()</code> | change | {
"repo_name": "tilioteo/vmaps",
"path": "src/main/java/org/vaadin/maps/ui/tile/ImageSequenceTile.java",
"license": "apache-2.0",
"size": 9483
} | [
"com.vaadin.shared.MouseEventDetails",
"org.vaadin.maps.event.MouseEvents"
] | import com.vaadin.shared.MouseEventDetails; import org.vaadin.maps.event.MouseEvents; | import com.vaadin.shared.*; import org.vaadin.maps.event.*; | [
"com.vaadin.shared",
"org.vaadin.maps"
] | com.vaadin.shared; org.vaadin.maps; | 204,442 |
public static ResultSet polar2Cartesian(Double r, Double alpha) {
SimpleResultSet rs = new SimpleResultSet();
rs.addColumn("X", Types.DOUBLE, 0, 0);
rs.addColumn("Y", Types.DOUBLE, 0, 0);
if (r != null && alpha != null) {
double x = r.doubleValue() * Math.cos(alpha.doubleValue());
double y = r.doubleValue() * Math.sin(alpha.doubleValue());
rs.addRow(x, y);
}
return rs;
} | static ResultSet function(Double r, Double alpha) { SimpleResultSet rs = new SimpleResultSet(); rs.addColumn("X", Types.DOUBLE, 0, 0); rs.addColumn("Y", Types.DOUBLE, 0, 0); if (r != null && alpha != null) { double x = r.doubleValue() * Math.cos(alpha.doubleValue()); double y = r.doubleValue() * Math.sin(alpha.doubleValue()); rs.addRow(x, y); } return rs; } | /**
* Convert polar coordinates to cartesian coordinates. The function may be
* called twice, once to retrieve the result columns (with null parameters),
* and the second time to return the data.
*
* @param r the distance from the point 0/0
* @param alpha the angle
* @return a result set with two columns: x and y
*/ | Convert polar coordinates to cartesian coordinates. The function may be called twice, once to retrieve the result columns (with null parameters), and the second time to return the data | polar2Cartesian | {
"repo_name": "miloszpiglas/h2mod",
"path": "src/test/org/h2/samples/FunctionMultiReturn.java",
"license": "mpl-2.0",
"size": 6168
} | [
"java.sql.ResultSet",
"java.sql.Types",
"org.h2.tools.SimpleResultSet"
] | import java.sql.ResultSet; import java.sql.Types; import org.h2.tools.SimpleResultSet; | import java.sql.*; import org.h2.tools.*; | [
"java.sql",
"org.h2.tools"
] | java.sql; org.h2.tools; | 2,296,665 |
protected IFigure setupContentPane(IFigure nodeShape) {
return nodeShape; // use nodeShape itself as contentPane
} | IFigure function(IFigure nodeShape) { return nodeShape; } | /**
* Default implementation treats passed figure as content pane.
* Respects layout one may have set for generated figure.
*
* @param nodeShape instance of generated figure class
* @generated
*/ | Default implementation treats passed figure as content pane. Respects layout one may have set for generated figure | setupContentPane | {
"repo_name": "prabushi/devstudio-tooling-esb",
"path": "plugins/org.wso2.developerstudio.eclipse.gmf.esb.diagram/src/org/wso2/developerstudio/eclipse/gmf/esb/diagram/edit/parts/FailoverEndPointWestOutputConnector2EditPart.java",
"license": "apache-2.0",
"size": 20649
} | [
"org.eclipse.draw2d.IFigure"
] | import org.eclipse.draw2d.IFigure; | import org.eclipse.draw2d.*; | [
"org.eclipse.draw2d"
] | org.eclipse.draw2d; | 1,830,982 |
public JSONObject buildTable(String headerNames, HttpServletRequest req) throws JSONException
{
List<String> colHeaderNames= new ArrayList<String>();
List<Boolean> sortableList = new ArrayList<Boolean>();
List<String> colTypes= new ArrayList<String>();
List<String> celTemplate= new ArrayList<String>();
for(String c:headerNames.split(","))
{
colHeaderNames.add(c);
colTypes.add("string");
sortableList.add(true);
}
return buildTable(colHeaderNames,sortableList,colTypes,celTemplate,req);
} | JSONObject function(String headerNames, HttpServletRequest req) throws JSONException { List<String> colHeaderNames= new ArrayList<String>(); List<Boolean> sortableList = new ArrayList<Boolean>(); List<String> colTypes= new ArrayList<String>(); List<String> celTemplate= new ArrayList<String>(); for(String c:headerNames.split(",")) { colHeaderNames.add(c); colTypes.add(STR); sortableList.add(true); } return buildTable(colHeaderNames,sortableList,colTypes,celTemplate,req); } | /**
*
* String only!!
* @param headerNames : comma separated list...all sortable
* @param req
* @return
* @throws JSONException
*/ | String only! | buildTable | {
"repo_name": "ui-icts/sispotr-project",
"path": "base/src/main/java/edu/uiowa/icts/safeseed/DataTablesProcessor.java",
"license": "apache-2.0",
"size": 6142
} | [
"java.util.ArrayList",
"java.util.List",
"javax.servlet.http.HttpServletRequest",
"org.json.JSONException",
"org.json.JSONObject"
] | import java.util.ArrayList; import java.util.List; import javax.servlet.http.HttpServletRequest; import org.json.JSONException; import org.json.JSONObject; | import java.util.*; import javax.servlet.http.*; import org.json.*; | [
"java.util",
"javax.servlet",
"org.json"
] | java.util; javax.servlet; org.json; | 554,515 |
public static <T> boolean isEmpty(final Collection<T> source) {
boolean isEmpty = false;
isEmpty = (null == source || source.isEmpty());
return isEmpty;
} | static <T> boolean function(final Collection<T> source) { boolean isEmpty = false; isEmpty = (null == source source.isEmpty()); return isEmpty; } | /**
* Checks whether the passed collection is NULL or is empty.
*
* @param <T> type of data
* @param source collection to be checked for emptiness.
* @return true if passed collection is empty otherwise false.
*/ | Checks whether the passed collection is NULL or is empty | isEmpty | {
"repo_name": "ungerik/ephesoft",
"path": "Ephesoft_Community_Release_4.0.2.0/source/dcma-util/src/main/java/com/ephesoft/dcma/util/CollectionUtil.java",
"license": "agpl-3.0",
"size": 12756
} | [
"java.util.Collection"
] | import java.util.Collection; | import java.util.*; | [
"java.util"
] | java.util; | 631,216 |
protected List<VaultEntry> setUpBeforeFilter(List<VaultEntry> data) {
return data;
}
| List<VaultEntry> function(List<VaultEntry> data) { return data; } | /**
* This method is run before the core filter process starts and CAN be
* overridden if the specific filter needs to prepare the given entry data
* to be filtered.<p>
* If other preparations are necessary, which don't affect the given entry
* data, just return it as it is.
*
* @param data the given initial entry data
* @return modified or unmodified entry data
*/ | This method is run before the core filter process starts and CAN be overridden if the specific filter needs to prepare the given entry data to be filtered. If other preparations are necessary, which don't affect the given entry data, just return it as it is | setUpBeforeFilter | {
"repo_name": "OpenDiabetes/OpenDiabetesVault",
"path": "src/de/opendiabetes/vault/processing/filter/Filter.java",
"license": "agpl-3.0",
"size": 5208
} | [
"de.opendiabetes.vault.data.container.VaultEntry",
"java.util.List"
] | import de.opendiabetes.vault.data.container.VaultEntry; import java.util.List; | import de.opendiabetes.vault.data.container.*; import java.util.*; | [
"de.opendiabetes.vault",
"java.util"
] | de.opendiabetes.vault; java.util; | 2,555,240 |
public static Function<Object,List<String>> methodForListOfString(final String methodName, final Object... optionalParameters) {
return new Call<Object,List<String>>(Types.LIST_OF_STRING, methodName, VarArgsUtil.asOptionalObjectArray(Object.class,optionalParameters));
}
| static Function<Object,List<String>> function(final String methodName, final Object... optionalParameters) { return new Call<Object,List<String>>(Types.LIST_OF_STRING, methodName, VarArgsUtil.asOptionalObjectArray(Object.class,optionalParameters)); } | /**
* <p>
* Executes a method on the target object which returns List<String>. Parameters must match
* those of the method.
* </p>
*
* @param methodName the name of the method
* @param optionalParameters the (optional) parameters of the method.
* @return the result of the method execution
*/ | Executes a method on the target object which returns List<String>. Parameters must match those of the method. | methodForListOfString | {
"repo_name": "op4j/op4j",
"path": "src/main/java/org/op4j/functions/Call.java",
"license": "apache-2.0",
"size": 27542
} | [
"java.util.List",
"org.javaruntype.type.Types",
"org.op4j.util.VarArgsUtil"
] | import java.util.List; import org.javaruntype.type.Types; import org.op4j.util.VarArgsUtil; | import java.util.*; import org.javaruntype.type.*; import org.op4j.util.*; | [
"java.util",
"org.javaruntype.type",
"org.op4j.util"
] | java.util; org.javaruntype.type; org.op4j.util; | 2,544,173 |
@Override
public int authenticate(HttpServerExchange httpExchange, List<String> allowedRoles) throws Exception {
SecurityIdentity identity = this.securityDomain.getCurrentSecurityIdentity();
if (identity != null) {
//already authenticated
Set<String> roles = new HashSet<>();
Roles identityRoles = identity.getRoles();
if (identityRoles != null) {
for (String roleName : identityRoles) {
roles.add(roleName);
}
}
if (isAllowed(roles, allowedRoles)) {
return StatusCodes.OK;
}
}
return StatusCodes.FORBIDDEN;
} | int function(HttpServerExchange httpExchange, List<String> allowedRoles) throws Exception { SecurityIdentity identity = this.securityDomain.getCurrentSecurityIdentity(); if (identity != null) { Set<String> roles = new HashSet<>(); Roles identityRoles = identity.getRoles(); if (identityRoles != null) { for (String roleName : identityRoles) { roles.add(roleName); } } if (isAllowed(roles, allowedRoles)) { return StatusCodes.OK; } } return StatusCodes.FORBIDDEN; } | /**
* Authentication is verified by securityDomain from configuration.
*/ | Authentication is verified by securityDomain from configuration | authenticate | {
"repo_name": "DariusX/camel",
"path": "components/camel-elytron/src/main/java/org/apache/camel/component/elytron/ElytronSecurityProvider.java",
"license": "apache-2.0",
"size": 6875
} | [
"io.undertow.server.HttpServerExchange",
"io.undertow.util.StatusCodes",
"java.util.HashSet",
"java.util.List",
"java.util.Set",
"org.wildfly.security.auth.server.SecurityIdentity",
"org.wildfly.security.authz.Roles"
] | import io.undertow.server.HttpServerExchange; import io.undertow.util.StatusCodes; import java.util.HashSet; import java.util.List; import java.util.Set; import org.wildfly.security.auth.server.SecurityIdentity; import org.wildfly.security.authz.Roles; | import io.undertow.server.*; import io.undertow.util.*; import java.util.*; import org.wildfly.security.auth.server.*; import org.wildfly.security.authz.*; | [
"io.undertow.server",
"io.undertow.util",
"java.util",
"org.wildfly.security"
] | io.undertow.server; io.undertow.util; java.util; org.wildfly.security; | 1,444,078 |
public static RedSandstoneStairsMat getRedSandstoneStairs(final BlockFace blockFace, final boolean upsideDown)
{
return getByID(StairsMat.combine(blockFace, upsideDown));
} | static RedSandstoneStairsMat function(final BlockFace blockFace, final boolean upsideDown) { return getByID(StairsMat.combine(blockFace, upsideDown)); } | /**
* Returns one of RedSandstoneStairs sub-type based on facing direction and upside-down state.
* It will never return null.
*
* @param blockFace facing direction of stairs.
* @param upsideDown if stairs should be upside-down.
*
* @return sub-type of RedSandstoneStairs
*/ | Returns one of RedSandstoneStairs sub-type based on facing direction and upside-down state. It will never return null | getRedSandstoneStairs | {
"repo_name": "joda17/Diorite-API",
"path": "src/main/java/org/diorite/material/blocks/stony/RedSandstoneStairsMat.java",
"license": "mit",
"size": 7654
} | [
"org.diorite.BlockFace",
"org.diorite.material.blocks.StairsMat"
] | import org.diorite.BlockFace; import org.diorite.material.blocks.StairsMat; | import org.diorite.*; import org.diorite.material.blocks.*; | [
"org.diorite",
"org.diorite.material"
] | org.diorite; org.diorite.material; | 1,286,133 |
@LogMessage(level = INFO)
@Message(id = 42, value = "Started message driven bean '%s' with '%s' resource adapter")
void logMDBStart(final String mdbName, final String raName); | @LogMessage(level = INFO) @Message(id = 42, value = STR) void logMDBStart(final String mdbName, final String raName); | /**
* Logs a message which includes the resource adapter name and the destination on which a message driven bean
* is listening
*
* @param mdbName The message driven bean name
* @param raName The resource adapter name
*/ | Logs a message which includes the resource adapter name and the destination on which a message driven bean is listening | logMDBStart | {
"repo_name": "99sono/wildfly",
"path": "ejb3/src/main/java/org/jboss/as/ejb3/logging/EjbLogger.java",
"license": "lgpl-2.1",
"size": 144385
} | [
"org.jboss.logging.annotations.LogMessage",
"org.jboss.logging.annotations.Message"
] | import org.jboss.logging.annotations.LogMessage; import org.jboss.logging.annotations.Message; | import org.jboss.logging.annotations.*; | [
"org.jboss.logging"
] | org.jboss.logging; | 2,045,590 |
@Test
public void testPeek() {
ArrayBasedStack stack = new ArrayBasedStack(10);
Assert.assertTrue(stack.isEmpty());
Assert.assertTrue(stack.size() == 0);
stack.push(3);
stack.push(17);
stack.push(35);
stack.push(13);
Assert.assertTrue(stack.size() == 4);
Assert.assertEquals(stack.peek(), 13);
Assert.assertTrue(stack.size() == 4);
stack.pop();
Assert.assertTrue(stack.size() == 3);
Assert.assertEquals(stack.peek(), 35);
} | void function() { ArrayBasedStack stack = new ArrayBasedStack(10); Assert.assertTrue(stack.isEmpty()); Assert.assertTrue(stack.size() == 0); stack.push(3); stack.push(17); stack.push(35); stack.push(13); Assert.assertTrue(stack.size() == 4); Assert.assertEquals(stack.peek(), 13); Assert.assertTrue(stack.size() == 4); stack.pop(); Assert.assertTrue(stack.size() == 3); Assert.assertEquals(stack.peek(), 35); } | /**
* Test case for peek feature
*/ | Test case for peek feature | testPeek | {
"repo_name": "deepak-malik/Data-Structures-In-Java",
"path": "test/com/deepak/data/structures/Stack/ArrayBasedStackTest.java",
"license": "mit",
"size": 1608
} | [
"org.junit.Assert"
] | import org.junit.Assert; | import org.junit.*; | [
"org.junit"
] | org.junit; | 2,434,455 |
private static boolean allowedToExit() {
// Check background jobs
final int jobsCount = Env.JOBS.getJobsCount();
if ( jobsCount > 0 )
if ( !GuiUtils.confirm(
( jobsCount == 1 ? "There is" : "There are" ) + Utils.plural( " %s running job%s! Are you sure you want to exit?", jobsCount ), " ",
GuiUtils.linkForAction( "View Running Jobs...", Actions.RUNNING_JOBS ) ) )
return false;
return true;
}
| static boolean function() { final int jobsCount = Env.JOBS.getJobsCount(); if ( jobsCount > 0 ) if ( !GuiUtils.confirm( ( jobsCount == 1 ? STR : STR ) + Utils.plural( STR, jobsCount ), " ", GuiUtils.linkForAction( STR, Actions.RUNNING_JOBS ) ) ) return false; return true; } | /**
* Tells if exit is allowed.
*
* @return true if exit is allowed; false otherwise
*/ | Tells if exit is allowed | allowedToExit | {
"repo_name": "icza/scelight",
"path": "src-app/hu/scelight/Scelight.java",
"license": "apache-2.0",
"size": 4791
} | [
"hu.scelight.action.Actions",
"hu.scelight.service.env.Env",
"hu.scelight.util.Utils",
"hu.scelight.util.gui.GuiUtils"
] | import hu.scelight.action.Actions; import hu.scelight.service.env.Env; import hu.scelight.util.Utils; import hu.scelight.util.gui.GuiUtils; | import hu.scelight.action.*; import hu.scelight.service.env.*; import hu.scelight.util.*; import hu.scelight.util.gui.*; | [
"hu.scelight.action",
"hu.scelight.service",
"hu.scelight.util"
] | hu.scelight.action; hu.scelight.service; hu.scelight.util; | 2,212,776 |
public static void ExtractAndReturn(final Context context,
long startTimeInMillis, long endTimeInMillis,
OnImagePathExtractedListner listner) {
ArrayList<ImageDetails> paths = new ArrayList<ImageDetails>();
String tempPath;
boolean isSelected = false;
long tempDeltaTime;
boolean shouldCopy = true;
String[] projection = new String[] {
MediaStore.Images.ImageColumns._ID,
MediaStore.Images.ImageColumns.DATA,// will get path
MediaStore.Images.ImageColumns.BUCKET_DISPLAY_NAME,
MediaStore.Images.ImageColumns.DATE_TAKEN,
MediaStore.Images.ImageColumns.MIME_TYPE,
MediaStore.Images.ImageColumns.TITLE };
// Extract images taken between startTime and endTime (During recording)
String query = MediaStore.Images.ImageColumns.DATE_TAKEN + " > "
+ startTimeInMillis + " AND "
+ MediaStore.Images.ImageColumns.DATE_TAKEN + " < "
+ endTimeInMillis;
final Cursor cursor = context.getContentResolver().query(
MediaStore.Images.Media.EXTERNAL_CONTENT_URI, projection,
query, null,
MediaStore.Images.ImageColumns.DATE_TAKEN + " DESC");
// Only if cursor is moved to first and cursor is not empty
// Ex:- When no images were taken between the given time.
if (cursor.moveToFirst() && cursor.getCount() != 0) {
do {
ImageDetails imgdetails;
tempDeltaTime = cursor
.getLong(cursor
.getColumnIndex(MediaStore.Images.ImageColumns.DATE_TAKEN))
- startTimeInMillis;
tempPath = cursor.getString(cursor
.getColumnIndex(MediaStore.Images.ImageColumns.DATA));
shouldCopy = true;
imgdetails = new ImageDetails(tempPath, tempDeltaTime,
shouldCopy, isSelected);
paths.add(imgdetails);
} while (cursor.moveToNext());
if (!paths.isEmpty()) {
// If last recording images paths still exists clear.
ImageApplication.fromRecorderPaths = null;
// Assign newly taken Images
ImageApplication.fromRecorderPaths = paths;
listner.onLoaded(true);
} else {
// No images were taken during the recording
listner.onLoaded(false);
}
}
} | static void function(final Context context, long startTimeInMillis, long endTimeInMillis, OnImagePathExtractedListner listner) { ArrayList<ImageDetails> paths = new ArrayList<ImageDetails>(); String tempPath; boolean isSelected = false; long tempDeltaTime; boolean shouldCopy = true; String[] projection = new String[] { MediaStore.Images.ImageColumns._ID, MediaStore.Images.ImageColumns.DATA, MediaStore.Images.ImageColumns.BUCKET_DISPLAY_NAME, MediaStore.Images.ImageColumns.DATE_TAKEN, MediaStore.Images.ImageColumns.MIME_TYPE, MediaStore.Images.ImageColumns.TITLE }; String query = MediaStore.Images.ImageColumns.DATE_TAKEN + STR + startTimeInMillis + STR + MediaStore.Images.ImageColumns.DATE_TAKEN + STR + endTimeInMillis; final Cursor cursor = context.getContentResolver().query( MediaStore.Images.Media.EXTERNAL_CONTENT_URI, projection, query, null, MediaStore.Images.ImageColumns.DATE_TAKEN + STR); if (cursor.moveToFirst() && cursor.getCount() != 0) { do { ImageDetails imgdetails; tempDeltaTime = cursor .getLong(cursor .getColumnIndex(MediaStore.Images.ImageColumns.DATE_TAKEN)) - startTimeInMillis; tempPath = cursor.getString(cursor .getColumnIndex(MediaStore.Images.ImageColumns.DATA)); shouldCopy = true; imgdetails = new ImageDetails(tempPath, tempDeltaTime, shouldCopy, isSelected); paths.add(imgdetails); } while (cursor.moveToNext()); if (!paths.isEmpty()) { ImageApplication.fromRecorderPaths = null; ImageApplication.fromRecorderPaths = paths; listner.onLoaded(true); } else { listner.onLoaded(false); } } } | /**
* This Method extracts all the images between startTime - endTime and
* return the ImageDetailsList Object.
*
* @param context
* -> Context
* @param startTimeInMillis
* -> Start time in Millis
* @param Id
* ->
* @return
*/ | This Method extracts all the images between startTime - endTime and return the ImageDetailsList Object | ExtractAndReturn | {
"repo_name": "shivarajp/HorizontalImageVewExample",
"path": "src/com/example/horizontalimageview/ImagePathExtractor.java",
"license": "apache-2.0",
"size": 2622
} | [
"android.content.Context",
"android.database.Cursor",
"android.provider.MediaStore",
"java.util.ArrayList"
] | import android.content.Context; import android.database.Cursor; import android.provider.MediaStore; import java.util.ArrayList; | import android.content.*; import android.database.*; import android.provider.*; import java.util.*; | [
"android.content",
"android.database",
"android.provider",
"java.util"
] | android.content; android.database; android.provider; java.util; | 2,417,630 |
return Container.getComp(GenSurveyItemsDao.class);
} | return Container.getComp(GenSurveyItemsDao.class); } | /**
* Get instance from DI container.
* @return instance
*/ | Get instance from DI container | get | {
"repo_name": "support-project/knowledge",
"path": "src/main/java/org/support/project/knowledge/dao/gen/GenSurveyItemsDao.java",
"license": "apache-2.0",
"size": 19199
} | [
"org.support.project.di.Container"
] | import org.support.project.di.Container; | import org.support.project.di.*; | [
"org.support.project"
] | org.support.project; | 2,521,646 |
protected void engineUpdate(ByteBuffer input)
{
messageDigest.update(input);
needsReset = true;
} | void function(ByteBuffer input) { messageDigest.update(input); needsReset = true; } | /**
* Updates the data to be signed or verified, using the
* specified ByteBuffer.
*
* @param input the ByteBuffer
*/ | Updates the data to be signed or verified, using the specified ByteBuffer | engineUpdate | {
"repo_name": "rokn/Count_Words_2015",
"path": "testing/openjdk/jdk/src/windows/classes/sun/security/mscapi/RSASignature.java",
"license": "mit",
"size": 17271
} | [
"java.nio.ByteBuffer"
] | import java.nio.ByteBuffer; | import java.nio.*; | [
"java.nio"
] | java.nio; | 2,452,415 |
public void startProcessingEvents() {
try {
stateSwitch.start();
} catch (Exception ex) {
moveToState(QueryState.FAILED, ex);
}
} | void function() { try { stateSwitch.start(); } catch (Exception ex) { moveToState(QueryState.FAILED, ex); } } | /**
* Starts processing all events that were enqueued while all fragments were sending out.
*/ | Starts processing all events that were enqueued while all fragments were sending out | startProcessingEvents | {
"repo_name": "arina-ielchiieva/drill",
"path": "exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/QueryStateProcessor.java",
"license": "apache-2.0",
"size": 11228
} | [
"org.apache.drill.exec.proto.UserBitShared"
] | import org.apache.drill.exec.proto.UserBitShared; | import org.apache.drill.exec.proto.*; | [
"org.apache.drill"
] | org.apache.drill; | 1,241,506 |
private void traverseAndRemoveUnusedReferences(Node root) {
Scope scope = new SyntacticScopeCreator(compiler).createScope(root, null);
traverseNode(root, null, scope);
if (removeGlobals) {
collectMaybeUnreferencedVars(scope);
}
interpretAssigns();
removeUnreferencedVars();
for (Scope fnScope : allFunctionScopes) {
removeUnreferencedFunctionArgs(fnScope);
}
} | void function(Node root) { Scope scope = new SyntacticScopeCreator(compiler).createScope(root, null); traverseNode(root, null, scope); if (removeGlobals) { collectMaybeUnreferencedVars(scope); } interpretAssigns(); removeUnreferencedVars(); for (Scope fnScope : allFunctionScopes) { removeUnreferencedFunctionArgs(fnScope); } } | /**
* Traverses a node recursively. Call this once per pass.
*/ | Traverses a node recursively. Call this once per pass | traverseAndRemoveUnusedReferences | {
"repo_name": "zombiezen/cardcpx",
"path": "third_party/closure-compiler/src/com/google/javascript/jscomp/RemoveUnusedVars.java",
"license": "apache-2.0",
"size": 34961
} | [
"com.google.javascript.rhino.Node"
] | import com.google.javascript.rhino.Node; | import com.google.javascript.rhino.*; | [
"com.google.javascript"
] | com.google.javascript; | 2,153,404 |
protected void drawAnchor( final RenderNode content ) {
} | void function( final RenderNode content ) { } | /**
* To be overriden in the PDF drawable.
*
* @param content
* the render-node that defines the anchor.
*/ | To be overriden in the PDF drawable | drawAnchor | {
"repo_name": "EgorZhuk/pentaho-reporting",
"path": "engine/core/src/main/java/org/pentaho/reporting/engine/classic/core/modules/output/pageable/graphics/internal/LogicalPageDrawable.java",
"license": "lgpl-2.1",
"size": 52510
} | [
"org.pentaho.reporting.engine.classic.core.layout.model.RenderNode"
] | import org.pentaho.reporting.engine.classic.core.layout.model.RenderNode; | import org.pentaho.reporting.engine.classic.core.layout.model.*; | [
"org.pentaho.reporting"
] | org.pentaho.reporting; | 2,740,600 |
private int calcNumberOfColumns() {
int result = 0;
if (fields != null) {
Iterator<FieldEditor> e = fields.iterator();
while (e.hasNext()) {
FieldEditor pe = e.next();
result = Math.max(result, pe.getNumberOfControls());
}
}
return result;
} | int function() { int result = 0; if (fields != null) { Iterator<FieldEditor> e = fields.iterator(); while (e.hasNext()) { FieldEditor pe = e.next(); result = Math.max(result, pe.getNumberOfControls()); } } return result; } | /**
* Calculates the number of columns needed to host all field editors.
*
* @return the number of columns
*/ | Calculates the number of columns needed to host all field editors | calcNumberOfColumns | {
"repo_name": "AntoineDelacroix/NewSuperProject-",
"path": "org.eclipse.jface/src/org/eclipse/jface/preference/FieldEditorPreferencePage.java",
"license": "gpl-2.0",
"size": 11811
} | [
"java.util.Iterator"
] | import java.util.Iterator; | import java.util.*; | [
"java.util"
] | java.util; | 1,533,747 |
private void convertWidgets(SQLiteDatabase db) {
final AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(mContext);
final int[] bindSources = new int[] {
Favorites.ITEM_TYPE_WIDGET_CLOCK,
Favorites.ITEM_TYPE_WIDGET_PHOTO_FRAME,
Favorites.ITEM_TYPE_WIDGET_SEARCH,
};
final String selectWhere = buildOrWhereString(Favorites.ITEM_TYPE, bindSources);
Cursor c = null;
db.beginTransaction();
try {
// Select and iterate through each matching widget
c = db.query(TABLE_FAVORITES, new String[] { Favorites._ID, Favorites.ITEM_TYPE },
selectWhere, null, null, null, null);
if (LOGD) Log.d(TAG, "found upgrade cursor count=" + c.getCount());
final ContentValues values = new ContentValues();
while (c != null && c.moveToNext()) {
long favoriteId = c.getLong(0);
int favoriteType = c.getInt(1);
// Allocate and update database with new appWidgetId
try {
int appWidgetId = mAppWidgetHost.allocateAppWidgetId();
if (LOGD) {
Log.d(TAG, "allocated appWidgetId=" + appWidgetId
+ " for favoriteId=" + favoriteId);
}
values.clear();
values.put(Favorites.ITEM_TYPE, Favorites.ITEM_TYPE_APPWIDGET);
values.put(Favorites.APPWIDGET_ID, appWidgetId);
// Original widgets might not have valid spans when upgrading
if (favoriteType == Favorites.ITEM_TYPE_WIDGET_SEARCH) {
values.put(LauncherSettings.Favorites.SPANX, 4);
values.put(LauncherSettings.Favorites.SPANY, 1);
} else {
values.put(LauncherSettings.Favorites.SPANX, 2);
values.put(LauncherSettings.Favorites.SPANY, 2);
}
String updateWhere = Favorites._ID + "=" + favoriteId;
db.update(TABLE_FAVORITES, values, updateWhere, null);
if (favoriteType == Favorites.ITEM_TYPE_WIDGET_CLOCK) {
// TODO: check return value
appWidgetManager.bindAppWidgetIdIfAllowed(appWidgetId,
new ComponentName("com.android.alarmclock",
"com.android.alarmclock.AnalogAppWidgetProvider"));
} else if (favoriteType == Favorites.ITEM_TYPE_WIDGET_PHOTO_FRAME) {
// TODO: check return value
appWidgetManager.bindAppWidgetIdIfAllowed(appWidgetId,
new ComponentName("com.android.camera",
"com.android.camera.PhotoAppWidgetProvider"));
} else if (favoriteType == Favorites.ITEM_TYPE_WIDGET_SEARCH) {
// TODO: check return value
appWidgetManager.bindAppWidgetIdIfAllowed(appWidgetId,
getSearchWidgetProvider());
}
} catch (RuntimeException ex) {
Log.e(TAG, "Problem allocating appWidgetId", ex);
}
}
db.setTransactionSuccessful();
} catch (SQLException ex) {
Log.w(TAG, "Problem while allocating appWidgetIds for existing widgets", ex);
} finally {
db.endTransaction();
if (c != null) {
c.close();
}
}
// Update max item id
mMaxItemId = initializeMaxItemId(db);
if (LOGD) Log.d(TAG, "mMaxItemId: " + mMaxItemId);
} | void function(SQLiteDatabase db) { final AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(mContext); final int[] bindSources = new int[] { Favorites.ITEM_TYPE_WIDGET_CLOCK, Favorites.ITEM_TYPE_WIDGET_PHOTO_FRAME, Favorites.ITEM_TYPE_WIDGET_SEARCH, }; final String selectWhere = buildOrWhereString(Favorites.ITEM_TYPE, bindSources); Cursor c = null; db.beginTransaction(); try { c = db.query(TABLE_FAVORITES, new String[] { Favorites._ID, Favorites.ITEM_TYPE }, selectWhere, null, null, null, null); if (LOGD) Log.d(TAG, STR + c.getCount()); final ContentValues values = new ContentValues(); while (c != null && c.moveToNext()) { long favoriteId = c.getLong(0); int favoriteType = c.getInt(1); try { int appWidgetId = mAppWidgetHost.allocateAppWidgetId(); if (LOGD) { Log.d(TAG, STR + appWidgetId + STR + favoriteId); } values.clear(); values.put(Favorites.ITEM_TYPE, Favorites.ITEM_TYPE_APPWIDGET); values.put(Favorites.APPWIDGET_ID, appWidgetId); if (favoriteType == Favorites.ITEM_TYPE_WIDGET_SEARCH) { values.put(LauncherSettings.Favorites.SPANX, 4); values.put(LauncherSettings.Favorites.SPANY, 1); } else { values.put(LauncherSettings.Favorites.SPANX, 2); values.put(LauncherSettings.Favorites.SPANY, 2); } String updateWhere = Favorites._ID + "=" + favoriteId; db.update(TABLE_FAVORITES, values, updateWhere, null); if (favoriteType == Favorites.ITEM_TYPE_WIDGET_CLOCK) { appWidgetManager.bindAppWidgetIdIfAllowed(appWidgetId, new ComponentName(STR, STR)); } else if (favoriteType == Favorites.ITEM_TYPE_WIDGET_PHOTO_FRAME) { appWidgetManager.bindAppWidgetIdIfAllowed(appWidgetId, new ComponentName(STR, STR)); } else if (favoriteType == Favorites.ITEM_TYPE_WIDGET_SEARCH) { appWidgetManager.bindAppWidgetIdIfAllowed(appWidgetId, getSearchWidgetProvider()); } } catch (RuntimeException ex) { Log.e(TAG, STR, ex); } } db.setTransactionSuccessful(); } catch (SQLException ex) { Log.w(TAG, STR, ex); } finally { db.endTransaction(); if (c != null) { c.close(); } } mMaxItemId = initializeMaxItemId(db); if (LOGD) Log.d(TAG, STR + mMaxItemId); } | /**
* Upgrade existing clock and photo frame widgets into their new widget
* equivalents.
*/ | Upgrade existing clock and photo frame widgets into their new widget equivalents | convertWidgets | {
"repo_name": "anuprakash/Launcher3",
"path": "app/src/main/java/com/android/launcher3/LauncherProvider.java",
"license": "apache-2.0",
"size": 63667
} | [
"android.appwidget.AppWidgetManager",
"android.content.ComponentName",
"android.content.ContentValues",
"android.database.Cursor",
"android.database.SQLException",
"android.database.sqlite.SQLiteDatabase",
"android.util.Log",
"com.android.launcher3.LauncherSettings"
] | import android.appwidget.AppWidgetManager; import android.content.ComponentName; import android.content.ContentValues; import android.database.Cursor; import android.database.SQLException; import android.database.sqlite.SQLiteDatabase; import android.util.Log; import com.android.launcher3.LauncherSettings; | import android.appwidget.*; import android.content.*; import android.database.*; import android.database.sqlite.*; import android.util.*; import com.android.launcher3.*; | [
"android.appwidget",
"android.content",
"android.database",
"android.util",
"com.android.launcher3"
] | android.appwidget; android.content; android.database; android.util; com.android.launcher3; | 2,293,132 |
private void processInput(boolean endOfInput) throws IOException {
// Prepare decoderIn for reading
decoderIn.flip();
CoderResult coderResult;
while (true) {
coderResult = decoder.decode(decoderIn, decoderOut, endOfInput);
if (coderResult.isOverflow()) {
flushOutput();
} else if (coderResult.isUnderflow()) {
break;
} else {
// The decoder is configured to replace malformed input and unmappable characters,
// so we should not get here.
throw new IOException("Unexpected coder result");
}
}
// Discard the bytes that have been read
decoderIn.compact();
} | void function(boolean endOfInput) throws IOException { decoderIn.flip(); CoderResult coderResult; while (true) { coderResult = decoder.decode(decoderIn, decoderOut, endOfInput); if (coderResult.isOverflow()) { flushOutput(); } else if (coderResult.isUnderflow()) { break; } else { throw new IOException(STR); } } decoderIn.compact(); } | /**
* Decode the contents of the input ByteBuffer into a CharBuffer.
*
* @param endOfInput indicates end of input
* @throws IOException if an I/O error occurs
*/ | Decode the contents of the input ByteBuffer into a CharBuffer | processInput | {
"repo_name": "mes5k/nextflow",
"path": "modules/nf-commons/src/main/nextflow/io/WriterOutputStream.java",
"license": "gpl-3.0",
"size": 13237
} | [
"java.io.IOException",
"java.nio.charset.CoderResult"
] | import java.io.IOException; import java.nio.charset.CoderResult; | import java.io.*; import java.nio.charset.*; | [
"java.io",
"java.nio"
] | java.io; java.nio; | 658,833 |
@Override
public java.math.BigDecimal getQty ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_Qty);
if (bd == null)
return Env.ZERO;
return bd;
} | java.math.BigDecimal function () { BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_Qty); if (bd == null) return Env.ZERO; return bd; } | /** Get Menge.
@return Menge
*/ | Get Menge | getQty | {
"repo_name": "klst-com/metasfresh",
"path": "de.metas.adempiere.adempiere/base/src/main/java-gen/org/eevolution/model/X_PP_MRP_Alternative.java",
"license": "gpl-2.0",
"size": 8009
} | [
"java.math.BigDecimal",
"org.compiere.util.Env"
] | import java.math.BigDecimal; import org.compiere.util.Env; | import java.math.*; import org.compiere.util.*; | [
"java.math",
"org.compiere.util"
] | java.math; org.compiere.util; | 2,365,096 |
@NonNull
public Builder addFilterSchemas(@NonNull Collection<String> schemas) {
Preconditions.checkNotNull(schemas);
resetIfBuilt();
mSchemas.addAll(schemas);
return this;
}
// @exportToFramework:startStrip() | Builder function(@NonNull Collection<String> schemas) { Preconditions.checkNotNull(schemas); resetIfBuilt(); mSchemas.addAll(schemas); return this; } | /**
* Adds a Schema type filter to {@link SearchSpec} Entry. Only search for documents that
* have the specified schema types.
*
* <p>If unset, the query will search over all schema types.
*/ | Adds a Schema type filter to <code>SearchSpec</code> Entry. Only search for documents that have the specified schema types. If unset, the query will search over all schema types | addFilterSchemas | {
"repo_name": "AndroidX/androidx",
"path": "appsearch/appsearch/src/main/java/androidx/appsearch/app/SearchSpec.java",
"license": "apache-2.0",
"size": 29551
} | [
"androidx.annotation.NonNull",
"androidx.core.util.Preconditions",
"java.util.Collection"
] | import androidx.annotation.NonNull; import androidx.core.util.Preconditions; import java.util.Collection; | import androidx.annotation.*; import androidx.core.util.*; import java.util.*; | [
"androidx.annotation",
"androidx.core",
"java.util"
] | androidx.annotation; androidx.core; java.util; | 1,260,850 |
void write(Writer writer) throws IOException; | void write(Writer writer) throws IOException; | /**
* Writes the relevant parts of the object to the provided writer
* @param writer a writer instance
* @throws IOException in case of an error
*/ | Writes the relevant parts of the object to the provided writer | write | {
"repo_name": "dodkoC/thesis-disassembler",
"path": "src/main/java/com/thesis/common/Writable.java",
"license": "bsd-3-clause",
"size": 397
} | [
"java.io.IOException",
"java.io.Writer"
] | import java.io.IOException; import java.io.Writer; | import java.io.*; | [
"java.io"
] | java.io; | 469,750 |
static Node getConditionExpression(Node n) {
switch (n.getType()) {
case Token.IF:
case Token.WHILE:
return n.getFirstChild();
case Token.DO:
return n.getLastChild();
case Token.FOR:
switch (n.getChildCount()) {
case 3:
return null;
case 4:
return n.getFirstChild().getNext();
}
throw new IllegalArgumentException("malformed 'for' statement " + n);
case Token.CASE:
return null;
}
throw new IllegalArgumentException(n + " does not have a condition.");
} | static Node getConditionExpression(Node n) { switch (n.getType()) { case Token.IF: case Token.WHILE: return n.getFirstChild(); case Token.DO: return n.getLastChild(); case Token.FOR: switch (n.getChildCount()) { case 3: return null; case 4: return n.getFirstChild().getNext(); } throw new IllegalArgumentException(STR + n); case Token.CASE: return null; } throw new IllegalArgumentException(n + STR); } | /**
* Gets the condition of an ON_TRUE / ON_FALSE CFG edge.
* @param n a node with an outgoing conditional CFG edge
* @return the condition node or null if the condition is not obviously a node
*/ | Gets the condition of an ON_TRUE / ON_FALSE CFG edge | getConditionExpression | {
"repo_name": "johan/closure-compiler",
"path": "src/com/google/javascript/jscomp/NodeUtil.java",
"license": "apache-2.0",
"size": 59336
} | [
"com.google.javascript.rhino.Node",
"com.google.javascript.rhino.Token"
] | import com.google.javascript.rhino.Node; import com.google.javascript.rhino.Token; | import com.google.javascript.rhino.*; | [
"com.google.javascript"
] | com.google.javascript; | 1,353,642 |
public void saveTo(File file) throws IOException {
FileWriter writer = new FileWriter(file);
try {
writer.write(getAbcString());
} finally {
writer.close();
}
}
| void function(File file) throws IOException { FileWriter writer = new FileWriter(file); try { writer.write(getAbcString()); } finally { writer.close(); } } | /**
* Saves the ABC source String to file.
*
* @param file
* @throws IOException
*/ | Saves the ABC source String to file | saveTo | {
"repo_name": "Sciss/abc4j",
"path": "abc/src/main/java/abc/parser/AbcTuneBook.java",
"license": "lgpl-3.0",
"size": 4684
} | [
"java.io.File",
"java.io.FileWriter",
"java.io.IOException"
] | import java.io.File; import java.io.FileWriter; import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,617,277 |
public Vector3D getNadir() {
return point.getNadir();
} | Vector3D function() { return point.getNadir(); } | /** Get the nadir direction of topocentric frame, expressed in parent shape frame.
* <p>The nadir direction is the opposite of zenith direction.</p>
* @return unit vector in the nadir direction
* @see #getZenith()
*/ | Get the nadir direction of topocentric frame, expressed in parent shape frame. The nadir direction is the opposite of zenith direction | getNadir | {
"repo_name": "treeform/orekit",
"path": "src/main/java/org/orekit/frames/TopocentricFrame.java",
"license": "apache-2.0",
"size": 14080
} | [
"org.apache.commons.math3.geometry.euclidean.threed.Vector3D"
] | import org.apache.commons.math3.geometry.euclidean.threed.Vector3D; | import org.apache.commons.math3.geometry.euclidean.threed.*; | [
"org.apache.commons"
] | org.apache.commons; | 599,934 |
InputStream decompress(InputStream is) throws IOException;
}
public interface Codec extends Compressor, Decompressor {} | InputStream decompress(InputStream is) throws IOException; } public interface Codec extends Compressor, Decompressor {} | /**
* Wraps an existing input stream with a decompressing input stream.
* @param is The input stream of uncompressed data
* @return An input stream that decompresses
*/ | Wraps an existing input stream with a decompressing input stream | decompress | {
"repo_name": "aglne/grpc-java",
"path": "core/src/main/java/io/grpc/MessageEncoding.java",
"license": "bsd-3-clause",
"size": 4347
} | [
"java.io.IOException",
"java.io.InputStream"
] | import java.io.IOException; import java.io.InputStream; | import java.io.*; | [
"java.io"
] | java.io; | 287,634 |
@Schema(example = "1", description = "When the notification was sent.")
public Integer getCreatedAt() {
return createdAt;
} | @Schema(example = "1", description = STR) Integer function() { return createdAt; } | /**
* When the notification was sent.
* @return createdAt
**/ | When the notification was sent | getCreatedAt | {
"repo_name": "iterate-ch/cyberduck",
"path": "brick/src/main/java/ch/cyberduck/core/brick/io/swagger/client/model/ActionNotificationExportResultEntity.java",
"license": "gpl-3.0",
"size": 8855
} | [
"io.swagger.v3.oas.annotations.media.Schema"
] | import io.swagger.v3.oas.annotations.media.Schema; | import io.swagger.v3.oas.annotations.media.*; | [
"io.swagger.v3"
] | io.swagger.v3; | 2,790,579 |
private void write (String s) throws IOException {
output.write(s);
} | void function (String s) throws IOException { output.write(s); } | /**
* Write a raw string.
*/ | Write a raw string | write | {
"repo_name": "samskivert/ikvm-openjdk",
"path": "build/linux-amd64/impsrc/com/sun/xml/internal/txw2/output/XMLWriter.java",
"license": "gpl-2.0",
"size": 34954
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,090,050 |
@Override
public String[] getOptions() {
Vector<String> options = new Vector<String>();
Collections.addAll(options, super.getOptions());
if (!m_bUseADTree) {
options.add("-D");
}
if (m_otherBayesNet != null) {
options.add("-B");
options.add(m_otherBayesNet.getFileName());
}
options.add("-Q");
options.add("" + getSearchAlgorithm().getClass().getName());
options.add("--");
Collections.addAll(options, getSearchAlgorithm().getOptions());
options.add("-E");
options.add("" + getEstimator().getClass().getName());
options.add("--");
Collections.addAll(options, getEstimator().getOptions());
return options.toArray(new String[0]);
} // getOptions | String[] function() { Vector<String> options = new Vector<String>(); Collections.addAll(options, super.getOptions()); if (!m_bUseADTree) { options.add("-D"); } if (m_otherBayesNet != null) { options.add("-B"); options.add(m_otherBayesNet.getFileName()); } options.add("-Q"); options.add(STR--STR-ESTRSTR--"); Collections.addAll(options, getEstimator().getOptions()); return options.toArray(new String[0]); } | /**
* Gets the current settings of the classifier.
*
* @return an array of strings suitable for passing to setOptions
*/ | Gets the current settings of the classifier | getOptions | {
"repo_name": "ahmedvc/umple",
"path": "Umplificator/UmplifiedProjects/weka-umplified-0/src/main/java/weka/classifiers/bayes/BayesNet.java",
"license": "mit",
"size": 36311
} | [
"java.util.Collections",
"java.util.Vector"
] | import java.util.Collections; import java.util.Vector; | import java.util.*; | [
"java.util"
] | java.util; | 681,469 |
public static PropertyIdValue makeWikidataPropertyIdValue(String id) {
return factory.getPropertyIdValue(id, SITE_WIKIDATA);
} | static PropertyIdValue function(String id) { return factory.getPropertyIdValue(id, SITE_WIKIDATA); } | /**
* Creates a {@link PropertyIdValue}.
*
* @param id
* a string of the form Pn... where n... is the string
* representation of a positive integer number
* @return a {@link PropertyIdValue} corresponding to the input
*/ | Creates a <code>PropertyIdValue</code> | makeWikidataPropertyIdValue | {
"repo_name": "notconfusing/Wikidata-Toolkit",
"path": "wdtk-datamodel/src/main/java/org/wikidata/wdtk/datamodel/helpers/Datamodel.java",
"license": "apache-2.0",
"size": 22249
} | [
"org.wikidata.wdtk.datamodel.interfaces.PropertyIdValue"
] | import org.wikidata.wdtk.datamodel.interfaces.PropertyIdValue; | import org.wikidata.wdtk.datamodel.interfaces.*; | [
"org.wikidata.wdtk"
] | org.wikidata.wdtk; | 2,301,850 |
Object resolveDependency(DependencyDescriptor descriptor, String beanName,
Set autowiredBeanNames, TypeConverter typeConverter) throws BeansException; | Object resolveDependency(DependencyDescriptor descriptor, String beanName, Set autowiredBeanNames, TypeConverter typeConverter) throws BeansException; | /**
* Resolve the specified dependency against the beans defined in this factory.
* @param descriptor the descriptor for the dependency
* @param beanName the name of the bean which declares the present dependency
* @param autowiredBeanNames a Set that all names of autowired beans (used for
* resolving the present dependency) are supposed to be added to
* @param typeConverter the TypeConverter to use for populating arrays and
* collections
* @return the resolved object, or <code>null</code> if none found
* @throws BeansException in dependency resolution failed
*/ | Resolve the specified dependency against the beans defined in this factory | resolveDependency | {
"repo_name": "mattxia/spring-2.5-analysis",
"path": "src/org/springframework/beans/factory/config/AutowireCapableBeanFactory.java",
"license": "apache-2.0",
"size": 13730
} | [
"java.util.Set",
"org.springframework.beans.BeansException",
"org.springframework.beans.TypeConverter"
] | import java.util.Set; import org.springframework.beans.BeansException; import org.springframework.beans.TypeConverter; | import java.util.*; import org.springframework.beans.*; | [
"java.util",
"org.springframework.beans"
] | java.util; org.springframework.beans; | 1,084,848 |
public void setIsIncognito(boolean incognito) {
if (mIsIncognito == incognito) return;
mIsIncognito = incognito;
if (mTransitionAnimation != null) {
mTransitionAnimation.cancel();
mTransitionAnimation = null;
}
Drawable fadeOutDrawable = incognito ? mNormalDrawable : mIncognitoDrawable;
Drawable fadeInDrawable = incognito ? mIncognitoDrawable : mNormalDrawable;
if (getVisibility() != VISIBLE) {
fadeOutDrawable.setAlpha(0);
fadeInDrawable.setAlpha(255);
return;
}
List<Animator> animations = new ArrayList<Animator>();
Animator animation = ObjectAnimator.ofInt(
fadeOutDrawable, AnimatorProperties.DRAWABLE_ALPHA_PROPERTY, 255, 0);
animation.setDuration(100);
animations.add(animation);
animation = ObjectAnimator.ofInt(
fadeInDrawable, AnimatorProperties.DRAWABLE_ALPHA_PROPERTY, 0, 255);
animation.setStartDelay(150);
animation.setDuration(100);
animations.add(animation);
mTransitionAnimation = new AnimatorSet();
mTransitionAnimation.playTogether(animations);
mTransitionAnimation.start();
} | void function(boolean incognito) { if (mIsIncognito == incognito) return; mIsIncognito = incognito; if (mTransitionAnimation != null) { mTransitionAnimation.cancel(); mTransitionAnimation = null; } Drawable fadeOutDrawable = incognito ? mNormalDrawable : mIncognitoDrawable; Drawable fadeInDrawable = incognito ? mIncognitoDrawable : mNormalDrawable; if (getVisibility() != VISIBLE) { fadeOutDrawable.setAlpha(0); fadeInDrawable.setAlpha(255); return; } List<Animator> animations = new ArrayList<Animator>(); Animator animation = ObjectAnimator.ofInt( fadeOutDrawable, AnimatorProperties.DRAWABLE_ALPHA_PROPERTY, 255, 0); animation.setDuration(100); animations.add(animation); animation = ObjectAnimator.ofInt( fadeInDrawable, AnimatorProperties.DRAWABLE_ALPHA_PROPERTY, 0, 255); animation.setStartDelay(150); animation.setDuration(100); animations.add(animation); mTransitionAnimation = new AnimatorSet(); mTransitionAnimation.playTogether(animations); mTransitionAnimation.start(); } | /**
* Updates the visual state based on whether incognito or normal tabs are being created.
* @param incognito Whether the button is now used for creating incognito tabs.
*/ | Updates the visual state based on whether incognito or normal tabs are being created | setIsIncognito | {
"repo_name": "axinging/chromium-crosswalk",
"path": "chrome/android/java/src/org/chromium/chrome/browser/widget/newtab/NewTabButton.java",
"license": "bsd-3-clause",
"size": 5302
} | [
"android.animation.Animator",
"android.animation.AnimatorSet",
"android.animation.ObjectAnimator",
"android.graphics.drawable.Drawable",
"java.util.ArrayList",
"java.util.List",
"org.chromium.chrome.browser.widget.animation.AnimatorProperties"
] | import android.animation.Animator; import android.animation.AnimatorSet; import android.animation.ObjectAnimator; import android.graphics.drawable.Drawable; import java.util.ArrayList; import java.util.List; import org.chromium.chrome.browser.widget.animation.AnimatorProperties; | import android.animation.*; import android.graphics.drawable.*; import java.util.*; import org.chromium.chrome.browser.widget.animation.*; | [
"android.animation",
"android.graphics",
"java.util",
"org.chromium.chrome"
] | android.animation; android.graphics; java.util; org.chromium.chrome; | 2,387,842 |
@Override
public void chartChanged(ChartChangeEvent event) {
draw();
}
| void function(ChartChangeEvent event) { draw(); } | /**
* Receives a notification from the chart that it has been changed and
* responds by redrawing the chart entirely.
*
* @param event event information.
*/ | Receives a notification from the chart that it has been changed and responds by redrawing the chart entirely | chartChanged | {
"repo_name": "m-altieri/speedhouse",
"path": "speedhouse/lib/jfreechart_src/org/jfree/chart/fx/ChartCanvas.java",
"license": "mit",
"size": 19847
} | [
"org.jfree.chart.event.ChartChangeEvent"
] | import org.jfree.chart.event.ChartChangeEvent; | import org.jfree.chart.event.*; | [
"org.jfree.chart"
] | org.jfree.chart; | 2,823,927 |
public void dispose() {
indexChangedListenerHandle.remove();
refsChangedListenerHandle.remove();
if (resourceChangeListener != null)
ResourcesPlugin.getWorkspace().removeResourceChangeListener(resourceChangeListener);
} | void function() { indexChangedListenerHandle.remove(); refsChangedListenerHandle.remove(); if (resourceChangeListener != null) ResourcesPlugin.getWorkspace().removeResourceChangeListener(resourceChangeListener); } | /**
* Dispose cache entry by removing listeners.
*/ | Dispose cache entry by removing listeners | dispose | {
"repo_name": "SmithAndr/egit",
"path": "org.eclipse.egit.core/src/org/eclipse/egit/core/internal/indexdiff/IndexDiffCacheEntry.java",
"license": "epl-1.0",
"size": 19187
} | [
"org.eclipse.core.resources.ResourcesPlugin"
] | import org.eclipse.core.resources.ResourcesPlugin; | import org.eclipse.core.resources.*; | [
"org.eclipse.core"
] | org.eclipse.core; | 1,378,865 |
public static class Solution2 {
public int twoSumLessThanK(int[] A, int K) {
Arrays.sort(A);
int left = 0;
int right = A.length - 1;
int sum = Integer.MIN_VALUE;
while (left < right) {
int newSum = A[left] + A[right];
if (newSum < K && newSum > sum) {
sum = newSum;
} else if (newSum >= K) {
right--;
} else {
left++;
}
}
return sum == Integer.MIN_VALUE ? -1 : sum;
}
} | static class Solution2 { public int function(int[] A, int K) { Arrays.sort(A); int left = 0; int right = A.length - 1; int sum = Integer.MIN_VALUE; while (left < right) { int newSum = A[left] + A[right]; if (newSum < K && newSum > sum) { sum = newSum; } else if (newSum >= K) { right--; } else { left++; } } return sum == Integer.MIN_VALUE ? -1 : sum; } } | /**
* Time: O(nlogn)
* Space: O(1)
*/ | Time: O(nlogn) Space: O(1) | twoSumLessThanK | {
"repo_name": "fishercoder1534/Leetcode",
"path": "src/main/java/com/fishercoder/solutions/_1099.java",
"license": "apache-2.0",
"size": 1330
} | [
"java.util.Arrays"
] | import java.util.Arrays; | import java.util.*; | [
"java.util"
] | java.util; | 2,771,895 |
public File prepareDataFolder() {
if (!dataFolder.exists()) {
dataFolder.mkdirs();
}
return dataFolder;
} | File function() { if (!dataFolder.exists()) { dataFolder.mkdirs(); } return dataFolder; } | /**
* Create the data folder if it does not exist already. As a convenience, it
* also returns the data folder, since it's likely about to be used.
*/ | Create the data folder if it does not exist already. As a convenience, it also returns the data folder, since it's likely about to be used | prepareDataFolder | {
"repo_name": "sujitbehera27/MyRoboticsProjects-Arduino",
"path": "src/org/myrobotlab/arduino/Sketch.java",
"license": "apache-2.0",
"size": 35890
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 2,675,639 |
public void testParseTemplateFailsToParseCompleteQueryAsSingleString() throws IOException {
String templateString = "{" + " \"inline\" : \"{ \\\"size\\\": \\\"{{size}}\\\", \\\"query\\\":{\\\"match_all\\\":{}}}\","
+ " \"params\":{" + " \"size\":2" + " }\n" + "}";
XContentParser templateSourceParser = XContentFactory.xContent(templateString).createParser(templateString);
QueryShardContext context = contextFactory.get();
try {
TemplateQueryBuilder.fromXContent(context.newParseContext(templateSourceParser)).get().rewrite(context);
fail("Expected ParsingException");
} catch (ParsingException e) {
assertThat(e.getMessage(), containsString("query malformed, no field after start_object"));
}
} | void function() throws IOException { String templateString = "{" + STRinline\STR{ \\\STR: \\\STR, \\\STR:{\\\STR:{}}}\"," + STRparams\":{" + STRsize\":2" + STR + "}"; XContentParser templateSourceParser = XContentFactory.xContent(templateString).createParser(templateString); QueryShardContext context = contextFactory.get(); try { TemplateQueryBuilder.fromXContent(context.newParseContext(templateSourceParser)).get().rewrite(context); fail(STR); } catch (ParsingException e) { assertThat(e.getMessage(), containsString(STR)); } } | /**
* Test that the template query parser can parse and evaluate template
* expressed as a single string but still it expects only the query
* specification (thus this test should fail with specific exception).
*/ | Test that the template query parser can parse and evaluate template expressed as a single string but still it expects only the query specification (thus this test should fail with specific exception) | testParseTemplateFailsToParseCompleteQueryAsSingleString | {
"repo_name": "palecur/elasticsearch",
"path": "modules/lang-mustache/src/test/java/org/elasticsearch/messy/tests/TemplateQueryParserTests.java",
"license": "apache-2.0",
"size": 11852
} | [
"java.io.IOException",
"org.elasticsearch.common.ParsingException",
"org.elasticsearch.common.xcontent.XContentFactory",
"org.elasticsearch.common.xcontent.XContentParser",
"org.elasticsearch.index.query.QueryShardContext",
"org.elasticsearch.index.query.TemplateQueryBuilder",
"org.hamcrest.Matchers"
] | import java.io.IOException; import org.elasticsearch.common.ParsingException; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.index.query.QueryShardContext; import org.elasticsearch.index.query.TemplateQueryBuilder; import org.hamcrest.Matchers; | import java.io.*; import org.elasticsearch.common.*; import org.elasticsearch.common.xcontent.*; import org.elasticsearch.index.query.*; import org.hamcrest.*; | [
"java.io",
"org.elasticsearch.common",
"org.elasticsearch.index",
"org.hamcrest"
] | java.io; org.elasticsearch.common; org.elasticsearch.index; org.hamcrest; | 926,367 |
void fill() {
try {
InputStream is = getProcess().getInputStream();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
for (int b; (b = is.read()) != -1; baos.write(b))
;
synchronized (getBufferSync()) {
_stdout = baos.toByteArray();
}
} catch (IOException ioe) {
// do nothing - getStdout() will return null
}
}
| void fill() { try { InputStream is = getProcess().getInputStream(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); for (int b; (b = is.read()) != -1; baos.write(b)) ; synchronized (getBufferSync()) { _stdout = baos.toByteArray(); } } catch (IOException ioe) { } } | /**
* Reads to the end of the output stream and then fills this buffer
* with the result.
*/ | Reads to the end of the output stream and then fills this buffer with the result | fill | {
"repo_name": "blackberry/WebWorks-TabletOS",
"path": "packager/src/net/rim/tumbler/processbuffer/OutputBuffer.java",
"license": "apache-2.0",
"size": 3664
} | [
"java.io.ByteArrayOutputStream",
"java.io.IOException",
"java.io.InputStream"
] | import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; | import java.io.*; | [
"java.io"
] | java.io; | 1,283,252 |
@Override
public void transition(double x, double y, InputEvent event) {
_fsm.addPoint(x, y, event);
} | void function(double x, double y, InputEvent event) { _fsm.addPoint(x, y, event); } | /**
* DOCUMENT ME!
*
* @param x
* DOCUMENT ME!
* @param y
* DOCUMENT ME!
* @param sel
* DOCUMENT ME!
*/ | DOCUMENT ME | transition | {
"repo_name": "iCarto/siga",
"path": "extCAD/src/com/iver/cit/gvsig/gui/cad/tools/PointCADTool.java",
"license": "gpl-3.0",
"size": 5445
} | [
"java.awt.event.InputEvent"
] | import java.awt.event.InputEvent; | import java.awt.event.*; | [
"java.awt"
] | java.awt; | 2,068,882 |
WorkloadNetworkSegment apply(Context context);
} | WorkloadNetworkSegment apply(Context context); } | /**
* Executes the update request.
*
* @param context The context to associate with this operation.
* @return the updated resource.
*/ | Executes the update request | apply | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/avs/azure-resourcemanager-avs/src/main/java/com/azure/resourcemanager/avs/models/WorkloadNetworkSegment.java",
"license": "mit",
"size": 9065
} | [
"com.azure.core.util.Context"
] | import com.azure.core.util.Context; | import com.azure.core.util.*; | [
"com.azure.core"
] | com.azure.core; | 2,635,348 |
Map<String, NavigationTable> getNavigationProperties(); | Map<String, NavigationTable> getNavigationProperties(); | /**
* This method returns the navigation property map, which contains the Navigation table which contains the all the navigation paths from the table,
*
* @return NavigationProperty Map
*/ | This method returns the navigation property map, which contains the Navigation table which contains the all the navigation paths from the table | getNavigationProperties | {
"repo_name": "maheshika/carbon-data",
"path": "components/data-services/org.wso2.carbon.dataservices.core/src/main/java/org/wso2/carbon/dataservices/core/odata/ODataDataHandler.java",
"license": "apache-2.0",
"size": 5745
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 200,845 |
public boolean onEntityItemUpdate(EntityItem entityItem)
{
return false;
} | boolean function(EntityItem entityItem) { return false; } | /**
* Called by the default implemetation of EntityItem's onUpdate method, allowing for cleaner
* control over the update of the item without having to write a subclass.
*
* @param entityItem The entity Item
* @return Return true to skip any further update code.
*/ | Called by the default implemetation of EntityItem's onUpdate method, allowing for cleaner control over the update of the item without having to write a subclass | onEntityItemUpdate | {
"repo_name": "wildex999/stjerncraft_mcpc",
"path": "src/minecraft/net/minecraft/item/Item.java",
"license": "gpl-3.0",
"size": 49732
} | [
"net.minecraft.entity.item.EntityItem"
] | import net.minecraft.entity.item.EntityItem; | import net.minecraft.entity.item.*; | [
"net.minecraft.entity"
] | net.minecraft.entity; | 102,026 |
public BigInteger getMinValue()
{
return minValue;
} | BigInteger function() { return minValue; } | /**
* Returns the lower boundary or null if none is set.
*/ | Returns the lower boundary or null if none is set | getMinValue | {
"repo_name": "tmarsteel/jcli",
"path": "src/main/java/com/tmarsteel/jcli/filter/BigIntegerFilter.java",
"license": "gpl-2.0",
"size": 3098
} | [
"java.math.BigInteger"
] | import java.math.BigInteger; | import java.math.*; | [
"java.math"
] | java.math; | 272,791 |
Collection<String> getRemovalsByType(HelixConstants.ChangeType changeType); | Collection<String> getRemovalsByType(HelixConstants.ChangeType changeType); | /**
* Returns the names of items that were removed based on the change type given.
* @return a collection of names of items that were removed
*/ | Returns the names of items that were removed based on the change type given | getRemovalsByType | {
"repo_name": "lei-xia/helix",
"path": "helix-core/src/main/java/org/apache/helix/controller/changedetector/ChangeDetector.java",
"license": "apache-2.0",
"size": 2192
} | [
"java.util.Collection",
"org.apache.helix.HelixConstants"
] | import java.util.Collection; import org.apache.helix.HelixConstants; | import java.util.*; import org.apache.helix.*; | [
"java.util",
"org.apache.helix"
] | java.util; org.apache.helix; | 1,525,102 |
public static DenseMatrix64F random64( int numRows , int numCols , double min , double max , Random rand )
{
DenseMatrix64F mat = new DenseMatrix64F(numRows,numCols);
double d[] = mat.getData();
int size = mat.getNumElements();
double r = max-min;
for( int i = 0; i < size; i++ ) {
d[i] = r*rand.nextDouble()+min;
}
return mat;
} | static DenseMatrix64F function( int numRows , int numCols , double min , double max , Random rand ) { DenseMatrix64F mat = new DenseMatrix64F(numRows,numCols); double d[] = mat.getData(); int size = mat.getNumElements(); double r = max-min; for( int i = 0; i < size; i++ ) { d[i] = r*rand.nextDouble()+min; } return mat; } | /**
* <p>
* Sets each element in the matrix to a value drawn from an uniform distribution from 'min' to 'max' inclusive.
* </p>
*
* @param min The minimum value each element can be.
* @param max The maximum value each element can be.
* @param rand Random number generator used to fill the matrix.
*/ | Sets each element in the matrix to a value drawn from an uniform distribution from 'min' to 'max' inclusive. | random64 | {
"repo_name": "MarkLeong1997/ejml",
"path": "main/core/test/org/ejml/data/UtilTestMatrix.java",
"license": "apache-2.0",
"size": 3524
} | [
"java.util.Random"
] | import java.util.Random; | import java.util.*; | [
"java.util"
] | java.util; | 947,995 |
public boolean doCompose(int keyCode, InputConnection ic) {
int maxLength = 4;
char c = (char) keyCode;
if (keyCode < 97 || keyCode > 122) {
return false;
}
if (composingText.length() >= maxLength) {
CandidatesManager.getInstance().pickCandidate(1);
clearComposingText(ic);
}
composingText.append(c);
return true;
} | boolean function(int keyCode, InputConnection ic) { int maxLength = 4; char c = (char) keyCode; if (keyCode < 97 keyCode > 122) { return false; } if (composingText.length() >= maxLength) { CandidatesManager.getInstance().pickCandidate(1); clearComposingText(ic); } composingText.append(c); return true; } | /**
* Composes the key-code into the composing-text by composing rules.
*/ | Composes the key-code into the composing-text by composing rules | doCompose | {
"repo_name": "coderpage/WuBiIME",
"path": "app/src/main/java/com/coderpage/wubinput/Editor.java",
"license": "apache-2.0",
"size": 4790
} | [
"android.view.inputmethod.InputConnection"
] | import android.view.inputmethod.InputConnection; | import android.view.inputmethod.*; | [
"android.view"
] | android.view; | 1,796,901 |
public PartitionTracker create(KafkaInput<?, ?> kafkaInput, TopicPartition partition, long initialCommittedOffset) {
if (autoCommitEnabled) {
return new PartitionTracker(partition);
} else {
return new CommittingPartitionTracker(partition, adapterFactory, kafkaInput, initialCommittedOffset, executor, commitBatchMaxElements, commitBatchMaxInterval);
}
} | PartitionTracker function(KafkaInput<?, ?> kafkaInput, TopicPartition partition, long initialCommittedOffset) { if (autoCommitEnabled) { return new PartitionTracker(partition); } else { return new CommittingPartitionTracker(partition, adapterFactory, kafkaInput, initialCommittedOffset, executor, commitBatchMaxElements, commitBatchMaxInterval); } } | /**
* Creates a partition tracker for the given partition
*
* @param partition the partition
* @return the tracker
*/ | Creates a partition tracker for the given partition | create | {
"repo_name": "OpenLiberty/open-liberty",
"path": "dev/com.ibm.ws.microprofile.reactive.messaging.kafka/src/com/ibm/ws/microprofile/reactive/messaging/kafka/PartitionTrackerFactory.java",
"license": "epl-1.0",
"size": 2370
} | [
"com.ibm.ws.microprofile.reactive.messaging.kafka.adapter.TopicPartition"
] | import com.ibm.ws.microprofile.reactive.messaging.kafka.adapter.TopicPartition; | import com.ibm.ws.microprofile.reactive.messaging.kafka.adapter.*; | [
"com.ibm.ws"
] | com.ibm.ws; | 2,104,486 |
@Override
protected List<SortMeta> buildSortOrder() {
List<SortMeta> results = DataTableUtil.buildSortOrder(":form:tabView:dtEntities:colRoleName", "colRoleName", SortOrder.ASCENDING);
if (results != null) {
return results;
}
results = DataTableUtil.buildSortOrder(":form:tabView:dtAccountRoles:colRoleName", "colRoleName", SortOrder.ASCENDING);
if (results != null) {
return results;
}
return new ArrayList<>();
} | List<SortMeta> function() { List<SortMeta> results = DataTableUtil.buildSortOrder(STR, STR, SortOrder.ASCENDING); if (results != null) { return results; } results = DataTableUtil.buildSortOrder(STR, STR, SortOrder.ASCENDING); if (results != null) { return results; } return new ArrayList<>(); } | /**
* Need to build an initial sort order for data table multi sort
*/ | Need to build an initial sort order for data table multi sort | buildSortOrder | {
"repo_name": "ddRPB/rpb",
"path": "radplanbio-portal/src/main/java/de/dktk/dd/rpb/portal/web/mb/admin/RoleBean.java",
"license": "gpl-3.0",
"size": 3303
} | [
"de.dktk.dd.rpb.portal.web.util.DataTableUtil",
"java.util.ArrayList",
"java.util.List",
"org.primefaces.model.SortMeta",
"org.primefaces.model.SortOrder"
] | import de.dktk.dd.rpb.portal.web.util.DataTableUtil; import java.util.ArrayList; import java.util.List; import org.primefaces.model.SortMeta; import org.primefaces.model.SortOrder; | import de.dktk.dd.rpb.portal.web.util.*; import java.util.*; import org.primefaces.model.*; | [
"de.dktk.dd",
"java.util",
"org.primefaces.model"
] | de.dktk.dd; java.util; org.primefaces.model; | 30,887 |
public K firstKey() {
if ( size == 0 ) throw new NoSuchElementException();
return key[ first ];
} | K function() { if ( size == 0 ) throw new NoSuchElementException(); return key[ first ]; } | /** Returns the first key of this map in iteration order.
*
* @return the first key in iteration order.
*/ | Returns the first key of this map in iteration order | firstKey | {
"repo_name": "karussell/fastutil",
"path": "src/it/unimi/dsi/fastutil/objects/Reference2DoubleLinkedOpenHashMap.java",
"license": "apache-2.0",
"size": 49289
} | [
"java.util.NoSuchElementException"
] | import java.util.NoSuchElementException; | import java.util.*; | [
"java.util"
] | java.util; | 1,810,896 |
public void incrementSynopticToolInfo(Message newMessage, boolean updateCurrentUser){
Set<String> recipients = getRecipients(newMessage);
String siteId = getSiteId();
String currentUser = getUserId();
//if updateCurrentUser is set to true, then update the current user
//even if he is not in the recipients list, this is done b/c the current
//user has a new message (their own) and it is quickly marked as read
//(so the current users count is decremented)
if(updateCurrentUser && !recipients.contains(currentUser)){
recipients.add(currentUser);
}
//make sure current user isn't in the list if they shouldn't be updated
if(!updateCurrentUser){
recipients.remove(currentUser);
}
incrementForumSynopticToolInfo(new ArrayList<String>(recipients), siteId, SynopticMsgcntrManager.NUM_OF_ATTEMPTS);
} | void function(Message newMessage, boolean updateCurrentUser){ Set<String> recipients = getRecipients(newMessage); String siteId = getSiteId(); String currentUser = getUserId(); if(updateCurrentUser && !recipients.contains(currentUser)){ recipients.add(currentUser); } if(!updateCurrentUser){ recipients.remove(currentUser); } incrementForumSynopticToolInfo(new ArrayList<String>(recipients), siteId, SynopticMsgcntrManager.NUM_OF_ATTEMPTS); } | /**
* if updateCurrentUser is set to true, then update the current user
* even if he is not in the recipients list
*
* @param newMessage
* @param updateCurrentUser
*/ | if updateCurrentUser is set to true, then update the current user even if he is not in the recipients list | incrementSynopticToolInfo | {
"repo_name": "OpenCollabZA/sakai",
"path": "msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/DiscussionForumTool.java",
"license": "apache-2.0",
"size": 328937
} | [
"java.util.ArrayList",
"java.util.Set",
"org.sakaiproject.api.app.messageforums.Message",
"org.sakaiproject.api.app.messageforums.SynopticMsgcntrManager"
] | import java.util.ArrayList; import java.util.Set; import org.sakaiproject.api.app.messageforums.Message; import org.sakaiproject.api.app.messageforums.SynopticMsgcntrManager; | import java.util.*; import org.sakaiproject.api.app.messageforums.*; | [
"java.util",
"org.sakaiproject.api"
] | java.util; org.sakaiproject.api; | 1,611,602 |
private Collection<? extends RestModel> getRepoOrFolderChildren(AuthorizationService authService,
boolean isCompact, ArtifactoryRestRequest request) {
Collection<? extends RestTreeNode> items = getChildren(authService, isCompact, request);
List<RestModel> treeModel = new ArrayList<>();
items.forEach(item -> {
// update additional data
((INode) item).updateNodeData();
treeModel.add(item);
});
return treeModel;
} | Collection<? extends RestModel> function(AuthorizationService authService, boolean isCompact, ArtifactoryRestRequest request) { Collection<? extends RestTreeNode> items = getChildren(authService, isCompact, request); List<RestModel> treeModel = new ArrayList<>(); items.forEach(item -> { ((INode) item).updateNodeData(); treeModel.add(item); }); return treeModel; } | /**
* get repository or folder children
*
* @param authService - authorization service
* @param isCompact - is compacted
* @param request
* @return
*/ | get repository or folder children | getRepoOrFolderChildren | {
"repo_name": "alancnet/artifactory",
"path": "web/rest-ui/src/main/java/org/artifactory/ui/rest/model/artifacts/browse/treebrowser/nodes/VirtualRemoteRepositoryNode.java",
"license": "apache-2.0",
"size": 7209
} | [
"java.util.ArrayList",
"java.util.Collection",
"java.util.List",
"org.artifactory.api.security.AuthorizationService",
"org.artifactory.rest.common.model.RestModel",
"org.artifactory.rest.common.service.ArtifactoryRestRequest"
] | import java.util.ArrayList; import java.util.Collection; import java.util.List; import org.artifactory.api.security.AuthorizationService; import org.artifactory.rest.common.model.RestModel; import org.artifactory.rest.common.service.ArtifactoryRestRequest; | import java.util.*; import org.artifactory.api.security.*; import org.artifactory.rest.common.model.*; import org.artifactory.rest.common.service.*; | [
"java.util",
"org.artifactory.api",
"org.artifactory.rest"
] | java.util; org.artifactory.api; org.artifactory.rest; | 2,686,469 |
@Nullable IMetadata parseMetadata(String metadataJson); | @Nullable IMetadata parseMetadata(String metadataJson); | /**
* Creates a metadata object from a json representation of the object.
*
* @param metadataJson The json representing the metadata that should be parsed.
* @return The parsed metadata as a metadata object to be used with the senders.
*/ | Creates a metadata object from a json representation of the object | parseMetadata | {
"repo_name": "GeorgH93/Bukkit_Bungee_PluginLib",
"path": "pcgf_pluginlib-common/src/at/pcgamingfreaks/Message/Sender/ISendMethod.java",
"license": "gpl-3.0",
"size": 1302
} | [
"org.jetbrains.annotations.Nullable"
] | import org.jetbrains.annotations.Nullable; | import org.jetbrains.annotations.*; | [
"org.jetbrains.annotations"
] | org.jetbrains.annotations; | 2,523,308 |
public void want(final Account.Id id) {
if (id != null && !out.containsKey(id)) {
out.put(id, accountCache.get(id).getAccount());
}
} | void function(final Account.Id id) { if (id != null && !out.containsKey(id)) { out.put(id, accountCache.get(id).getAccount()); } } | /**
* Indicate an account will be needed later on.
*
* @param id identity that will be needed in the future; may be null.
*/ | Indicate an account will be needed later on | want | {
"repo_name": "makholm/gerrit-ceremony",
"path": "gerrit-server/src/main/java/com/google/gerrit/server/account/AccountInfoCacheFactory.java",
"license": "apache-2.0",
"size": 2239
} | [
"com.google.gerrit.reviewdb.Account"
] | import com.google.gerrit.reviewdb.Account; | import com.google.gerrit.reviewdb.*; | [
"com.google.gerrit"
] | com.google.gerrit; | 440,950 |
private void setupStyle() {
this.style.set("version", StringMan.join(this.version, "."));
Map<String, Object> o = new HashMap<>(4);
o.put("color.1", "6");
o.put("color.2", "7");
o.put("color.3", "8");
o.put("color.4", "3");
if (!this.style.contains("color")) {
for (Entry<String, Object> node : o.entrySet()) {
this.style.set(node.getKey(), node.getValue());
}
}
} | void function() { this.style.set(STR, StringMan.join(this.version, ".")); Map<String, Object> o = new HashMap<>(4); o.put(STR, "6"); o.put(STR, "7"); o.put(STR, "8"); o.put(STR, "3"); if (!this.style.contains("color")) { for (Entry<String, Object> node : o.entrySet()) { this.style.set(node.getKey(), node.getValue()); } } } | /**
* Setup the style.yml file
*/ | Setup the style.yml file | setupStyle | {
"repo_name": "SynergyMC/PlotSquared",
"path": "Core/src/main/java/com/intellectualcrafters/plot/PS.java",
"license": "gpl-3.0",
"size": 93631
} | [
"com.intellectualcrafters.plot.util.StringMan",
"java.util.HashMap",
"java.util.Map"
] | import com.intellectualcrafters.plot.util.StringMan; import java.util.HashMap; import java.util.Map; | import com.intellectualcrafters.plot.util.*; import java.util.*; | [
"com.intellectualcrafters.plot",
"java.util"
] | com.intellectualcrafters.plot; java.util; | 617,391 |
@SuppressWarnings("unchecked")
public void put(String key, Versioned<Object> value) {
// acquire write lock
writeLock.lock();
try {
if(this.storeNames.contains(key) || key.equals(STORES_KEY)) {
// Check for backwards compatibility
List<StoreDefinition> storeDefinitions = (List<StoreDefinition>) value.getValue();
StoreDefinitionUtils.validateSchemasAsNeeded(storeDefinitions);
// If the put is on the entire stores.xml key, delete the
// additional stores which do not exist in the specified
// stores.xml
Set<String> storeNamesToDelete = new HashSet<String>();
for(String storeName: this.storeNames) {
storeNamesToDelete.add(storeName);
}
// Add / update the list of store definitions specified in the
// value
StoreDefinitionsMapper mapper = new StoreDefinitionsMapper();
// Update the STORES directory and the corresponding entry in
// metadata cache
Set<String> specifiedStoreNames = new HashSet<String>();
for(StoreDefinition storeDef: storeDefinitions) {
specifiedStoreNames.add(storeDef.getName());
String storeDefStr = mapper.writeStore(storeDef);
Versioned<String> versionedValueStr = new Versioned<String>(storeDefStr,
value.getVersion());
this.storeDefinitionsStorageEngine.put(storeDef.getName(),
versionedValueStr,
"");
// Update the metadata cache
this.metadataCache.put(storeDef.getName(),
new Versioned<Object>(storeDefStr, value.getVersion()));
}
if(key.equals(STORES_KEY)) {
storeNamesToDelete.removeAll(specifiedStoreNames);
resetStoreDefinitions(storeNamesToDelete);
}
// Re-initialize the store definitions
initStoreDefinitions(value.getVersion());
// Update routing strategies
updateRoutingStrategies(getCluster(), getStoreDefList());
} else if(METADATA_KEYS.contains(key)) {
// try inserting into inner store first
putInner(key, convertObjectToString(key, value));
// cache all keys if innerStore put succeeded
metadataCache.put(key, value);
// do special stuff if needed
if(CLUSTER_KEY.equals(key)) {
updateRoutingStrategies((Cluster) value.getValue(), getStoreDefList());
} else if(SYSTEM_STORES_KEY.equals(key))
throw new VoldemortException("Cannot overwrite system store definitions");
} else {
throw new VoldemortException("Unhandled Key:" + key + " for MetadataStore put()");
}
} finally {
writeLock.unlock();
}
} | @SuppressWarnings(STR) void function(String key, Versioned<Object> value) { writeLock.lock(); try { if(this.storeNames.contains(key) key.equals(STORES_KEY)) { List<StoreDefinition> storeDefinitions = (List<StoreDefinition>) value.getValue(); StoreDefinitionUtils.validateSchemasAsNeeded(storeDefinitions); Set<String> storeNamesToDelete = new HashSet<String>(); for(String storeName: this.storeNames) { storeNamesToDelete.add(storeName); } StoreDefinitionsMapper mapper = new StoreDefinitionsMapper(); Set<String> specifiedStoreNames = new HashSet<String>(); for(StoreDefinition storeDef: storeDefinitions) { specifiedStoreNames.add(storeDef.getName()); String storeDefStr = mapper.writeStore(storeDef); Versioned<String> versionedValueStr = new Versioned<String>(storeDefStr, value.getVersion()); this.storeDefinitionsStorageEngine.put(storeDef.getName(), versionedValueStr, STRCannot overwrite system store definitionsSTRUnhandled Key:STR for MetadataStore put()"); } } finally { writeLock.unlock(); } } | /**
* helper function to convert strings to bytes as needed.
*
* @param key
* @param value
*/ | helper function to convert strings to bytes as needed | put | {
"repo_name": "HB-SI/voldemort",
"path": "src/java/voldemort/store/metadata/MetadataStore.java",
"license": "apache-2.0",
"size": 49852
} | [
"java.util.HashSet",
"java.util.List",
"java.util.Set"
] | import java.util.HashSet; import java.util.List; import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 2,220,289 |
private ClientRequest produceRequest(long now, int destination, short acks, int timeout, List<RecordBatch> batches) {
Map<TopicPartition, ByteBuffer> produceRecordsByPartition = new HashMap<TopicPartition, ByteBuffer>(batches.size());
final Map<TopicPartition, RecordBatch> recordsByPartition = new HashMap<TopicPartition, RecordBatch>(batches.size());
for (RecordBatch batch : batches) {
TopicPartition tp = batch.topicPartition;
produceRecordsByPartition.put(tp, (ByteBuffer) batch.records.buffer().flip());
recordsByPartition.put(tp, batch);
} | ClientRequest function(long now, int destination, short acks, int timeout, List<RecordBatch> batches) { Map<TopicPartition, ByteBuffer> produceRecordsByPartition = new HashMap<TopicPartition, ByteBuffer>(batches.size()); final Map<TopicPartition, RecordBatch> recordsByPartition = new HashMap<TopicPartition, RecordBatch>(batches.size()); for (RecordBatch batch : batches) { TopicPartition tp = batch.topicPartition; produceRecordsByPartition.put(tp, (ByteBuffer) batch.records.buffer().flip()); recordsByPartition.put(tp, batch); } | /**
* Create a produce request from the given record batches
*/ | Create a produce request from the given record batches | produceRequest | {
"repo_name": "vkroz/kafka",
"path": "clients/src/main/java/org/apache/kafka/clients/producer/internals/Sender.java",
"license": "apache-2.0",
"size": 26216
} | [
"java.nio.ByteBuffer",
"java.util.HashMap",
"java.util.List",
"java.util.Map",
"org.apache.kafka.clients.ClientRequest",
"org.apache.kafka.common.TopicPartition"
] | import java.nio.ByteBuffer; import java.util.HashMap; import java.util.List; import java.util.Map; import org.apache.kafka.clients.ClientRequest; import org.apache.kafka.common.TopicPartition; | import java.nio.*; import java.util.*; import org.apache.kafka.clients.*; import org.apache.kafka.common.*; | [
"java.nio",
"java.util",
"org.apache.kafka"
] | java.nio; java.util; org.apache.kafka; | 948,005 |
public static Document removeTags(Document dom, String tagName) {
NodeList list;
try {
list = XPathHelper.evaluateXpathExpression(dom, "//" + tagName.toUpperCase());
while (list.getLength() > 0) {
Node sc = list.item(0);
if (sc != null) {
sc.getParentNode().removeChild(sc);
}
list = XPathHelper.evaluateXpathExpression(dom, "//" + tagName.toUpperCase());
}
} catch (XPathExpressionException e) {
LOGGER.error("Error while removing tag " + tagName, e);
}
return dom;
} | static Document function(Document dom, String tagName) { NodeList list; try { list = XPathHelper.evaluateXpathExpression(dom, STR } } catch (XPathExpressionException e) { LOGGER.error(STR + tagName, e); } return dom; } | /**
* Removes all the given tags from the document.
*
* @param dom
* the document object.
* @param tagName
* the tag name, examples: script, style, meta
* @return the changed dom.
*/ | Removes all the given tags from the document | removeTags | {
"repo_name": "saltlab/crawljax-graphdb",
"path": "core/src/main/java/com/crawljax/util/DomUtils.java",
"license": "apache-2.0",
"size": 17646
} | [
"javax.xml.xpath.XPathExpressionException",
"org.w3c.dom.Document",
"org.w3c.dom.NodeList"
] | import javax.xml.xpath.XPathExpressionException; import org.w3c.dom.Document; import org.w3c.dom.NodeList; | import javax.xml.xpath.*; import org.w3c.dom.*; | [
"javax.xml",
"org.w3c.dom"
] | javax.xml; org.w3c.dom; | 1,858,126 |
public String diff_text1(LinkedList<Diff> diffs) {
StringBuilder text = new StringBuilder();
for (Diff aDiff : diffs) {
if (aDiff.operation != Operation.INSERT) {
text.append(aDiff.text);
}
}
return text.toString();
} | String function(LinkedList<Diff> diffs) { StringBuilder text = new StringBuilder(); for (Diff aDiff : diffs) { if (aDiff.operation != Operation.INSERT) { text.append(aDiff.text); } } return text.toString(); } | /**
* Compute and return the source text (all equalities and deletions).
* @param diffs LinkedList of Diff objects.
* @return Source text.
*/ | Compute and return the source text (all equalities and deletions) | diff_text1 | {
"repo_name": "mqshen/gitbucketTest",
"path": "src/main/java/util/diff_match_patch.java",
"license": "apache-2.0",
"size": 103643
} | [
"java.util.LinkedList"
] | import java.util.LinkedList; | import java.util.*; | [
"java.util"
] | java.util; | 627,574 |
Map<String, Serializable> getMap() {
IMap<String, Serializable> attribMap = Hazelcast.getMap(ILabelNameSize.CLUSTER_MAP);
return attribMap;
} | Map<String, Serializable> getMap() { IMap<String, Serializable> attribMap = Hazelcast.getMap(ILabelNameSize.CLUSTER_MAP); return attribMap; } | /**
* Returns the cluster map.
* @return Map
*/ | Returns the cluster map | getMap | {
"repo_name": "MastekLtd/JBEAM",
"path": "supporting_libraries/AdvancedPRE/pre/src/main/java/stg/pr/engine/PREContextImpl.java",
"license": "lgpl-3.0",
"size": 7983
} | [
"com.hazelcast.core.Hazelcast",
"com.hazelcast.core.IMap",
"java.io.Serializable",
"java.util.Map"
] | import com.hazelcast.core.Hazelcast; import com.hazelcast.core.IMap; import java.io.Serializable; import java.util.Map; | import com.hazelcast.core.*; import java.io.*; import java.util.*; | [
"com.hazelcast.core",
"java.io",
"java.util"
] | com.hazelcast.core; java.io; java.util; | 2,388,608 |
private void copyFile(ImgChannel fin, FileSystem outfs, String inName) throws IOException {
ImgChannel fout = outfs.create(inName);
copyFile(fin, fout);
} | void function(ImgChannel fin, FileSystem outfs, String inName) throws IOException { ImgChannel fout = outfs.create(inName); copyFile(fin, fout); } | /**
* Copy a given open file to the a new file in outfs with the name inName.
* @param fin The file to copy from.
* @param outfs The file system to copy to.
* @param inName The name of the file to create on the destination file system.
* @throws IOException If a file cannot be read or written.
*/ | Copy a given open file to the a new file in outfs with the name inName | copyFile | {
"repo_name": "balp/mkgmap",
"path": "src/uk/me/parabola/mkgmap/combiners/GmapsuppBuilder.java",
"license": "gpl-2.0",
"size": 17276
} | [
"java.io.IOException",
"uk.me.parabola.imgfmt.fs.FileSystem",
"uk.me.parabola.imgfmt.fs.ImgChannel"
] | import java.io.IOException; import uk.me.parabola.imgfmt.fs.FileSystem; import uk.me.parabola.imgfmt.fs.ImgChannel; | import java.io.*; import uk.me.parabola.imgfmt.fs.*; | [
"java.io",
"uk.me.parabola"
] | java.io; uk.me.parabola; | 1,105,228 |
public boolean matches(AmazonServiceException output) {
return false;
} | boolean function(AmazonServiceException output) { return false; } | /**
* Default method definition that matches the exception
* with the expected state defined by the acceptor.
* Overriden by each acceptor definition of matches.
*
* @param output Exception thrown by the execution of the operation
* @return False by default.
* When overriden, returns True if it matches, False
* otherwise
*/ | Default method definition that matches the exception with the expected state defined by the acceptor. Overriden by each acceptor definition of matches | matches | {
"repo_name": "loremipsumdolor/CastFast",
"path": "src/com/amazonaws/waiters/WaiterAcceptor.java",
"license": "mit",
"size": 1869
} | [
"com.amazonaws.AmazonServiceException"
] | import com.amazonaws.AmazonServiceException; | import com.amazonaws.*; | [
"com.amazonaws"
] | com.amazonaws; | 648,056 |
public com.atinternet.tracker.avinsights.Media Media(SparseIntArray heartbeat, SparseIntArray bufferHeartbeat) {
return new com.atinternet.tracker.avinsights.Media(events, heartbeat, bufferHeartbeat, null);
} | com.atinternet.tracker.avinsights.Media function(SparseIntArray heartbeat, SparseIntArray bufferHeartbeat) { return new com.atinternet.tracker.avinsights.Media(events, heartbeat, bufferHeartbeat, null); } | /***
* Create new Media
* @param heartbeat heartbeat periods
* @param bufferHeartbeat buffer heartbeat periods
* @return Media instance
*/ | Create new Media | Media | {
"repo_name": "at-internet/atinternet-android-sdk",
"path": "ATMobileAnalytics/Tracker/src/main/java/com/atinternet/tracker/AVInsights.java",
"license": "mit",
"size": 3351
} | [
"android.util.SparseIntArray"
] | import android.util.SparseIntArray; | import android.util.*; | [
"android.util"
] | android.util; | 1,647,261 |
boolean offer(QueueElement<E> queueElement, boolean ignoreSize) {
ParamChecker.notNull(queueElement, "queueElement");
if (queueElement.getPriority() < 0 || queueElement.getPriority() >= priorities) {
throw new IllegalArgumentException("priority out of range: " + queueElement);
}
if (queueElement.inQueue) {
throw new IllegalStateException("queueElement already in a queue: " + queueElement);
}
if (!ignoreSize && currentSize != null && currentSize.get() >= maxSize) {
return false;
}
boolean accepted = queues[queueElement.getPriority()].offer(queueElement);
debug("offer([{0}]), to P[{1}] delay[{2}ms] accepted[{3}]", queueElement.getElement().toString(),
queueElement.getPriority(), queueElement.getDelay(TimeUnit.MILLISECONDS), accepted);
if (accepted) {
if (currentSize != null) {
currentSize.incrementAndGet();
}
queueElement.inQueue = true;
}
return accepted;
} | boolean offer(QueueElement<E> queueElement, boolean ignoreSize) { ParamChecker.notNull(queueElement, STR); if (queueElement.getPriority() < 0 queueElement.getPriority() >= priorities) { throw new IllegalArgumentException(STR + queueElement); } if (queueElement.inQueue) { throw new IllegalStateException(STR + queueElement); } if (!ignoreSize && currentSize != null && currentSize.get() >= maxSize) { return false; } boolean accepted = queues[queueElement.getPriority()].offer(queueElement); debug(STR, queueElement.getElement().toString(), queueElement.getPriority(), queueElement.getDelay(TimeUnit.MILLISECONDS), accepted); if (accepted) { if (currentSize != null) { currentSize.incrementAndGet(); } queueElement.inQueue = true; } return accepted; } | /**
* Insert the specified {@link QueueElement} element into the queue.
*
* @param queueElement the {@link QueueElement} element to add.
* @param ignoreSize if the queue is bound to a maximum size and the maximum size is reached, this parameter (if set
* to <tt>true</tt>) allows to ignore the maximum size and add the element to the queue.
*
* @return <tt>true</tt> if the element has been inserted, <tt>false</tt> if the element was not inserted (the queue
* has reached its maximum size).
*
* @throws NullPointerException if the specified element is null
*/ | Insert the specified <code>QueueElement</code> element into the queue | offer | {
"repo_name": "cbaenziger/oozie",
"path": "core/src/main/java/org/apache/oozie/util/PriorityDelayQueue.java",
"license": "apache-2.0",
"size": 28859
} | [
"java.util.concurrent.TimeUnit"
] | import java.util.concurrent.TimeUnit; | import java.util.concurrent.*; | [
"java.util"
] | java.util; | 251,031 |
protected boolean approveAccess(Configuration config, HttpServletRequest req, HttpServletResponse res) throws IOException {
if (config.isHTTPSrequired() && !"https".equals(req.getScheme())) {
res.sendError(HttpServletResponse.SC_FORBIDDEN, "https required");
return false;
}
if (config.isLocalhostRequired() && !Utility.isLocalhost(req.getRemoteHost())) {
res.sendError(HttpServletResponse.SC_FORBIDDEN, "localhost access only");
return false;
}
return true;
}
private static volatile Configuration configuration; | boolean function(Configuration config, HttpServletRequest req, HttpServletResponse res) throws IOException { if (config.isHTTPSrequired() && !"https".equals(req.getScheme())) { res.sendError(HttpServletResponse.SC_FORBIDDEN, STR); return false; } if (config.isLocalhostRequired() && !Utility.isLocalhost(req.getRemoteHost())) { res.sendError(HttpServletResponse.SC_FORBIDDEN, STR); return false; } return true; } private static volatile Configuration configuration; | /**
* Check if administrative access is allowed. This examines the request scheme
* (http, ftp, https, etc.) and sees if https is required by the configuration.
* It also checks the remote host and sees if localhost access is required.
*
* @param config a <code>Configuration</code> value.
* @param req a <code>HttpServletRequest</code> value.
* @param res a <code>HttpServletResponse</code> value.
* @return True if access is approved, false otherwise.
* @throws IOException if an error occurs.
*/ | Check if administrative access is allowed. This examines the request scheme (http, ftp, https, etc.) and sees if https is required by the configuration. It also checks the remote host and sees if localhost access is required | approveAccess | {
"repo_name": "LeStarch/oodt",
"path": "grid/src/main/java/org/apache/oodt/grid/GridServlet.java",
"license": "apache-2.0",
"size": 4444
} | [
"java.io.IOException",
"javax.servlet.http.HttpServletRequest",
"javax.servlet.http.HttpServletResponse"
] | import java.io.IOException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; | import java.io.*; import javax.servlet.http.*; | [
"java.io",
"javax.servlet"
] | java.io; javax.servlet; | 686,179 |
default Web3jEndpointConsumerBuilder topics(List<String> topics) {
doSetProperty("topics", topics);
return this;
} | default Web3jEndpointConsumerBuilder topics(List<String> topics) { doSetProperty(STR, topics); return this; } | /**
* Topics are order-dependent. Each topic can also be a list of topics.
* Specify multiple topics separated by comma.
*
* The option is a: <code>java.util.List<java.lang.String></code>
* type.
*
* Group: common
*/ | Topics are order-dependent. Each topic can also be a list of topics. Specify multiple topics separated by comma. The option is a: <code>java.util.List<java.lang.String></code> type. Group: common | topics | {
"repo_name": "DariusX/camel",
"path": "core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/Web3jEndpointBuilderFactory.java",
"license": "apache-2.0",
"size": 51259
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,234,871 |
public void addListener(LinkAddListener listener){
this.listeners.add(listener);
}
| void function(LinkAddListener listener){ this.listeners.add(listener); } | /**
* se agrega un listener para avisarle y darle
* el objeto creado.
*
* @param listener
*/ | se agrega un listener para avisarle y darle el objeto creado | addListener | {
"repo_name": "iriber/miGestionSwing",
"path": "src/main/java/com/migestion/swing/navigation/LinkAddObject.java",
"license": "gpl-2.0",
"size": 5228
} | [
"com.migestion.swing.navigation.listeners.LinkAddListener"
] | import com.migestion.swing.navigation.listeners.LinkAddListener; | import com.migestion.swing.navigation.listeners.*; | [
"com.migestion.swing"
] | com.migestion.swing; | 646,896 |
public Map<String, Object> toMap() {
Map<String, Object> results = new HashMap<>();
for (Entry<String, Object> entry : this.map.entrySet()) {
Object value;
if (entry.getValue() == null || NULL.equals(entry.getValue())) {
value = null;
} else if (entry.getValue() instanceof JSONObject) {
value = ((JSONObject) entry.getValue()).toMap();
} else if (entry.getValue() instanceof JSONArray) {
value = ((JSONArray) entry.getValue()).toList();
} else {
value = entry.getValue();
}
results.put(entry.getKey(), value);
}
return results;
} | Map<String, Object> function() { Map<String, Object> results = new HashMap<>(); for (Entry<String, Object> entry : this.map.entrySet()) { Object value; if (entry.getValue() == null NULL.equals(entry.getValue())) { value = null; } else if (entry.getValue() instanceof JSONObject) { value = ((JSONObject) entry.getValue()).toMap(); } else if (entry.getValue() instanceof JSONArray) { value = ((JSONArray) entry.getValue()).toList(); } else { value = entry.getValue(); } results.put(entry.getKey(), value); } return results; } | /**
* Returns a java.util.Map containing all of the entrys in this object. If
* an entry in the object is a JSONArray or JSONObject it will also be
* converted.
* <p>
* Warning: This method assumes that the data structure is acyclical.
*
* @return a java.util.Map containing the entrys of this object
*/ | Returns a java.util.Map containing all of the entrys in this object. If an entry in the object is a JSONArray or JSONObject it will also be converted. Warning: This method assumes that the data structure is acyclical | toMap | {
"repo_name": "xzzpig/PigUtils",
"path": "Json/src/main/java/com/github/xzzpig/pigutils/json/JSONObject.java",
"license": "gpl-3.0",
"size": 59328
} | [
"java.util.HashMap",
"java.util.Map"
] | import java.util.HashMap; import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 1,736,395 |
public static Document xml(String message) throws IOException, ReceivedMessageParseException {
// Ensure the message contains XML declaration
String response = message.startsWith("<?xml")
? message
: "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + message;
try {
return XMLUtils.dbf.newDocumentBuilder().parse(new InputSource(new StringReader(response)));
} catch (SAXException | ParserConfigurationException e) {
throw new ReceivedMessageParseException(e);
}
} | static Document function(String message) throws IOException, ReceivedMessageParseException { String response = message.startsWith("<?xml") ? message : STR1.0\STRutf-8\"?>" + message; try { return XMLUtils.dbf.newDocumentBuilder().parse(new InputSource(new StringReader(response))); } catch (SAXException ParserConfigurationException e) { throw new ReceivedMessageParseException(e); } } | /**
* Parse the given xml message into a xml document node.
*
* @param message XML formatted message.
* @return Return the response as xml node or throws an exception if response is not xml.
* @throws IOException
*/ | Parse the given xml message into a xml document node | xml | {
"repo_name": "tavalin/openhab2-addons",
"path": "addons/binding/org.openhab.binding.yamahareceiver/src/main/java/org/openhab/binding/yamahareceiver/internal/protocol/xml/XMLUtils.java",
"license": "epl-1.0",
"size": 6675
} | [
"java.io.IOException",
"java.io.StringReader",
"javax.xml.parsers.ParserConfigurationException",
"org.openhab.binding.yamahareceiver.internal.protocol.ReceivedMessageParseException",
"org.w3c.dom.Document",
"org.xml.sax.InputSource",
"org.xml.sax.SAXException"
] | import java.io.IOException; import java.io.StringReader; import javax.xml.parsers.ParserConfigurationException; import org.openhab.binding.yamahareceiver.internal.protocol.ReceivedMessageParseException; import org.w3c.dom.Document; import org.xml.sax.InputSource; import org.xml.sax.SAXException; | import java.io.*; import javax.xml.parsers.*; import org.openhab.binding.yamahareceiver.internal.protocol.*; import org.w3c.dom.*; import org.xml.sax.*; | [
"java.io",
"javax.xml",
"org.openhab.binding",
"org.w3c.dom",
"org.xml.sax"
] | java.io; javax.xml; org.openhab.binding; org.w3c.dom; org.xml.sax; | 1,508,986 |
requireNonNull(context, "context is null");
final List<SupportsResultSetHoldability> all = new ArrayList<>();
for (final ResultSetHoldability value : ResultSetHoldability.values()) {
all.add(context.supportsResultSetHoldability(value.getRawValue()));
}
return all;
}
// -----------------------------------------------------------------------------------------------------------------
@XmlAttribute(required = true)
private int holdability;
// -----------------------------------------------------------------------------------------------------------------
@XmlValue
private Boolean value; | requireNonNull(context, STR); final List<SupportsResultSetHoldability> all = new ArrayList<>(); for (final ResultSetHoldability value : ResultSetHoldability.values()) { all.add(context.supportsResultSetHoldability(value.getRawValue())); } return all; } @XmlAttribute(required = true) private int holdability; private Boolean value; | /**
* Invokes {@link Context#supportsResultSetHoldability(int)} method for all holdabilities and returns bound values.
*
* @param context a context.
* @return a list of bound values.
* @throws SQLException if a database error occurs.
*/ | Invokes <code>Context#supportsResultSetHoldability(int)</code> method for all holdabilities and returns bound values | getAllInstances | {
"repo_name": "jinahya/sql-database-meta-data-bind",
"path": "src/main/java/com/github/jinahya/database/metadata/bind/SupportsResultSetHoldability.java",
"license": "apache-2.0",
"size": 2520
} | [
"java.util.ArrayList",
"java.util.List",
"javax.xml.bind.annotation.XmlAttribute"
] | import java.util.ArrayList; import java.util.List; import javax.xml.bind.annotation.XmlAttribute; | import java.util.*; import javax.xml.bind.annotation.*; | [
"java.util",
"javax.xml"
] | java.util; javax.xml; | 2,221,689 |
public Serializer writeBoolean(Boolean value) throws IOException {
if (null == value) return writeNull();
writeRawString(value.toString());
return this;
} | Serializer function(Boolean value) throws IOException { if (null == value) return writeNull(); writeRawString(value.toString()); return this; } | /**
* Method to write a boolean value to the output stream.
* @param value The Boolean object to write out as a JSON boolean.
* @throws IOException Thrown if an error occurs during write.
*/ | Method to write a boolean value to the output stream | writeBoolean | {
"repo_name": "kgibm/open-liberty",
"path": "dev/com.ibm.json4j/src/com/ibm/json/java/internal/Serializer.java",
"license": "epl-1.0",
"size": 10208
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,391,211 |
@Test
public void testEqualsWithDifferentObjectType()
{
final CoordinateZM coord = new CoordinateZM(0.0, 0.0, 0.0, 0.0);
//noinspection EqualsWithItself,UnnecessaryBoxing,EqualsBetweenInconvertibleTypes
assertFalse("Equals should fail on a different object type",
coord.equals(Integer.valueOf(0)));
} | void function() { final CoordinateZM coord = new CoordinateZM(0.0, 0.0, 0.0, 0.0); assertFalse(STR, coord.equals(Integer.valueOf(0))); } | /**
* Test equals with a different object type
*/ | Test equals with a different object type | testEqualsWithDifferentObjectType | {
"repo_name": "GitHubRGI/swagd",
"path": "GeoPackage/src/test/java/com/rgi/geopackage/features/geometry/zm/CoordinateZMTest.java",
"license": "mit",
"size": 8895
} | [
"org.junit.Assert"
] | import org.junit.Assert; | import org.junit.*; | [
"org.junit"
] | org.junit; | 145,512 |
public static ImmutableMap <String, String> appleTargetPlatformEnv(
ApplePlatform platform, DottedVersion sdkVersion) {
ImmutableMap.Builder<String, String> builder = ImmutableMap.builder();
builder
.put(AppleConfiguration.APPLE_SDK_VERSION_ENV_NAME,
sdkVersion.toStringWithMinimumComponents(2))
.put(AppleConfiguration.APPLE_SDK_PLATFORM_ENV_NAME,
platform.getNameInPlist());
return builder.build();
} | static ImmutableMap <String, String> function( ApplePlatform platform, DottedVersion sdkVersion) { ImmutableMap.Builder<String, String> builder = ImmutableMap.builder(); builder .put(AppleConfiguration.APPLE_SDK_VERSION_ENV_NAME, sdkVersion.toStringWithMinimumComponents(2)) .put(AppleConfiguration.APPLE_SDK_PLATFORM_ENV_NAME, platform.getNameInPlist()); return builder.build(); } | /**
* Returns a map of environment variables (derived from configuration) that should be propagated
* for actions pertaining to building applications for apple platforms. These environment
* variables are needed to use apple toolkits. Keys are variable names and values are their
* corresponding values.
*/ | Returns a map of environment variables (derived from configuration) that should be propagated for actions pertaining to building applications for apple platforms. These environment variables are needed to use apple toolkits. Keys are variable names and values are their corresponding values | appleTargetPlatformEnv | {
"repo_name": "cushon/bazel",
"path": "src/main/java/com/google/devtools/build/lib/rules/apple/AppleConfiguration.java",
"license": "apache-2.0",
"size": 20631
} | [
"com.google.common.collect.ImmutableMap"
] | import com.google.common.collect.ImmutableMap; | import com.google.common.collect.*; | [
"com.google.common"
] | com.google.common; | 2,618,525 |
@Test
public void testQueryInstantInsideInterval() throws IOException, QueryEvaluationException {
try(MongoTemporalIndexer tIndexer = new MongoTemporalIndexer()) {
tIndexer.setConf(conf);
tIndexer.init();
// tiB02_E30 read as: Begins 2 seconds, ends at 30 seconds
// these should not match as they are not instances.
tIndexer.storeStatement(convertStatement(spo_B03_E20));
tIndexer.storeStatement(convertStatement(spo_B02_E30));
tIndexer.storeStatement(convertStatement(spo_B02_E40));
tIndexer.storeStatement(convertStatement(spo_B02_E31));
tIndexer.storeStatement(convertStatement(spo_B30_E32));
// seriesSpo[s] and seriesTs[s] are statements and instants for s seconds after the uniform time.
final TemporalInterval searchInsideInterval = tvB02_E31; // from 2 to 31 seconds
final int beginningSeconds = 2; // <== logic here, and next few lines.
final int endingSeconds = 31;
final int expectedResultCount = endingSeconds - beginningSeconds - 1; // 3,4,...,30 seconds.
for (int s = 0; s <= 40; s++) {
tIndexer.storeStatement(convertStatement(seriesSpo[s]));
}
CloseableIteration<Statement, QueryEvaluationException> iter;
iter = tIndexer.queryInstantInsideInterval(searchInsideInterval, EMPTY_CONSTRAINTS);
int count = 0;
while (iter.hasNext()) {
final Statement s = iter.next();
final Statement nextExpectedStatement = seriesSpo[count + beginningSeconds + 1]; // <== logic here
assertTrue("Should match: " + nextExpectedStatement + " == " + s, nextExpectedStatement.equals(s));
count++;
}
assertEquals("Should find count of rows.", expectedResultCount, count);
}
} | void function() throws IOException, QueryEvaluationException { try(MongoTemporalIndexer tIndexer = new MongoTemporalIndexer()) { tIndexer.setConf(conf); tIndexer.init(); tIndexer.storeStatement(convertStatement(spo_B03_E20)); tIndexer.storeStatement(convertStatement(spo_B02_E30)); tIndexer.storeStatement(convertStatement(spo_B02_E40)); tIndexer.storeStatement(convertStatement(spo_B02_E31)); tIndexer.storeStatement(convertStatement(spo_B30_E32)); final TemporalInterval searchInsideInterval = tvB02_E31; final int beginningSeconds = 2; final int endingSeconds = 31; final int expectedResultCount = endingSeconds - beginningSeconds - 1; for (int s = 0; s <= 40; s++) { tIndexer.storeStatement(convertStatement(seriesSpo[s])); } CloseableIteration<Statement, QueryEvaluationException> iter; iter = tIndexer.queryInstantInsideInterval(searchInsideInterval, EMPTY_CONSTRAINTS); int count = 0; while (iter.hasNext()) { final Statement s = iter.next(); final Statement nextExpectedStatement = seriesSpo[count + beginningSeconds + 1]; assertTrue(STR + nextExpectedStatement + STR + s, nextExpectedStatement.equals(s)); count++; } assertEquals(STR, expectedResultCount, count); } } | /**
* Test instant inside given interval.
* Instance {before, after, inside} given Interval
*/ | Test instant inside given interval. Instance {before, after, inside} given Interval | testQueryInstantInsideInterval | {
"repo_name": "kchilton2/incubator-rya",
"path": "extras/indexing/src/test/java/org/apache/rya/indexing/mongo/MongoTemporalIndexerIT.java",
"license": "apache-2.0",
"size": 37108
} | [
"java.io.IOException",
"org.apache.rya.indexing.TemporalInterval",
"org.apache.rya.indexing.mongodb.temporal.MongoTemporalIndexer",
"org.eclipse.rdf4j.common.iteration.CloseableIteration",
"org.eclipse.rdf4j.model.Statement",
"org.eclipse.rdf4j.query.QueryEvaluationException",
"org.junit.Assert"
] | import java.io.IOException; import org.apache.rya.indexing.TemporalInterval; import org.apache.rya.indexing.mongodb.temporal.MongoTemporalIndexer; import org.eclipse.rdf4j.common.iteration.CloseableIteration; import org.eclipse.rdf4j.model.Statement; import org.eclipse.rdf4j.query.QueryEvaluationException; import org.junit.Assert; | import java.io.*; import org.apache.rya.indexing.*; import org.apache.rya.indexing.mongodb.temporal.*; import org.eclipse.rdf4j.common.iteration.*; import org.eclipse.rdf4j.model.*; import org.eclipse.rdf4j.query.*; import org.junit.*; | [
"java.io",
"org.apache.rya",
"org.eclipse.rdf4j",
"org.junit"
] | java.io; org.apache.rya; org.eclipse.rdf4j; org.junit; | 1,956,669 |
public int[] drawObservation(int n, double[] distribution) {
initRandom();
int[] histogram = new int[partition.length];
Arrays.fill(histogram, 0);
int count;
// I was using a poisson, but the poisson variate generator
// goes berzerk for lambda above ~500.
if (n < 100) {
count = random.GetPoisson();
}
else {
// p(N(100, 10) <= 0) = 7.619853e-24
count = (int) Math.round(random.nextGaussian(n, n));
}
for (int i=0; i<count; i++) {
histogram[random.GetDiscrete(distribution)]++;
}
return histogram;
} | int[] function(int n, double[] distribution) { initRandom(); int[] histogram = new int[partition.length]; Arrays.fill(histogram, 0); int count; if (n < 100) { count = random.GetPoisson(); } else { count = (int) Math.round(random.nextGaussian(n, n)); } for (int i=0; i<count; i++) { histogram[random.GetDiscrete(distribution)]++; } return histogram; } | /**
* Draw a count vector from the probability distribution provided.
*
* @param n The <i>expected</i> total number of counts in the returned vector. The actual number is ~ Poisson(<code>n</code>)
*/ | Draw a count vector from the probability distribution provided | drawObservation | {
"repo_name": "tweninger/nina",
"path": "src/edu/nd/nina/math/Dirichlet.java",
"license": "lgpl-3.0",
"size": 44587
} | [
"java.util.Arrays"
] | import java.util.Arrays; | import java.util.*; | [
"java.util"
] | java.util; | 814,395 |
public TrackingEvent withEventTime(DateTime eventTime) {
this.eventTime = eventTime;
return this;
} | TrackingEvent function(DateTime eventTime) { this.eventTime = eventTime; return this; } | /**
* Set the eventTime value.
*
* @param eventTime the eventTime value to set
* @return the TrackingEvent object itself.
*/ | Set the eventTime value | withEventTime | {
"repo_name": "navalev/azure-sdk-for-java",
"path": "sdk/logic/mgmt-v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/TrackingEvent.java",
"license": "mit",
"size": 4278
} | [
"org.joda.time.DateTime"
] | import org.joda.time.DateTime; | import org.joda.time.*; | [
"org.joda.time"
] | org.joda.time; | 356,676 |
protected void traceResponse(HttpWebRequest request,
ByteArrayOutputStream memoryStream) throws XMLStreamException,
IOException, EWSHttpException {
this.service.processHttpResponseHeaders(
TraceFlags.EwsResponseHttpHeaders, request);
String contentType = request.getResponseContentType();
if (!isNullOrEmpty(contentType)
&& (contentType.startsWith("text/") || contentType
.startsWith("application/soap"))) {
this.service.traceXml(TraceFlags.EwsResponse, memoryStream);
} else {
this.service.traceMessage(TraceFlags.EwsResponse,
"Non-textual response");
}
} | void function(HttpWebRequest request, ByteArrayOutputStream memoryStream) throws XMLStreamException, IOException, EWSHttpException { this.service.processHttpResponseHeaders( TraceFlags.EwsResponseHttpHeaders, request); String contentType = request.getResponseContentType(); if (!isNullOrEmpty(contentType) && (contentType.startsWith("text/") contentType .startsWith(STR))) { this.service.traceXml(TraceFlags.EwsResponse, memoryStream); } else { this.service.traceMessage(TraceFlags.EwsResponse, STR); } } | /**
* Traces the response.
*
* @param request
* The response.
* @param memoryStream
* The response content in a MemoryStream.
* @throws javax.xml.stream.XMLStreamException
* the xML stream exception
* @throws java.io.IOException
* Signals that an I/O exception has occurred.
* @throws microsoft.exchange.webservices.data.EWSHttpException
* the eWS http exception
*/ | Traces the response | traceResponse | {
"repo_name": "vboctor/ews-java-api",
"path": "src/main/java/microsoft/exchange/webservices/data/ServiceRequestBase.java",
"license": "mit",
"size": 30594
} | [
"java.io.ByteArrayOutputStream",
"java.io.IOException",
"javax.xml.stream.XMLStreamException"
] | import java.io.ByteArrayOutputStream; import java.io.IOException; import javax.xml.stream.XMLStreamException; | import java.io.*; import javax.xml.stream.*; | [
"java.io",
"javax.xml"
] | java.io; javax.xml; | 923,444 |
public static CurrencyParameterSensitivity.Builder builder() {
return new CurrencyParameterSensitivity.Builder();
}
private CurrencyParameterSensitivity(
MarketDataName<?> marketDataName,
List<? extends ParameterMetadata> parameterMetadata,
Currency currency,
DoubleArray sensitivity,
List<ParameterSize> parameterSplit) {
JodaBeanUtils.notNull(marketDataName, "marketDataName");
JodaBeanUtils.notNull(parameterMetadata, "parameterMetadata");
JodaBeanUtils.notNull(currency, "currency");
JodaBeanUtils.notNull(sensitivity, "sensitivity");
this.marketDataName = marketDataName;
this.parameterMetadata = ImmutableList.copyOf(parameterMetadata);
this.currency = currency;
this.sensitivity = sensitivity;
this.parameterSplit = (parameterSplit != null ? ImmutableList.copyOf(parameterSplit) : null);
validate();
} | static CurrencyParameterSensitivity.Builder function() { return new CurrencyParameterSensitivity.Builder(); } private CurrencyParameterSensitivity( MarketDataName<?> marketDataName, List<? extends ParameterMetadata> parameterMetadata, Currency currency, DoubleArray sensitivity, List<ParameterSize> parameterSplit) { JodaBeanUtils.notNull(marketDataName, STR); JodaBeanUtils.notNull(parameterMetadata, STR); JodaBeanUtils.notNull(currency, STR); JodaBeanUtils.notNull(sensitivity, STR); this.marketDataName = marketDataName; this.parameterMetadata = ImmutableList.copyOf(parameterMetadata); this.currency = currency; this.sensitivity = sensitivity; this.parameterSplit = (parameterSplit != null ? ImmutableList.copyOf(parameterSplit) : null); validate(); } | /**
* Returns a builder used to create an instance of the bean.
* @return the builder, not null
*/ | Returns a builder used to create an instance of the bean | builder | {
"repo_name": "OpenGamma/Strata",
"path": "modules/market/src/main/java/com/opengamma/strata/market/param/CurrencyParameterSensitivity.java",
"license": "apache-2.0",
"size": 39827
} | [
"com.google.common.collect.ImmutableList",
"com.opengamma.strata.basics.currency.Currency",
"com.opengamma.strata.collect.array.DoubleArray",
"com.opengamma.strata.data.MarketDataName",
"java.util.List",
"org.joda.beans.JodaBeanUtils"
] | import com.google.common.collect.ImmutableList; import com.opengamma.strata.basics.currency.Currency; import com.opengamma.strata.collect.array.DoubleArray; import com.opengamma.strata.data.MarketDataName; import java.util.List; import org.joda.beans.JodaBeanUtils; | import com.google.common.collect.*; import com.opengamma.strata.basics.currency.*; import com.opengamma.strata.collect.array.*; import com.opengamma.strata.data.*; import java.util.*; import org.joda.beans.*; | [
"com.google.common",
"com.opengamma.strata",
"java.util",
"org.joda.beans"
] | com.google.common; com.opengamma.strata; java.util; org.joda.beans; | 8,433 |
@Test
public void testConvertToWeekdays() throws Exception {
String [] daysOfWeek = {"Sunday", "Monday", "Tuesday", "Wednesday"};
CronSpecialChars[] weekdays= ScheduleOptionsUtil.convertToWeekdays(daysOfWeek);
assertEquals(CronSpecialChars.SUN,weekdays[0]);
assertEquals(CronSpecialChars.MON,weekdays[1]);
assertEquals(CronSpecialChars.TUE,weekdays[2]);
assertEquals(CronSpecialChars.WED,weekdays[3]);
} | void function() throws Exception { String [] daysOfWeek = {STR, STR, STR, STR}; CronSpecialChars[] weekdays= ScheduleOptionsUtil.convertToWeekdays(daysOfWeek); assertEquals(CronSpecialChars.SUN,weekdays[0]); assertEquals(CronSpecialChars.MON,weekdays[1]); assertEquals(CronSpecialChars.TUE,weekdays[2]); assertEquals(CronSpecialChars.WED,weekdays[3]); } | /**
* This method test's ConvertToWeekDays method.
* @throws Exception
*/ | This method test's ConvertToWeekDays method | testConvertToWeekdays | {
"repo_name": "blackcathacker/kc.preclean",
"path": "coeus-code/src/test/java/org/kuali/kra/committee/web/struts/form/schedule/util/ScheduleOptionsUtilTest.java",
"license": "apache-2.0",
"size": 2864
} | [
"org.junit.Assert",
"org.kuali.coeus.common.committee.impl.web.struts.form.schedule.util.ScheduleOptionsUtil",
"org.kuali.coeus.sys.framework.scheduling.util.CronSpecialChars"
] | import org.junit.Assert; import org.kuali.coeus.common.committee.impl.web.struts.form.schedule.util.ScheduleOptionsUtil; import org.kuali.coeus.sys.framework.scheduling.util.CronSpecialChars; | import org.junit.*; import org.kuali.coeus.common.committee.impl.web.struts.form.schedule.util.*; import org.kuali.coeus.sys.framework.scheduling.util.*; | [
"org.junit",
"org.kuali.coeus"
] | org.junit; org.kuali.coeus; | 1,661,952 |
// @Override
public void setDrawerState(Boolean state) {
if (state)
mDrawerLayout.openDrawer(Gravity.START);
else
mDrawerLayout.closeDrawer(Gravity.START);
} | if (state) mDrawerLayout.openDrawer(Gravity.START); else mDrawerLayout.closeDrawer(Gravity.START); } | /**
* Sets the drawer state.
*
* @param state
* True: Open drawer if closed. False: Close drawer if open.
*/ | Sets the drawer state | setDrawerState | {
"repo_name": "praveendath92/Cap.",
"path": "src/in/co/praveenkumar/scap/activities/NavigationDrawer.java",
"license": "gpl-2.0",
"size": 2469
} | [
"android.view.Gravity"
] | import android.view.Gravity; | import android.view.*; | [
"android.view"
] | android.view; | 1,776,259 |
@Override
public Adapter createBlueprintAdapter() {
if (blueprintItemProvider == null) {
blueprintItemProvider = new BlueprintItemProvider(this);
}
return blueprintItemProvider;
}
protected CompletionNotificationAdapterItemProvider completionNotificationAdapterItemProvider; | Adapter function() { if (blueprintItemProvider == null) { blueprintItemProvider = new BlueprintItemProvider(this); } return blueprintItemProvider; } protected CompletionNotificationAdapterItemProvider completionNotificationAdapterItemProvider; | /**
* This creates an adapter for a
* {@link org.enterprisedomain.classmaker.Blueprint}. <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/ | This creates an adapter for a <code>org.enterprisedomain.classmaker.Blueprint</code>. | createBlueprintAdapter | {
"repo_name": "enterpriseDomain/ClassMaker",
"path": "bundles/org.enterprisedomain.classmaker.edit/src/org/enterprisedomain/classmaker/provider/ClassMakerItemProviderAdapterFactory.java",
"license": "apache-2.0",
"size": 19897
} | [
"org.eclipse.emf.common.notify.Adapter"
] | import org.eclipse.emf.common.notify.Adapter; | import org.eclipse.emf.common.notify.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 1,572,729 |
public static elemental.html.DivElement createSectionShortcut(
Resources res, int modifiers, String shortcutKey) {
elemental.html.DivElement element = Elements.createDivElement(res.awesomeBoxCss().shortcut());
// Builds a shortcut key string based on the modifiers given
element.setTextContent(formatShortcutAsString(modifiers, shortcutKey));
return element;
}
private static ClientOs clientOs = GWT.create(ClientOs.class); | static elemental.html.DivElement function( Resources res, int modifiers, String shortcutKey) { elemental.html.DivElement element = Elements.createDivElement(res.awesomeBoxCss().shortcut()); element.setTextContent(formatShortcutAsString(modifiers, shortcutKey)); return element; } private static ClientOs clientOs = GWT.create(ClientOs.class); | /**
* Creates a element with the OS appropriate text for the shortcut consisting
* of the specified modifier keys and character.
*
* @param modifiers A binary OR of the appropriate ModifierKeys constants
* @return a div containing the shortcut text
*/ | Creates a element with the OS appropriate text for the shortcut consisting of the specified modifier keys and character | createSectionShortcut | {
"repo_name": "PP888/collide",
"path": "java/com/google/collide/client/search/awesomebox/AwesomeBoxUtils.java",
"license": "apache-2.0",
"size": 3049
} | [
"com.google.collide.client.ClientOs",
"com.google.collide.client.search.awesomebox.AwesomeBox",
"com.google.collide.client.util.Elements",
"com.google.gwt.core.client.GWT"
] | import com.google.collide.client.ClientOs; import com.google.collide.client.search.awesomebox.AwesomeBox; import com.google.collide.client.util.Elements; import com.google.gwt.core.client.GWT; | import com.google.collide.client.*; import com.google.collide.client.search.awesomebox.*; import com.google.collide.client.util.*; import com.google.gwt.core.client.*; | [
"com.google.collide",
"com.google.gwt"
] | com.google.collide; com.google.gwt; | 2,749,579 |
private String getCurrentISOTimeInUTF8() {
SimpleDateFormat df = new SimpleDateFormat("YYYY-MM-DD'T'hh:mm:ss");
String timeNow = df.format(new Date());
return timeNow;
}
public static class SynchronizedKey {
byte[] seedSkey;
String keyIdentifier;
Date seedCreationDate;
public SynchronizedKey(byte[] seedSkey, String keyIdentifier, Date seedCreationDate) {
super();
this.seedSkey = seedSkey;
this.keyIdentifier = keyIdentifier;
this.seedCreationDate = seedCreationDate;
}
| String function() { SimpleDateFormat df = new SimpleDateFormat(STR); String timeNow = df.format(new Date()); return timeNow; } public static class SynchronizedKey { byte[] seedSkey; String keyIdentifier; Date seedCreationDate; public SynchronizedKey(byte[] seedSkey, String keyIdentifier, Date seedCreationDate) { super(); this.seedSkey = seedSkey; this.keyIdentifier = keyIdentifier; this.seedCreationDate = seedCreationDate; } | /**
* Get current ISO time
* @return current time in String
* @throws NoSuchAlgorithmException
* @throws NoSuchProviderException
*/ | Get current ISO time | getCurrentISOTimeInUTF8 | {
"repo_name": "krishna174/Java_C",
"path": "AadharValidation-PFX/src/com/pmc/acc/ekyc/auth/device/helper/AuthAUADataCreator.java",
"license": "gpl-2.0",
"size": 18490
} | [
"com.tin.aadhaar.uidai.auth.device.helper.AuthAUADataCreator",
"java.text.SimpleDateFormat",
"java.util.Date"
] | import com.tin.aadhaar.uidai.auth.device.helper.AuthAUADataCreator; import java.text.SimpleDateFormat; import java.util.Date; | import com.tin.aadhaar.uidai.auth.device.helper.*; import java.text.*; import java.util.*; | [
"com.tin.aadhaar",
"java.text",
"java.util"
] | com.tin.aadhaar; java.text; java.util; | 2,054,636 |
public void closeStatement(PreparedStatement ps) throws SQLException; | void function(PreparedStatement ps) throws SQLException; | /**
* Close a prepared or callable statement opened using <tt>prepareStatement()</tt> or <tt>prepareCallableStatement()</tt>
*/ | Close a prepared or callable statement opened using prepareStatement() or prepareCallableStatement() | closeStatement | {
"repo_name": "ControlSystemStudio/cs-studio",
"path": "thirdparty/plugins/org.csstudio.platform.libs.hibernate/project/core/src/main/java/org/hibernate/jdbc/Batcher.java",
"license": "epl-1.0",
"size": 7073
} | [
"java.sql.PreparedStatement",
"java.sql.SQLException"
] | import java.sql.PreparedStatement; import java.sql.SQLException; | import java.sql.*; | [
"java.sql"
] | java.sql; | 769,498 |
private void findFileGaps() {
log.debug("Looking for file gaps.");
if (fileGaps == null)
fileGaps = new TreeSet<FileHashMapEntry<K>>(
new FileHashMapEntryGapComparator());
else
fileGaps.clear();
if (currentSize() > 0) {
List<FileHashMapEntry<K>> entries = getSortedEntries();
FileHashMapEntry<K> previous = null;
Iterator<FileHashMapEntry<K>> it = entries.iterator();
// Handle the first one specially.
FileHashMapEntry<K> entry = it.next();
long pos = entry.getFilePosition();
int size = entry.getObjectSize();
if (pos > 0) {
// There's a gap at the beginning.
log.debug("First entry is at pos " + pos + ", size=" + size);
size = (int) pos;
log.debug("Gap at position 0 of size " + size);
fileGaps.add(new FileHashMapEntry<K>((long) 0, size));
}
previous = entry;
while (it.hasNext()) {
entry = it.next();
long previousPos = previous.getFilePosition();
long possibleGapPos = previousPos + previous.getObjectSize();
pos = entry.getFilePosition();
assert (pos > previousPos);
if (possibleGapPos != pos) {
int gapSize = (int) (pos - possibleGapPos);
log.debug("Gap at position " + possibleGapPos + " of size "
+ gapSize);
fileGaps.add(new FileHashMapEntry<K>(possibleGapPos,
gapSize));
}
previous = entry;
}
}
} | void function() { log.debug(STR); if (fileGaps == null) fileGaps = new TreeSet<FileHashMapEntry<K>>( new FileHashMapEntryGapComparator()); else fileGaps.clear(); if (currentSize() > 0) { List<FileHashMapEntry<K>> entries = getSortedEntries(); FileHashMapEntry<K> previous = null; Iterator<FileHashMapEntry<K>> it = entries.iterator(); FileHashMapEntry<K> entry = it.next(); long pos = entry.getFilePosition(); int size = entry.getObjectSize(); if (pos > 0) { log.debug(STR + pos + STR + size); size = (int) pos; log.debug(STR + size); fileGaps.add(new FileHashMapEntry<K>((long) 0, size)); } previous = entry; while (it.hasNext()) { entry = it.next(); long previousPos = previous.getFilePosition(); long possibleGapPos = previousPos + previous.getObjectSize(); pos = entry.getFilePosition(); assert (pos > previousPos); if (possibleGapPos != pos) { int gapSize = (int) (pos - possibleGapPos); log.debug(STR + possibleGapPos + STR + gapSize); fileGaps.add(new FileHashMapEntry<K>(possibleGapPos, gapSize)); } previous = entry; } } } | /**
* Locate gaps in the file by traversing the index. Initializes or
* reinitializes the fileGaps instance variable.
*/ | Locate gaps in the file by traversing the index. Initializes or reinitializes the fileGaps instance variable | findFileGaps | {
"repo_name": "jbgi/replics",
"path": "src/replics/utils/FilesHashMap.java",
"license": "gpl-3.0",
"size": 45652
} | [
"java.util.Iterator",
"java.util.List",
"java.util.TreeSet"
] | import java.util.Iterator; import java.util.List; import java.util.TreeSet; | import java.util.*; | [
"java.util"
] | java.util; | 910,265 |
@Override
public List<String> getErrorMessages() {
return errorMessages_;
}
| List<String> function() { return errorMessages_; } | /**
* getErrorMessages
*
* Returns a list of error messages from the validation
*
* <pre>
* Version Date Developer Description
* 0.1 17/07/2012 Genevieve Turner(GT) Initial
* </pre>
*
* @return A list of error messages
* @see au.edu.anu.datacommons.publish.Validate#getErrorMessages()
*/ | getErrorMessages Returns a list of error messages from the validation <code> Version Date Developer Description 0.1 17/07/2012 Genevieve Turner(GT) Initial </code> | getErrorMessages | {
"repo_name": "anu-doi/anudc",
"path": "DataCommons/src/main/java/au/edu/anu/datacommons/publish/ANDSValidate.java",
"license": "gpl-3.0",
"size": 16217
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,242,724 |
public void write(byte[] buffer) {
try {
if(mmOutStream != null) {
mmOutStream.write(buffer);
mHandler.obtainMessage(MESSAGE_WRITE, buffer.length, -1, buffer).sendToTarget();
}
} catch (IOException e) {
Log.e(TAG, "BTHandShakeSocketTread write failed: ", e);
}
} | void function(byte[] buffer) { try { if(mmOutStream != null) { mmOutStream.write(buffer); mHandler.obtainMessage(MESSAGE_WRITE, buffer.length, -1, buffer).sendToTarget(); } } catch (IOException e) { Log.e(TAG, STR, e); } } | /**
* Write to the connected OutStream.
* @param buffer The bytes to write
*/ | Write to the connected OutStream | write | {
"repo_name": "DrJukka/BtInsecureSync",
"path": "btpollingsynclib/src/main/java/org/thaliproject/p2p/btpollingsynclib/BTHandShakeSocketTread.java",
"license": "mit",
"size": 3025
} | [
"android.util.Log",
"java.io.IOException"
] | import android.util.Log; import java.io.IOException; | import android.util.*; import java.io.*; | [
"android.util",
"java.io"
] | android.util; java.io; | 1,277,366 |
static private File getAcceleratorsSysDirectory() {
return new File(ResourceController.getResourceController().getResourceBaseDir(), "accelerators");
} | static File function() { return new File(ResourceController.getResourceController().getResourceBaseDir(), STR); } | /**
* A simple help function to get the directory where to search for XSLT
* export files distributed with Freeplane.
* @return The system directory where XSLT export files are supposed to be.
*/ | A simple help function to get the directory where to search for XSLT export files distributed with Freeplane | getAcceleratorsSysDirectory | {
"repo_name": "lcrees/freeplane",
"path": "freeplane/src/main/java/org/freeplane/features/mode/mindmapmode/LoadAcceleratorPresetsAction.java",
"license": "gpl-2.0",
"size": 4369
} | [
"java.io.File",
"org.freeplane.core.resources.ResourceController"
] | import java.io.File; import org.freeplane.core.resources.ResourceController; | import java.io.*; import org.freeplane.core.resources.*; | [
"java.io",
"org.freeplane.core"
] | java.io; org.freeplane.core; | 480,292 |
// TODO: This can be moved to IndexNameExpressionResolver too, but this means that we will support wildcards and other expressions
// in the index,bulk,update and delete apis.
public String resolveIndexRouting(@Nullable String parent, @Nullable String routing, String aliasOrIndex) {
if (aliasOrIndex == null) {
if (routing == null) {
return parent;
}
return routing;
}
AliasOrIndex result = getAliasAndIndexLookup().get(aliasOrIndex);
if (result == null || result.isAlias() == false) {
if (routing == null) {
return parent;
}
return routing;
}
AliasOrIndex.Alias alias = (AliasOrIndex.Alias) result;
if (result.getIndices().size() > 1) {
String[] indexNames = new String[result.getIndices().size()];
int i = 0;
for (IndexMetaData indexMetaData : result.getIndices()) {
indexNames[i++] = indexMetaData.getIndex();
}
throw new IllegalArgumentException("Alias [" + aliasOrIndex + "] has more than one index associated with it [" + Arrays.toString(indexNames) + "], can't execute a single index op");
}
AliasMetaData aliasMd = alias.getFirstAliasMetaData();
if (aliasMd.indexRouting() != null) {
if (aliasMd.indexRouting().indexOf(',') != -1) {
throw new IllegalArgumentException("index/alias [" + aliasOrIndex + "] provided with routing value [" + aliasMd.getIndexRouting() + "] that resolved to several routing values, rejecting operation");
}
if (routing != null) {
if (!routing.equals(aliasMd.indexRouting())) {
throw new IllegalArgumentException("Alias [" + aliasOrIndex + "] has index routing associated with it [" + aliasMd.indexRouting() + "], and was provided with routing value [" + routing + "], rejecting operation");
}
}
// Alias routing overrides the parent routing (if any).
return aliasMd.indexRouting();
}
if (routing == null) {
return parent;
}
return routing;
} | String function(@Nullable String parent, @Nullable String routing, String aliasOrIndex) { if (aliasOrIndex == null) { if (routing == null) { return parent; } return routing; } AliasOrIndex result = getAliasAndIndexLookup().get(aliasOrIndex); if (result == null result.isAlias() == false) { if (routing == null) { return parent; } return routing; } AliasOrIndex.Alias alias = (AliasOrIndex.Alias) result; if (result.getIndices().size() > 1) { String[] indexNames = new String[result.getIndices().size()]; int i = 0; for (IndexMetaData indexMetaData : result.getIndices()) { indexNames[i++] = indexMetaData.getIndex(); } throw new IllegalArgumentException(STR + aliasOrIndex + STR + Arrays.toString(indexNames) + STR); } AliasMetaData aliasMd = alias.getFirstAliasMetaData(); if (aliasMd.indexRouting() != null) { if (aliasMd.indexRouting().indexOf(',') != -1) { throw new IllegalArgumentException(STR + aliasOrIndex + STR + aliasMd.getIndexRouting() + STR); } if (routing != null) { if (!routing.equals(aliasMd.indexRouting())) { throw new IllegalArgumentException(STR + aliasOrIndex + STR + aliasMd.indexRouting() + STR + routing + STR); } } return aliasMd.indexRouting(); } if (routing == null) { return parent; } return routing; } | /**
* Returns indexing routing for the given index.
*/ | Returns indexing routing for the given index | resolveIndexRouting | {
"repo_name": "diendt/elasticsearch",
"path": "core/src/main/java/org/elasticsearch/cluster/metadata/MetaData.java",
"license": "apache-2.0",
"size": 48926
} | [
"java.util.Arrays",
"org.elasticsearch.common.Nullable"
] | import java.util.Arrays; import org.elasticsearch.common.Nullable; | import java.util.*; import org.elasticsearch.common.*; | [
"java.util",
"org.elasticsearch.common"
] | java.util; org.elasticsearch.common; | 2,230,870 |
public void execute() throws MojoExecutionException
{
File marFile = new File( outputDirectory, marName + ".mar" );
try
{
performPackaging( marFile );
}
catch ( Exception e )
{
throw new MojoExecutionException( "Error assembling mar", e );
}
} | void function() throws MojoExecutionException { File marFile = new File( outputDirectory, marName + ".mar" ); try { performPackaging( marFile ); } catch ( Exception e ) { throw new MojoExecutionException( STR, e ); } } | /**
* Executes the MarMojo on the current project.
*
* @throws MojoExecutionException
* if an error occured while building the webapp
*/ | Executes the MarMojo on the current project | execute | {
"repo_name": "intalio/axis2",
"path": "modules/tool/axis2-mar-maven-plugin/src/main/java/org/apache/axis2/maven2/mar/MarMojo.java",
"license": "apache-2.0",
"size": 4821
} | [
"java.io.File",
"org.apache.maven.plugin.MojoExecutionException"
] | import java.io.File; import org.apache.maven.plugin.MojoExecutionException; | import java.io.*; import org.apache.maven.plugin.*; | [
"java.io",
"org.apache.maven"
] | java.io; org.apache.maven; | 153,895 |
public ArrayList<String> listAllGroupsInherited(Group start) {
if (start == null) {
return null;
}
LinkedList<Group> stack = new LinkedList<Group>();
ArrayList<String> alreadyVisited = new ArrayList<String>();
stack.push(start);
alreadyVisited.add(start.getName());
while (!stack.isEmpty()) {
Group now = stack.pop();
for (String sonName : now.getInherits()) {
Group son = ph.getGroup(sonName);
if (son != null && !alreadyVisited.contains(son.getName())) {
stack.push(son);
alreadyVisited.add(son.getName());
}
}
}
return alreadyVisited;
} | ArrayList<String> function(Group start) { if (start == null) { return null; } LinkedList<Group> stack = new LinkedList<Group>(); ArrayList<String> alreadyVisited = new ArrayList<String>(); stack.push(start); alreadyVisited.add(start.getName()); while (!stack.isEmpty()) { Group now = stack.pop(); for (String sonName : now.getInherits()) { Group son = ph.getGroup(sonName); if (son != null && !alreadyVisited.contains(son.getName())) { stack.push(son); alreadyVisited.add(son.getName()); } } } return alreadyVisited; } | /**
* Return whole list of names of groups in a inheritance chain. Including a
* starting group.
*
* It does Breadth-first search. So closer groups will appear first in list.
*
* @param start
* @return the group that passed on test. null if no group passed.
*/ | Return whole list of names of groups in a inheritance chain. Including a starting group. It does Breadth-first search. So closer groups will appear first in list | listAllGroupsInherited | {
"repo_name": "GravityCraftMC/EssentialsGroupManager",
"path": "src/main/java/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java",
"license": "gpl-3.0",
"size": 36770
} | [
"java.util.ArrayList",
"java.util.LinkedList",
"org.anjocaido.groupmanager.data.Group"
] | import java.util.ArrayList; import java.util.LinkedList; import org.anjocaido.groupmanager.data.Group; | import java.util.*; import org.anjocaido.groupmanager.data.*; | [
"java.util",
"org.anjocaido.groupmanager"
] | java.util; org.anjocaido.groupmanager; | 11,339 |
public static void hookRestoreView(FacesContext context, UIViewRoot root)
{
context.getAttributes().put(DUMMY_VIEW_RESTORE_HOOK, root);
} | static void function(FacesContext context, UIViewRoot root) { context.getAttributes().put(DUMMY_VIEW_RESTORE_HOOK, root); } | /**
* Hook the passed instance on UIViewRoot, storing into facesContext attribute map,
* so the next call to createView() will return that value.
*
* @param context
* @param root
*/ | Hook the passed instance on UIViewRoot, storing into facesContext attribute map, so the next call to createView() will return that value | hookRestoreView | {
"repo_name": "kulinski/myfaces",
"path": "impl/src/test/java/org/apache/myfaces/mc/test/core/MockDefaultViewDeclarationLanguage.java",
"license": "apache-2.0",
"size": 9704
} | [
"javax.faces.component.UIViewRoot",
"javax.faces.context.FacesContext"
] | import javax.faces.component.UIViewRoot; import javax.faces.context.FacesContext; | import javax.faces.component.*; import javax.faces.context.*; | [
"javax.faces"
] | javax.faces; | 2,729,900 |
private static void upgradeToThirtyTwo(SQLiteDatabase db) {
if (!isTableExisting(db, Tables.MOVIES)) {
db.execSQL(CREATE_MOVIES_TABLE);
}
}
// Must be watched and have an airdate
private static final String LATEST_SELECTION = Episodes.WATCHED + "=1 AND "
+ Episodes.FIRSTAIREDMS + "!=-1 AND " + Shows.REF_SHOW_ID + "=?";
// Latest aired first (ensures we get specials), if equal sort by season,
// then number
private static final String LATEST_ORDER = Episodes.FIRSTAIREDMS + " DESC,"
+ Episodes.SEASON + " DESC,"
+ Episodes.NUMBER + " DESC"; | static void function(SQLiteDatabase db) { if (!isTableExisting(db, Tables.MOVIES)) { db.execSQL(CREATE_MOVIES_TABLE); } } private static final String LATEST_SELECTION = Episodes.WATCHED + STR + Episodes.FIRSTAIREDMS + STR + Shows.REF_SHOW_ID + "=?"; private static final String LATEST_ORDER = Episodes.FIRSTAIREDMS + STR + Episodes.SEASON + STR + Episodes.NUMBER + STR; | /**
* Add movies table.
*/ | Add movies table | upgradeToThirtyTwo | {
"repo_name": "natuan241/SeriesGuide",
"path": "SeriesGuide/src/main/java/com/battlelancer/seriesguide/provider/SeriesGuideDatabase.java",
"license": "apache-2.0",
"size": 38341
} | [
"android.database.sqlite.SQLiteDatabase",
"com.battlelancer.seriesguide.provider.SeriesGuideContract"
] | import android.database.sqlite.SQLiteDatabase; import com.battlelancer.seriesguide.provider.SeriesGuideContract; | import android.database.sqlite.*; import com.battlelancer.seriesguide.provider.*; | [
"android.database",
"com.battlelancer.seriesguide"
] | android.database; com.battlelancer.seriesguide; | 1,578,706 |
Request parser(Parser parser); | Request parser(Parser parser); | /**
* Specify the parser to use when parsing the document.
* @param parser parser to use.
* @return this Request, for chaining
*/ | Specify the parser to use when parsing the document | parser | {
"repo_name": "eburtsev/jsoup",
"path": "src/main/java/org/jsoup/Connection.java",
"license": "mit",
"size": 20809
} | [
"org.jsoup.parser.Parser"
] | import org.jsoup.parser.Parser; | import org.jsoup.parser.*; | [
"org.jsoup.parser"
] | org.jsoup.parser; | 784,948 |
private static JAXBContext getContext(ScannedClassLoader classLoader)
throws JAXBException
{
if (classLoader == null) {
return systemContext;
} else {
Class[] clazz = getClasses(classLoader);
return JAXBContext.newInstance(clazz);
}
} | static JAXBContext function(ScannedClassLoader classLoader) throws JAXBException { if (classLoader == null) { return systemContext; } else { Class[] clazz = getClasses(classLoader); return JAXBContext.newInstance(clazz); } } | /**
* Get the JAXB context to use for the given classloader
* @param the classloader to get a context for, or null to get the
* context for the system classloader
* @return a JAXB context
*/ | Get the JAXB context to use for the given classloader | getContext | {
"repo_name": "AsherBond/MondocosmOS",
"path": "wonderland/core/src/classes/org/jdesktop/wonderland/common/cell/state/CellServerStateFactory.java",
"license": "agpl-3.0",
"size": 7302
} | [
"javax.xml.bind.JAXBContext",
"javax.xml.bind.JAXBException",
"org.jdesktop.wonderland.common.utils.ScannedClassLoader"
] | import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import org.jdesktop.wonderland.common.utils.ScannedClassLoader; | import javax.xml.bind.*; import org.jdesktop.wonderland.common.utils.*; | [
"javax.xml",
"org.jdesktop.wonderland"
] | javax.xml; org.jdesktop.wonderland; | 2,901,969 |
protected Set<Guid> validateAndUpdateHostsInPlacementPolicy(VmPlacementPolicy placementPolicy) {
Set<Guid> hostsGuidsSet = new HashSet<>();
if (placementPolicy.isSetHosts()
&& placementPolicy.getHosts().getHosts().size() > 0) {
for (Host host : placementPolicy.getHosts().getHosts()) {
validateParameters(host, "id|name");
// for each host that is specified by name or id
updateIdForSingleHost(host, hostsGuidsSet);
}
}
return hostsGuidsSet;
} | Set<Guid> function(VmPlacementPolicy placementPolicy) { Set<Guid> hostsGuidsSet = new HashSet<>(); if (placementPolicy.isSetHosts() && placementPolicy.getHosts().getHosts().size() > 0) { for (Host host : placementPolicy.getHosts().getHosts()) { validateParameters(host, STR); updateIdForSingleHost(host, hostsGuidsSet); } } return hostsGuidsSet; } | /**
* Update and validate PlacementPolicy object
* Fill hostId for host elements specified by name
* Returns Set of dedicated hosts' Guids found by name or id in PlacementPolicy
*/ | Update and validate PlacementPolicy object Fill hostId for host elements specified by name Returns Set of dedicated hosts' Guids found by name or id in PlacementPolicy | validateAndUpdateHostsInPlacementPolicy | {
"repo_name": "OpenUniversity/ovirt-engine",
"path": "backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendVmsResource.java",
"license": "apache-2.0",
"size": 37840
} | [
"java.util.HashSet",
"java.util.Set",
"org.ovirt.engine.api.model.Host",
"org.ovirt.engine.api.model.VmPlacementPolicy",
"org.ovirt.engine.core.compat.Guid"
] | import java.util.HashSet; import java.util.Set; import org.ovirt.engine.api.model.Host; import org.ovirt.engine.api.model.VmPlacementPolicy; import org.ovirt.engine.core.compat.Guid; | import java.util.*; import org.ovirt.engine.api.model.*; import org.ovirt.engine.core.compat.*; | [
"java.util",
"org.ovirt.engine"
] | java.util; org.ovirt.engine; | 150,631 |
private void connectInCommonMode() throws SQLException {
HostAndPortRange[] srvs = connProps.getAddresses();
List<Exception> exceptions = null;
for (int i = 0; i < srvs.length; i++) {
srvIdx = nextServerIndex(srvs.length);
HostAndPortRange srv = srvs[srvIdx];
try {
InetAddress[] addrs = InetAddress.getAllByName(srv.host());
for (InetAddress addr : addrs) {
for (int port = srv.portFrom(); port <= srv.portTo(); ++port) {
try {
JdbcThinTcpIo cliIo = new JdbcThinTcpIo(connProps, new InetSocketAddress(addr, port), ctx, 0);
cliIo.timeout(netTimeout);
singleIo = cliIo;
connCnt.incrementAndGet();
return;
}
catch (Exception exception) {
if (exceptions == null)
exceptions = new ArrayList<>();
exceptions.add(exception);
}
}
}
}
catch (Exception exception) {
if (exceptions == null)
exceptions = new ArrayList<>();
exceptions.add(exception);
}
}
handleConnectExceptions(exceptions);
} | void function() throws SQLException { HostAndPortRange[] srvs = connProps.getAddresses(); List<Exception> exceptions = null; for (int i = 0; i < srvs.length; i++) { srvIdx = nextServerIndex(srvs.length); HostAndPortRange srv = srvs[srvIdx]; try { InetAddress[] addrs = InetAddress.getAllByName(srv.host()); for (InetAddress addr : addrs) { for (int port = srv.portFrom(); port <= srv.portTo(); ++port) { try { JdbcThinTcpIo cliIo = new JdbcThinTcpIo(connProps, new InetSocketAddress(addr, port), ctx, 0); cliIo.timeout(netTimeout); singleIo = cliIo; connCnt.incrementAndGet(); return; } catch (Exception exception) { if (exceptions == null) exceptions = new ArrayList<>(); exceptions.add(exception); } } } } catch (Exception exception) { if (exceptions == null) exceptions = new ArrayList<>(); exceptions.add(exception); } } handleConnectExceptions(exceptions); } | /**
* Establishes a connection to ignite endpoint, trying all specified hosts and ports one by one.
* Stops as soon as any connection is established.
*
* @throws SQLException If failed to connect to ignite cluster.
*/ | Establishes a connection to ignite endpoint, trying all specified hosts and ports one by one. Stops as soon as any connection is established | connectInCommonMode | {
"repo_name": "nizhikov/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/jdbc/thin/JdbcThinConnection.java",
"license": "apache-2.0",
"size": 85291
} | [
"java.net.InetAddress",
"java.net.InetSocketAddress",
"java.sql.SQLException",
"java.util.ArrayList",
"java.util.List",
"org.apache.ignite.internal.util.HostAndPortRange"
] | import java.net.InetAddress; import java.net.InetSocketAddress; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; import org.apache.ignite.internal.util.HostAndPortRange; | import java.net.*; import java.sql.*; import java.util.*; import org.apache.ignite.internal.util.*; | [
"java.net",
"java.sql",
"java.util",
"org.apache.ignite"
] | java.net; java.sql; java.util; org.apache.ignite; | 2,737,204 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.