method
stringlengths
13
441k
clean_method
stringlengths
7
313k
doc
stringlengths
17
17.3k
comment
stringlengths
3
1.42k
method_name
stringlengths
1
273
extra
dict
imports
list
imports_info
stringlengths
19
34.8k
cluster_imports_info
stringlengths
15
3.66k
libraries
list
libraries_info
stringlengths
6
661
id
int64
0
2.92M
private Result pModifierList(final int yyStart) throws IOException { Result yyResult; int yyRepetition1; Pair<Node> yyRepValue1; Pair<Node> yyValue; ParseError yyError = ParseError.DUMMY; // Alternative 1. yyRepetition1 = yyStart; yyRepValue1 = Pair.empty(); while (true) { yyResult = pModifier(yyRepetition1); yyError = yyResult.select(yyError, yyRepetition1); if (yyResult.hasValue()) { final Node v$el$1 = yyResult.semanticValue(); yyRepetition1 = yyResult.index; yyRepValue1 = new Pair<Node>(v$el$1, yyRepValue1); continue; } break; } { // Start scope for yyValue. yyValue = yyRepValue1.reverse(); return new SemanticValue(yyValue, yyRepetition1, yyError); } // End scope for yyValue. } // =========================================================================
Result function(final int yyStart) throws IOException { Result yyResult; int yyRepetition1; Pair<Node> yyRepValue1; Pair<Node> yyValue; ParseError yyError = ParseError.DUMMY; yyRepetition1 = yyStart; yyRepValue1 = Pair.empty(); while (true) { yyResult = pModifier(yyRepetition1); yyError = yyResult.select(yyError, yyRepetition1); if (yyResult.hasValue()) { final Node v$el$1 = yyResult.semanticValue(); yyRepetition1 = yyResult.index; yyRepValue1 = new Pair<Node>(v$el$1, yyRepValue1); continue; } break; } { yyValue = yyRepValue1.reverse(); return new SemanticValue(yyValue, yyRepetition1, yyError); } }
/** * Parse nonterminal xtc.lang.JavaFive.ModifierList. * * @param yyStart The index. * @return The result. * @throws IOException Signals an I/O error. */
Parse nonterminal xtc.lang.JavaFive.ModifierList
pModifierList
{ "repo_name": "wandoulabs/xtc-rats", "path": "xtc-core/src/main/java/xtc/lang/JavaFiveParser.java", "license": "lgpl-2.1", "size": 313913 }
[ "java.io.IOException", "xtc.parser.ParseError", "xtc.parser.Result", "xtc.parser.SemanticValue", "xtc.tree.Node", "xtc.util.Pair" ]
import java.io.IOException; import xtc.parser.ParseError; import xtc.parser.Result; import xtc.parser.SemanticValue; import xtc.tree.Node; import xtc.util.Pair;
import java.io.*; import xtc.parser.*; import xtc.tree.*; import xtc.util.*;
[ "java.io", "xtc.parser", "xtc.tree", "xtc.util" ]
java.io; xtc.parser; xtc.tree; xtc.util;
2,746,226
private void writeTabStatesToStorageAsync() { new AsyncTask<Void, Void, Void>() { private final SparseArray<TabState> mStatesToWrite = new SparseArray<TabState>();
void function() { new AsyncTask<Void, Void, Void>() { private final SparseArray<TabState> mStatesToWrite = new SparseArray<TabState>();
/** * Write out all of the TabStates. */
Write out all of the TabStates
writeTabStatesToStorageAsync
{ "repo_name": "SaschaMester/delicium", "path": "chrome/android/java/src/org/chromium/chrome/browser/tabmodel/document/DocumentTabModelImpl.java", "license": "bsd-3-clause", "size": 36099 }
[ "android.os.AsyncTask", "android.util.SparseArray", "org.chromium.chrome.browser.TabState" ]
import android.os.AsyncTask; import android.util.SparseArray; import org.chromium.chrome.browser.TabState;
import android.os.*; import android.util.*; import org.chromium.chrome.browser.*;
[ "android.os", "android.util", "org.chromium.chrome" ]
android.os; android.util; org.chromium.chrome;
1,296,384
// ---------------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------------- @GET @Path("/bye") @Produces(MediaType.TEXT_HTML) public String getById() { return "goodbye"; }
@Path("/bye") @Produces(MediaType.TEXT_HTML) String function() { return STR; }
/** * Retrieves the matching student resource (JSON content) according to the specified student ID. * Tomcat/Jetty URL: http://localhost:8080/skejool/students/{student ID}. */
Retrieves the matching student resource (JSON content) according to the specified student ID
getById
{ "repo_name": "petester42/skejool", "path": "skejool/src/main/java/com/soen341/rest/resources/LogoutResource.java", "license": "mit", "size": 1040 }
[ "javax.ws.rs.Path", "javax.ws.rs.Produces", "javax.ws.rs.core.MediaType" ]
import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType;
import javax.ws.rs.*; import javax.ws.rs.core.*;
[ "javax.ws" ]
javax.ws;
758,574
@Test public void testWFLY3947_1() { TimeZone timeZone = TimeZone.getTimeZone("Europe/Lisbon"); int year = 2013; int month = Calendar.MARCH; int dayOfMonth = 31; int hourOfDay = 3; int minute = 30; int second = 0; Calendar start = new GregorianCalendar(timeZone); start.clear(); start.set(year, month, dayOfMonth, hourOfDay, minute, second); ScheduleExpression expression = new ScheduleExpression().timezone(timeZone.getID()).dayOfMonth("*").hour("1").minute("30").second("0").start(start.getTime()); CalendarBasedTimeout calendarTimeout = new CalendarBasedTimeout(expression); Calendar firstTimeout = calendarTimeout.getFirstTimeout(); Assert.assertNotNull(firstTimeout); Assert.assertEquals(year, firstTimeout.get(Calendar.YEAR)); Assert.assertEquals(Calendar.APRIL, firstTimeout.get(Calendar.MONTH)); Assert.assertEquals(1, firstTimeout.get(Calendar.DAY_OF_MONTH)); Assert.assertEquals(1, firstTimeout.get(Calendar.HOUR_OF_DAY)); Assert.assertEquals(30, firstTimeout.get(Calendar.MINUTE)); Assert.assertEquals(second, firstTimeout.get(Calendar.SECOND)); }
void function() { TimeZone timeZone = TimeZone.getTimeZone(STR); int year = 2013; int month = Calendar.MARCH; int dayOfMonth = 31; int hourOfDay = 3; int minute = 30; int second = 0; Calendar start = new GregorianCalendar(timeZone); start.clear(); start.set(year, month, dayOfMonth, hourOfDay, minute, second); ScheduleExpression expression = new ScheduleExpression().timezone(timeZone.getID()).dayOfMonth("*").hour("1").minute("30").second("0").start(start.getTime()); CalendarBasedTimeout calendarTimeout = new CalendarBasedTimeout(expression); Calendar firstTimeout = calendarTimeout.getFirstTimeout(); Assert.assertNotNull(firstTimeout); Assert.assertEquals(year, firstTimeout.get(Calendar.YEAR)); Assert.assertEquals(Calendar.APRIL, firstTimeout.get(Calendar.MONTH)); Assert.assertEquals(1, firstTimeout.get(Calendar.DAY_OF_MONTH)); Assert.assertEquals(1, firstTimeout.get(Calendar.HOUR_OF_DAY)); Assert.assertEquals(30, firstTimeout.get(Calendar.MINUTE)); Assert.assertEquals(second, firstTimeout.get(Calendar.SECOND)); }
/** * Testcase #1 for WFLY-3947 */
Testcase #1 for WFLY-3947
testWFLY3947_1
{ "repo_name": "tomazzupan/wildfly", "path": "ejb3/src/test/java/org/jboss/as/ejb3/timer/schedule/CalendarBasedTimeoutTestCase.java", "license": "lgpl-2.1", "size": 31795 }
[ "java.util.Calendar", "java.util.GregorianCalendar", "java.util.TimeZone", "javax.ejb.ScheduleExpression", "org.jboss.as.ejb3.timerservice.schedule.CalendarBasedTimeout", "org.junit.Assert" ]
import java.util.Calendar; import java.util.GregorianCalendar; import java.util.TimeZone; import javax.ejb.ScheduleExpression; import org.jboss.as.ejb3.timerservice.schedule.CalendarBasedTimeout; import org.junit.Assert;
import java.util.*; import javax.ejb.*; import org.jboss.as.ejb3.timerservice.schedule.*; import org.junit.*;
[ "java.util", "javax.ejb", "org.jboss.as", "org.junit" ]
java.util; javax.ejb; org.jboss.as; org.junit;
2,281,229
@RequestMapping(method = GET) public String home(Model model, @ModelAttribute FormBean search) { if (search.getPeriod() == null) { search.setPeriod(service.getCurrentPeriod()); } model.addAttribute("search", search); model.addAttribute("departments", service.getDepartmentsUnits()); model.addAttribute("periods", service.getExecutionPeriods()); model.addAttribute("authorizations", service.searchAuthorizations(search)); return view("show"); }
@RequestMapping(method = GET) String function(Model model, @ModelAttribute FormBean search) { if (search.getPeriod() == null) { search.setPeriod(service.getCurrentPeriod()); } model.addAttribute(STR, search); model.addAttribute(STR, service.getDepartmentsUnits()); model.addAttribute(STR, service.getExecutionPeriods()); model.addAttribute(STR, service.searchAuthorizations(search)); return view("show"); }
/*** * Functionality entry point * * @param model * @param search * @return */
Functionality entry point
home
{ "repo_name": "qub-it/fenixedu-academic", "path": "src/main/java/org/fenixedu/academic/ui/spring/controller/teacher/authorization/AuthorizationController.java", "license": "lgpl-3.0", "size": 10228 }
[ "org.springframework.ui.Model", "org.springframework.web.bind.annotation.ModelAttribute", "org.springframework.web.bind.annotation.RequestMapping" ]
import org.springframework.ui.Model; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.ui.*; import org.springframework.web.bind.annotation.*;
[ "org.springframework.ui", "org.springframework.web" ]
org.springframework.ui; org.springframework.web;
1,571,571
@RequestMapping(method = RequestMethod.GET, value = { "/searchClients"}, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseStatus(HttpStatus.OK) @ResponseBody public String searchClients(@RequestParam(value="id", required=false) String id, @RequestParam(value="firstname", required=false) String firstname, @RequestParam(value="lastname", required=false) String lastname, @RequestParam(value="address", required=false) String address, @RequestParam(value="phone", required=false) String phone, @RequestParam(value="cellphone1", required=false) String cellphone1) { logger.debug("Request: /searchClients with params:"); if (logger.isDebugEnabled()) { if (id!=null) logger.debug("\tid = " + id); if (firstname!=null) logger.trace("\tfirstname = " + firstname); if (firstname!=null) logger.trace("\tlastname = " + lastname); if (firstname!=null) logger.trace("\taddress = " + address); if (firstname!=null) logger.trace("\tphone = " + phone); if (firstname!=null) logger.trace("\tcellphone1 = " + cellphone1); } SearchClientDto data = new SearchClientDto(id, firstname, lastname, address, phone, cellphone1); return JSONUtil.toJSON(clientService.searchClients(data)); }
@RequestMapping(method = RequestMethod.GET, value = { STR}, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseStatus(HttpStatus.OK) String function(@RequestParam(value="id", required=false) String id, @RequestParam(value=STR, required=false) String firstname, @RequestParam(value=STR, required=false) String lastname, @RequestParam(value=STR, required=false) String address, @RequestParam(value="phone", required=false) String phone, @RequestParam(value=STR, required=false) String cellphone1) { logger.debug(STR); if (logger.isDebugEnabled()) { if (id!=null) logger.debug(STR + id); if (firstname!=null) logger.trace(STR + firstname); if (firstname!=null) logger.trace(STR + lastname); if (firstname!=null) logger.trace(STR + address); if (firstname!=null) logger.trace(STR + phone); if (firstname!=null) logger.trace(STR + cellphone1); } SearchClientDto data = new SearchClientDto(id, firstname, lastname, address, phone, cellphone1); return JSONUtil.toJSON(clientService.searchClients(data)); }
/** * Handles requests to the /searchClients service **/
Handles requests to the /searchClients service
searchClients
{ "repo_name": "EstigiaIT/VETAR-EstigiaIT", "path": "vet-web-backend/src/main/java/ar/com/estigiait/app/controller/ClientController.java", "license": "lgpl-3.0", "size": 5505 }
[ "ar.com.estigiait.app.dto.SearchClientDto", "ar.com.estigiait.app.util.JSONUtil", "org.springframework.http.HttpStatus", "org.springframework.http.MediaType", "org.springframework.web.bind.annotation.RequestMapping", "org.springframework.web.bind.annotation.RequestMethod", "org.springframework.web.bind.annotation.RequestParam", "org.springframework.web.bind.annotation.ResponseStatus" ]
import ar.com.estigiait.app.dto.SearchClientDto; import ar.com.estigiait.app.util.JSONUtil; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseStatus;
import ar.com.estigiait.app.dto.*; import ar.com.estigiait.app.util.*; import org.springframework.http.*; import org.springframework.web.bind.annotation.*;
[ "ar.com.estigiait", "org.springframework.http", "org.springframework.web" ]
ar.com.estigiait; org.springframework.http; org.springframework.web;
2,697,114
public void handleTriple(Triple triple);
void function(Triple triple);
/** * Method to extract metadata from a RDF triple * @param triple RDF triple */
Method to extract metadata from a RDF triple
handleTriple
{ "repo_name": "AKSW/Tapioca", "path": "Tapioca_STP_code/tapioca.cores/src/main/java/org/aksw/simba/tapioca/cores/helper/Extractor.java", "license": "lgpl-3.0", "size": 1297 }
[ "com.hp.hpl.jena.graph.Triple" ]
import com.hp.hpl.jena.graph.Triple;
import com.hp.hpl.jena.graph.*;
[ "com.hp.hpl" ]
com.hp.hpl;
1,445,292
@Override public void notifyChanged(Notification notification) { updateChildren(notification); super.notifyChanged(notification); }
void function(Notification notification) { updateChildren(notification); super.notifyChanged(notification); }
/** * This handles model notifications by calling {@link #updateChildren} to update any cached * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
This handles model notifications by calling <code>#updateChildren</code> to update any cached children and by creating a viewer notification, which it passes to <code>#fireNotifyChanged</code>.
notifyChanged
{ "repo_name": "prabushi/devstudio-tooling-esb", "path": "plugins/org.wso2.developerstudio.eclipse.gmf.esb.edit/src/org/wso2/developerstudio/eclipse/gmf/esb/provider/SwitchDefaultBranchOutputConnectorItemProvider.java", "license": "apache-2.0", "size": 3167 }
[ "org.eclipse.emf.common.notify.Notification" ]
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
533,990
public void draw(Graphics graphics, float center_x, float center_y, float zoom) { // Load the textures required for rending here, in the primary thread, since // the OpenGL backend requires that all calls be from the same thread which // initialized it. if (mBackgroundBitmap != null) { graphics.freeImage(mBackgroundImage); mBackgroundImage = graphics.loadImageFromBitmap(mBackgroundBitmap); mBackgroundBitmap = null; } if (mTilesBitmap != null) { graphics.freeImage(mTilesImage); mTilesImage = graphics.loadImageFromBitmap(mTilesBitmap); mTilesBitmap = null; } int canvas_width = graphics.getWidth(); int canvas_height = graphics.getHeight(); // Draw the background. mRectSource.top = mRectSource.left = 0; mRectSource.bottom = mRectSource.right = 256; float kMinZoom = 0.6f; float background_zoom = canvas_width / 3.0f * (zoom - kMinZoom); mRectDest.top = mRectDest.left = -background_zoom; mRectDest.right = canvas_width + background_zoom; mRectDest.bottom = canvas_height + background_zoom; graphics.drawImage( mBackgroundImage, mRectSource, mRectDest, false, false, 1); // Draw the tiles. mRectSource.top = mRectSource.left = 0; mRectSource.right = mRectSource.bottom = kTileSize; int half_canvas_width = canvas_width / 2; int half_canvas_height = canvas_height / 2; float x_min = center_x - half_canvas_width / zoom; float x_max = center_x + (half_canvas_width + kTileSize) / zoom; float y_min = center_y - half_canvas_height / zoom; float y_max = center_y + (half_canvas_height + kTileSize) / zoom; for (float y = y_min; y <= y_max; y += kTileSize) { for (float x = x_min; x <= x_max; ) { int tile_index = indexAt(x, y); if (tile_index < 0) { x += kTileSize; continue; // Tile out of bounds. } // Check for spawning triggers associated with this tile. String trigger = mTriggers[tile_index]; if (trigger != null) { if (trigger.startsWith("enemy=")) { Uri enemy_uri = Uri.withAppendedPath(mBaseUri, trigger.substring(6)); mGameState.createEnemyFromUri(enemy_uri, x, y); mTriggers[tile_index] = null; } } // Draw the tile. int tile_id = mTiles[tile_index]; int run_length = mTilesRunLength[tile_index]; if (tile_id != 0) { // Tile is a visual tile. int index_x = (int)(x / kTileSize + 0.5f); int index_y = (int)(y / kTileSize + 0.5f); mRectSource.top = kTileSize * tile_id; mRectSource.bottom = kTileSize * tile_id + kTileSize; mRectDest.left = kTileSize * index_x * zoom; mRectDest.top = kTileSize * index_y * zoom; mRectDest.right = (kTileSize * index_x + kTileSize) * zoom; mRectDest.bottom = (kTileSize * index_y + kTileSize) * zoom; mRectDest.offset( -center_x * zoom + half_canvas_width - kTileSize / 2 * zoom, -center_y * zoom + half_canvas_height - kTileSize / 2 * zoom); graphics.drawImage( mTilesImage, mRectSource, mRectDest, false, false, run_length); } x += kTileSize * run_length; } } }
void function(Graphics graphics, float center_x, float center_y, float zoom) { if (mBackgroundBitmap != null) { graphics.freeImage(mBackgroundImage); mBackgroundImage = graphics.loadImageFromBitmap(mBackgroundBitmap); mBackgroundBitmap = null; } if (mTilesBitmap != null) { graphics.freeImage(mTilesImage); mTilesImage = graphics.loadImageFromBitmap(mTilesBitmap); mTilesBitmap = null; } int canvas_width = graphics.getWidth(); int canvas_height = graphics.getHeight(); mRectSource.top = mRectSource.left = 0; mRectSource.bottom = mRectSource.right = 256; float kMinZoom = 0.6f; float background_zoom = canvas_width / 3.0f * (zoom - kMinZoom); mRectDest.top = mRectDest.left = -background_zoom; mRectDest.right = canvas_width + background_zoom; mRectDest.bottom = canvas_height + background_zoom; graphics.drawImage( mBackgroundImage, mRectSource, mRectDest, false, false, 1); mRectSource.top = mRectSource.left = 0; mRectSource.right = mRectSource.bottom = kTileSize; int half_canvas_width = canvas_width / 2; int half_canvas_height = canvas_height / 2; float x_min = center_x - half_canvas_width / zoom; float x_max = center_x + (half_canvas_width + kTileSize) / zoom; float y_min = center_y - half_canvas_height / zoom; float y_max = center_y + (half_canvas_height + kTileSize) / zoom; for (float y = y_min; y <= y_max; y += kTileSize) { for (float x = x_min; x <= x_max; ) { int tile_index = indexAt(x, y); if (tile_index < 0) { x += kTileSize; continue; } String trigger = mTriggers[tile_index]; if (trigger != null) { if (trigger.startsWith(STR)) { Uri enemy_uri = Uri.withAppendedPath(mBaseUri, trigger.substring(6)); mGameState.createEnemyFromUri(enemy_uri, x, y); mTriggers[tile_index] = null; } } int tile_id = mTiles[tile_index]; int run_length = mTilesRunLength[tile_index]; if (tile_id != 0) { int index_x = (int)(x / kTileSize + 0.5f); int index_y = (int)(y / kTileSize + 0.5f); mRectSource.top = kTileSize * tile_id; mRectSource.bottom = kTileSize * tile_id + kTileSize; mRectDest.left = kTileSize * index_x * zoom; mRectDest.top = kTileSize * index_y * zoom; mRectDest.right = (kTileSize * index_x + kTileSize) * zoom; mRectDest.bottom = (kTileSize * index_y + kTileSize) * zoom; mRectDest.offset( -center_x * zoom + half_canvas_width - kTileSize / 2 * zoom, -center_y * zoom + half_canvas_height - kTileSize / 2 * zoom); graphics.drawImage( mTilesImage, mRectSource, mRectDest, false, false, run_length); } x += kTileSize * run_length; } } }
/** Draw the entity to the canvas such that the specified coordinates are * centered. Tile locations in world coordinates correspond to the *center* of * the tile, eg. (0, 0) is the center of the first tile. */
Draw the entity to the canvas such that the specified coordinates are centered. Tile locations in world coordinates correspond to the *center* of
draw
{ "repo_name": "tectronics/alienbloodbath", "path": "src/android/com/abb/Map.java", "license": "gpl-3.0", "size": 19423 }
[ "android.net.Uri" ]
import android.net.Uri;
import android.net.*;
[ "android.net" ]
android.net;
612,342
public boolean getMoreData() throws KettleException { // See if the buffer is completely full (very long lines of data... // In that situation, we need to re-size the byte buffer... // We make it half as long... // if ( startBuffer == 0 && endBuffer >= byteBuffer.length ) { int newSize; if ( byteBuffer.length == 0 ) { // initial newSize = bufferSize; } else { newSize = ( byteBuffer.length * 3 ) / 2; // increase by 50% } byte[] newByteBuffer = new byte[newSize]; // Copy over the data into the new buffer. // maxBuffer = byteBuffer.length - startBuffer; System.arraycopy( byteBuffer, startBuffer, newByteBuffer, 0, maxBuffer ); byteBuffer = newByteBuffer; } else { // Copy The old data to the start of the buffer... // if ( startBuffer > 0 ) { maxBuffer = byteBuffer.length - startBuffer; System.arraycopy( byteBuffer, startBuffer, byteBuffer, 0, maxBuffer ); endBuffer = maxBuffer; startBuffer = 0; } } // Read from our file... // int size = byteBuffer.length - maxBuffer; int bytesRead = 0; int leftToRead = size; try { while ( bytesRead < size ) { int n = gzis.read( byteBuffer, maxBuffer, leftToRead ); if ( n < 0 ) { // EOF, nothing more to read in combination with the need to get more data means we're done. // eofReached = true; fileReadPosition += bytesRead; return bytesRead == 0; } bytesRead += n; // bytes read so far maxBuffer += n; // that's where we ended up so far leftToRead -= n; // a little bit less to read } fileReadPosition += bytesRead; // keep track of where we are in the file... return false; // all OK } catch ( IOException e ) { throw new KettleException( "Unable to read " + size + " bytes from the gzipped input file", e ); } }
boolean function() throws KettleException { int newSize; if ( byteBuffer.length == 0 ) { newSize = bufferSize; } else { newSize = ( byteBuffer.length * 3 ) / 2; } byte[] newByteBuffer = new byte[newSize]; System.arraycopy( byteBuffer, startBuffer, newByteBuffer, 0, maxBuffer ); byteBuffer = newByteBuffer; } else { maxBuffer = byteBuffer.length - startBuffer; System.arraycopy( byteBuffer, startBuffer, byteBuffer, 0, maxBuffer ); endBuffer = maxBuffer; startBuffer = 0; } } int bytesRead = 0; int leftToRead = size; try { while ( bytesRead < size ) { int n = gzis.read( byteBuffer, maxBuffer, leftToRead ); if ( n < 0 ) { fileReadPosition += bytesRead; return bytesRead == 0; } bytesRead += n; maxBuffer += n; leftToRead -= n; } fileReadPosition += bytesRead; return false; } catch ( IOException e ) { throw new KettleException( STR + size + STR, e ); } }
/** * Read more data from our current file... * * @return */
Read more data from our current file..
getMoreData
{ "repo_name": "codek/pentaho-kettle", "path": "engine/src/org/pentaho/di/trans/steps/parallelgzipcsv/ParGzipCsvInputData.java", "license": "apache-2.0", "size": 5219 }
[ "java.io.IOException", "org.pentaho.di.core.exception.KettleException" ]
import java.io.IOException; import org.pentaho.di.core.exception.KettleException;
import java.io.*; import org.pentaho.di.core.exception.*;
[ "java.io", "org.pentaho.di" ]
java.io; org.pentaho.di;
2,802,059
public void grabMouseCursor() { Mouse.setGrabbed(true); this.deltaX = 0; this.deltaY = 0; }
void function() { Mouse.setGrabbed(true); this.deltaX = 0; this.deltaY = 0; }
/** * Grabs the mouse cursor it doesn't move and isn't seen. */
Grabs the mouse cursor it doesn't move and isn't seen
grabMouseCursor
{ "repo_name": "Hexeption/Youtube-Hacked-Client-1.8", "path": "minecraft/net/minecraft/util/MouseHelper.java", "license": "mit", "size": 894 }
[ "org.lwjgl.input.Mouse" ]
import org.lwjgl.input.Mouse;
import org.lwjgl.input.*;
[ "org.lwjgl.input" ]
org.lwjgl.input;
1,913,287
@Test public void testAbstractConstructor() throws Exception { BigInteger intId = IdUtil.next(); String id = String.format("\"%s\"", IdUtil.toString(intId)); StdScalarDeserializer deserializer = new TestDeserializer(); JsonFactory f = new JsonFactory(); JsonParser preloadedParser = f.createParser(id); preloadedParser.nextToken(); // Advance to the first value. TestChildEntity e = (TestChildEntity) deserializer.deserialize(preloadedParser, mock(DeserializationContext.class)); assertEquals(intId, e.getId()); }
void function() throws Exception { BigInteger intId = IdUtil.next(); String id = String.format("\"%s\"", IdUtil.toString(intId)); StdScalarDeserializer deserializer = new TestDeserializer(); JsonFactory f = new JsonFactory(); JsonParser preloadedParser = f.createParser(id); preloadedParser.nextToken(); TestChildEntity e = (TestChildEntity) deserializer.deserialize(preloadedParser, mock(DeserializationContext.class)); assertEquals(intId, e.getId()); }
/** * Test generic class method invocation. * * Using and extending generics compiled in older JDK's creates shadow * methods that are nondeterministic. This invokes that method to ensure * proper code coverage. * * @throws Exception Should not be thrown. */
Test generic class method invocation. Using and extending generics compiled in older JDK's creates shadow methods that are nondeterministic. This invokes that method to ensure proper code coverage
testAbstractConstructor
{ "repo_name": "kangaroo-server/kangaroo", "path": "kangaroo-common/src/test/java/net/krotscheck/kangaroo/common/hibernate/id/AbstractEntityReferenceDeserializerTest.java", "license": "apache-2.0", "size": 6104 }
[ "com.fasterxml.jackson.core.JsonFactory", "com.fasterxml.jackson.core.JsonParser", "com.fasterxml.jackson.databind.DeserializationContext", "com.fasterxml.jackson.databind.deser.std.StdScalarDeserializer", "java.math.BigInteger", "net.krotscheck.kangaroo.common.hibernate.entity.TestChildEntity", "org.junit.Assert", "org.mockito.Mockito" ]
import com.fasterxml.jackson.core.JsonFactory; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.databind.DeserializationContext; import com.fasterxml.jackson.databind.deser.std.StdScalarDeserializer; import java.math.BigInteger; import net.krotscheck.kangaroo.common.hibernate.entity.TestChildEntity; import org.junit.Assert; import org.mockito.Mockito;
import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.std.*; import java.math.*; import net.krotscheck.kangaroo.common.hibernate.entity.*; import org.junit.*; import org.mockito.*;
[ "com.fasterxml.jackson", "java.math", "net.krotscheck.kangaroo", "org.junit", "org.mockito" ]
com.fasterxml.jackson; java.math; net.krotscheck.kangaroo; org.junit; org.mockito;
2,095,146
public boolean isInSafeMode() throws IOException { return setSafeMode(SafeModeAction.SAFEMODE_GET, true); }
boolean function() throws IOException { return setSafeMode(SafeModeAction.SAFEMODE_GET, true); }
/** * Utility function that returns if the NameNode is in safemode or not. In HA * mode, this API will return only ActiveNN's safemode status. * * @return true if NameNode is in safemode, false otherwise. * @throws IOException * when there is an issue communicating with the NameNode */
Utility function that returns if the NameNode is in safemode or not. In HA mode, this API will return only ActiveNN's safemode status
isInSafeMode
{ "repo_name": "GeLiXin/hadoop", "path": "hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DistributedFileSystem.java", "license": "apache-2.0", "size": 115559 }
[ "java.io.IOException", "org.apache.hadoop.hdfs.protocol.HdfsConstants" ]
import java.io.IOException; import org.apache.hadoop.hdfs.protocol.HdfsConstants;
import java.io.*; import org.apache.hadoop.hdfs.protocol.*;
[ "java.io", "org.apache.hadoop" ]
java.io; org.apache.hadoop;
292,049
public static ArrayList<Coordinate> selectCoordinatesByCoordinateIds(Connection con, List<String> coordinateIds, CoordinatePK pk) throws SQLException { ArrayList<Coordinate> coordinates = new ArrayList<Coordinate>(); for (String coordinateId : coordinateIds) { coordinates.add(selectCoordinateByCoordinatePK(con, new CoordinatePK(coordinateId, pk))); } return coordinates; }
static ArrayList<Coordinate> function(Connection con, List<String> coordinateIds, CoordinatePK pk) throws SQLException { ArrayList<Coordinate> coordinates = new ArrayList<Coordinate>(); for (String coordinateId : coordinateIds) { coordinates.add(selectCoordinateByCoordinatePK(con, new CoordinatePK(coordinateId, pk))); } return coordinates; }
/** * Method declaration * @param con * @param coordinateIds * @param pk * @return * @throws SQLException * @see */
Method declaration
selectCoordinatesByCoordinateIds
{ "repo_name": "stephaneperry/Silverpeas-Core", "path": "ejb-core/node/src/main/java/com/stratelia/webactiv/util/coordinates/ejb/CoordinatesDAO.java", "license": "agpl-3.0", "size": 19647 }
[ "com.stratelia.webactiv.util.coordinates.model.Coordinate", "com.stratelia.webactiv.util.coordinates.model.CoordinatePK", "java.sql.Connection", "java.sql.SQLException", "java.util.ArrayList", "java.util.List" ]
import com.stratelia.webactiv.util.coordinates.model.Coordinate; import com.stratelia.webactiv.util.coordinates.model.CoordinatePK; import java.sql.Connection; import java.sql.SQLException; import java.util.ArrayList; import java.util.List;
import com.stratelia.webactiv.util.coordinates.model.*; import java.sql.*; import java.util.*;
[ "com.stratelia.webactiv", "java.sql", "java.util" ]
com.stratelia.webactiv; java.sql; java.util;
51,358
public void setApprovalContextId(final String contextId) { if (approval == null) { approval = new ApprovalRequest(); } approval.setContextId(contextId); }
void function(final String contextId) { if (approval == null) { approval = new ApprovalRequest(); } approval.setContextId(contextId); }
/** * The ID of the item that is being acted upon. * * @param contextId */
The ID of the item that is being acted upon
setApprovalContextId
{ "repo_name": "pmoerenhout/camel", "path": "components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/SalesforceEndpointConfig.java", "license": "apache-2.0", "size": 28174 }
[ "org.apache.camel.component.salesforce.api.dto.approval.ApprovalRequest" ]
import org.apache.camel.component.salesforce.api.dto.approval.ApprovalRequest;
import org.apache.camel.component.salesforce.api.dto.approval.*;
[ "org.apache.camel" ]
org.apache.camel;
496,802
public Set<Integer> translatePathFromRegex(String root, String regex) { logger.trace("translatePathFromRegex.enter; got regex: {}, root: {}", regex, root); Set<Map.Entry<String, Path>> entries = getTypedPathWithRegex(regex, root); Set<Integer> result = new HashSet<Integer>(entries.size()); for (Map.Entry<String, Path> e: entries) { logger.trace("translatePathFromRegex; path found: {}", e.getValue()); result.add(e.getValue().getPathId()); } logger.trace("translatePathFromRegex.exit; returning: {}", result); return result; }
Set<Integer> function(String root, String regex) { logger.trace(STR, regex, root); Set<Map.Entry<String, Path>> entries = getTypedPathWithRegex(regex, root); Set<Integer> result = new HashSet<Integer>(entries.size()); for (Map.Entry<String, Path> e: entries) { logger.trace(STR, e.getValue()); result.add(e.getValue().getPathId()); } logger.trace(STR, result); return result; }
/** * translates regex expression like "^/ns0:Security/ns0:SecurityInformation/.(*)/ns0:Sector/text\\(\\)$"; * to an array of registered pathIds which conforms to the regex specified * * @param root String; the corresponding document's root * @param regex String; regex pattern * @return Set&lt;Integer&gt;- set of registered pathIds conforming to the pattern provided */
translates regex expression like "^/ns0:Security/ns0:SecurityInformation/.(*)/ns0:Sector/text\\(\\)$"; to an array of registered pathIds which conforms to the regex specified
translatePathFromRegex
{ "repo_name": "dsukhoroslov/bagri", "path": "bagri-core/src/main/java/com/bagri/core/server/api/impl/ModelManagementBase.java", "license": "apache-2.0", "size": 7415 }
[ "com.bagri.core.model.Path", "java.util.HashSet", "java.util.Map", "java.util.Set" ]
import com.bagri.core.model.Path; import java.util.HashSet; import java.util.Map; import java.util.Set;
import com.bagri.core.model.*; import java.util.*;
[ "com.bagri.core", "java.util" ]
com.bagri.core; java.util;
218,646
protected final CacheObject saveValueForIndexUnlocked() throws IgniteCheckedException { return saveOldValueUnlocked(true); }
final CacheObject function() throws IgniteCheckedException { return saveOldValueUnlocked(true); }
/** * This method will return current value only if clearIndex(V) will require previous value. * If previous value is not required, this method will return {@code null}. * * @return Previous value or {@code null}. * @throws IgniteCheckedException If failed to retrieve previous value. */
This method will return current value only if clearIndex(V) will require previous value. If previous value is not required, this method will return null
saveValueForIndexUnlocked
{ "repo_name": "apacheignite/ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java", "license": "apache-2.0", "size": 146932 }
[ "org.apache.ignite.IgniteCheckedException" ]
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.*;
[ "org.apache.ignite" ]
org.apache.ignite;
2,473,536
protected final Map<K, ICacheElement<K, V>> doGetMatching( String pattern ) throws IOException { return super.getMatchingWithEventLogging( pattern ); }
final Map<K, ICacheElement<K, V>> function( String pattern ) throws IOException { return super.getMatchingWithEventLogging( pattern ); }
/** * Get a value from the persistent store. * <p> * Before the event logging layer, the subclasses implemented the do* methods. Now the do* * methods call the *EventLogging method on the super. The *WithEventLogging methods call the * abstract process* methods. The children implement the process methods. * <p> * @param pattern Used to match keys. * @return A map of matches.. * @throws IOException */
Get a value from the persistent store. Before the event logging layer, the subclasses implemented the do* methods. Now the do methods call the *EventLogging method on the super. The *WithEventLogging methods call the abstract process* methods. The children implement the process methods.
doGetMatching
{ "repo_name": "tikue/jcs2-snapshot", "path": "src/java/org/apache/commons/jcs/auxiliary/disk/AbstractDiskCache.java", "license": "apache-2.0", "size": 29154 }
[ "java.io.IOException", "java.util.Map", "org.apache.commons.jcs.engine.behavior.ICacheElement" ]
import java.io.IOException; import java.util.Map; import org.apache.commons.jcs.engine.behavior.ICacheElement;
import java.io.*; import java.util.*; import org.apache.commons.jcs.engine.behavior.*;
[ "java.io", "java.util", "org.apache.commons" ]
java.io; java.util; org.apache.commons;
2,652,017
@Override public void injectEvents(HandlerManager eventBus) { // Event handling is done here. }
void function(HandlerManager eventBus) { }
/** * To handle events. * * @param eventBus HandlerManager */
To handle events
injectEvents
{ "repo_name": "kuzavas/ephesoft", "path": "dcma-gwt/dcma-gwt-admin/src/main/java/com/ephesoft/dcma/gwt/admin/bm/client/presenter/kvextraction/EditKVExtractionPresenter.java", "license": "agpl-3.0", "size": 9647 }
[ "com.google.gwt.event.shared.HandlerManager" ]
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.event.shared.*;
[ "com.google.gwt" ]
com.google.gwt;
311,371
public static ims.core.clinical.domain.objects.Assessment extractAssessment(ims.domain.ILightweightDomainFactory domainFactory, ims.core.vo.AssessmentToolVo valueObject) { return extractAssessment(domainFactory, valueObject, new HashMap()); }
static ims.core.clinical.domain.objects.Assessment function(ims.domain.ILightweightDomainFactory domainFactory, ims.core.vo.AssessmentToolVo valueObject) { return extractAssessment(domainFactory, valueObject, new HashMap()); }
/** * Create the domain object from the value object. * @param domainFactory - used to create existing (persistent) domain objects. * @param valueObject - extract the domain object fields from this. */
Create the domain object from the value object
extractAssessment
{ "repo_name": "open-health-hub/openMAXIMS", "path": "openmaxims_workspace/ValueObjects/src/ims/core/vo/domain/AssessmentToolVoAssembler.java", "license": "agpl-3.0", "size": 19426 }
[ "java.util.HashMap" ]
import java.util.HashMap;
import java.util.*;
[ "java.util" ]
java.util;
1,577,857
public static boolean saveDocument(Document doc, String filename) { try { // Prepare the DOM document for writing Source source = new DOMSource(doc); // Prepare the output file File file = new File(filename); Result result = new StreamResult(file); // Creater a transformer factory TransformerFactory xfactory = TransformerFactory. newInstance(); // Create a transformer Transformer transformer = xfactory. newTransformer(); // Force pretty printing transformer.setOutputProperty(OutputKeys.METHOD, "xml"); transformer.setOutputProperty(OutputKeys.INDENT, "yes"); transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2"); transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); // Serialization by transformation transformer.transform(source, result); // Done return true; } catch (TransformerConfigurationException e) { } catch (TransformerException e) { } // Return false for any sort of problem return false; }
static boolean function(Document doc, String filename) { try { Source source = new DOMSource(doc); File file = new File(filename); Result result = new StreamResult(file); TransformerFactory xfactory = TransformerFactory. newInstance(); Transformer transformer = xfactory. newTransformer(); transformer.setOutputProperty(OutputKeys.METHOD, "xml"); transformer.setOutputProperty(OutputKeys.INDENT, "yes"); transformer.setOutputProperty(STRUTF-8"); transformer.transform(source, result); return true; } catch (TransformerConfigurationException e) { } catch (TransformerException e) { } return false; }
/** * Save a document to a file. */
Save a document to a file
saveDocument
{ "repo_name": "amritbhat786/DocIT", "path": "101repo/contributions/dom/org/softlang/operations/DOMUtilities.java", "license": "mit", "size": 2881 }
[ "java.io.File", "javax.xml.transform.OutputKeys", "javax.xml.transform.Result", "javax.xml.transform.Source", "javax.xml.transform.Transformer", "javax.xml.transform.TransformerConfigurationException", "javax.xml.transform.TransformerException", "javax.xml.transform.TransformerFactory", "javax.xml.transform.dom.DOMSource", "javax.xml.transform.stream.StreamResult", "org.w3c.dom.Document" ]
import java.io.File; import javax.xml.transform.OutputKeys; import javax.xml.transform.Result; import javax.xml.transform.Source; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerConfigurationException; import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; import org.w3c.dom.Document;
import java.io.*; import javax.xml.transform.*; import javax.xml.transform.dom.*; import javax.xml.transform.stream.*; import org.w3c.dom.*;
[ "java.io", "javax.xml", "org.w3c.dom" ]
java.io; javax.xml; org.w3c.dom;
2,021,394
public ArrayList<E> getData(){ return data; }
ArrayList<E> function(){ return data; }
/** * Gets the data list. This is used to access * data with {@link #refreshData()}, so override * if you want to customize what the data is (sending * null to the contructor is a good idea in that case) * @return */
Gets the data list. This is used to access data with <code>#refreshData()</code>, so override if you want to customize what the data is (sending null to the contructor is a good idea in that case)
getData
{ "repo_name": "petebrew/tellervo", "path": "src/main/java/org/tellervo/desktop/components/table/DynamicJComboBox.java", "license": "gpl-3.0", "size": 8382 }
[ "java.util.ArrayList" ]
import java.util.ArrayList;
import java.util.*;
[ "java.util" ]
java.util;
2,858,550
public List<ImageDescription> describeImages(List<String> imageIds, List<String> owners, List<String> users, ImageType type) throws EC2Exception { Map<String, String> params = new HashMap<String, String>(); for (int i=0 ; i<imageIds.size(); i++) { params.put("ImageId."+(i+1), imageIds.get(i)); } for (int i=0 ; i<owners.size(); i++) { params.put("Owner."+(i+1), owners.get(i)); } for (int i=0 ; i<users.size(); i++) { params.put("ExecutableBy."+(i+1), users.get(i)); } if (type != null) { params.put("ImageType", type.getTypeId()); } return describeImages(params); }
List<ImageDescription> function(List<String> imageIds, List<String> owners, List<String> users, ImageType type) throws EC2Exception { Map<String, String> params = new HashMap<String, String>(); for (int i=0 ; i<imageIds.size(); i++) { params.put(STR+(i+1), imageIds.get(i)); } for (int i=0 ; i<owners.size(); i++) { params.put(STR+(i+1), owners.get(i)); } for (int i=0 ; i<users.size(); i++) { params.put(STR+(i+1), users.get(i)); } if (type != null) { params.put(STR, type.getTypeId()); } return describeImages(params); }
/** * Describe the AMIs that match the intersection of the criteria supplied * * @param imageIds A list of AMI IDs as returned by {@link #registerImage(String)}. * @param owners A list of owners. * @param users A list of users. * @param type An image type. * @return A list of {@link ImageDescription} instances describing each AMI ID. * @throws EC2Exception wraps checked exceptions */
Describe the AMIs that match the intersection of the criteria supplied
describeImages
{ "repo_name": "jonnyzzz/maragogype", "path": "tags/v1.6/java/com/xerox/amazonws/ec2/Jec2.java", "license": "apache-2.0", "size": 81043 }
[ "java.util.HashMap", "java.util.List", "java.util.Map" ]
import java.util.HashMap; import java.util.List; import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
494,517
@ManagedOperation(description = "Returns the JSON schema representation of the data format parameters for the given data format name") String dataFormatParameterJsonSchema(String dataFormatName) throws Exception;
@ManagedOperation(description = STR) String dataFormatParameterJsonSchema(String dataFormatName) throws Exception;
/** * Returns the JSON schema representation with information about the data format and the parameters it supports * * @param dataFormatName the name of the data format to lookup * @throws Exception is thrown if error occurred */
Returns the JSON schema representation with information about the data format and the parameters it supports
dataFormatParameterJsonSchema
{ "repo_name": "oscerd/camel", "path": "camel-core/src/main/java/org/apache/camel/api/management/mbean/ManagedCamelContextMBean.java", "license": "apache-2.0", "size": 15790 }
[ "org.apache.camel.api.management.ManagedOperation" ]
import org.apache.camel.api.management.ManagedOperation;
import org.apache.camel.api.management.*;
[ "org.apache.camel" ]
org.apache.camel;
779,326
public void setDefaultWorkflowId(WorkflowContext.TriggerType type, Long id) { String workflowKey = workflowSettingKey(type); if (id == null) { settings.delete(workflowKey); } else { settings.set(workflowKey, id.toString()); } }
void function(WorkflowContext.TriggerType type, Long id) { String workflowKey = workflowSettingKey(type); if (id == null) { settings.delete(workflowKey); } else { settings.set(workflowKey, id.toString()); } }
/** * Sets the workflow of the default it. * * @param id Id of the default workflow, or {@code null}, for disabling the * default workflow. * @param type type of the workflow. */
Sets the workflow of the default it
setDefaultWorkflowId
{ "repo_name": "JayanthyChengan/dataverse", "path": "src/main/java/edu/harvard/iq/dataverse/workflow/WorkflowServiceBean.java", "license": "apache-2.0", "size": 18747 }
[ "edu.harvard.iq.dataverse.workflow.WorkflowContext" ]
import edu.harvard.iq.dataverse.workflow.WorkflowContext;
import edu.harvard.iq.dataverse.workflow.*;
[ "edu.harvard.iq" ]
edu.harvard.iq;
1,260,661
public static Writer asWriter(Appendable target) { if (target instanceof Writer) { return (Writer) target; } return new AppendableWriter(target); }
static Writer function(Appendable target) { if (target instanceof Writer) { return (Writer) target; } return new AppendableWriter(target); }
/** * Returns a Writer that sends all output to the given {@link Appendable} target. Closing the * writer will close the target if it is {@link Closeable}, and flushing the writer will flush the * target if it is {@link java.io.Flushable}. * * @param target the object to which output will be sent * @return a new Writer object, unless target is a Writer, in which case the target is returned */
Returns a Writer that sends all output to the given <code>Appendable</code> target. Closing the writer will close the target if it is <code>Closeable</code>, and flushing the writer will flush the target if it is <code>java.io.Flushable</code>
asWriter
{ "repo_name": "simonzhangsm/voltdb", "path": "third_party/java/src/com/google_voltpatches/common/io/CharStreams.java", "license": "agpl-3.0", "size": 8230 }
[ "java.io.Writer" ]
import java.io.Writer;
import java.io.*;
[ "java.io" ]
java.io;
2,745,388
public static void getMissCounts(final PrintWriter out) { final ArrayList<Entry<String, AtomicInteger>> entries = new ArrayList<>(missCounts.entrySet());
static void function(final PrintWriter out) { final ArrayList<Entry<String, AtomicInteger>> entries = new ArrayList<>(missCounts.entrySet());
/** * Dump the miss counts collected so far to a given output stream * @param out print stream */
Dump the miss counts collected so far to a given output stream
getMissCounts
{ "repo_name": "dmlloyd/openjdk-modules", "path": "nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/LinkerCallSite.java", "license": "gpl-2.0", "size": 20408 }
[ "java.io.PrintWriter", "java.util.ArrayList", "java.util.Map", "java.util.concurrent.atomic.AtomicInteger" ]
import java.io.PrintWriter; import java.util.ArrayList; import java.util.Map; import java.util.concurrent.atomic.AtomicInteger;
import java.io.*; import java.util.*; import java.util.concurrent.atomic.*;
[ "java.io", "java.util" ]
java.io; java.util;
2,802,882
private void executeRegularServletResult(String finalLocation, ActionInvocation actionInvocation) throws ServletException, IOException { ServletContext ctx = ServletActionContext.getServletContext(); HttpServletRequest req = ServletActionContext.getRequest(); HttpServletResponse res = ServletActionContext.getResponse(); try { ctx.getRequestDispatcher(finalLocation).include(req, res); } catch (ServletException e) { LOG.error("ServletException including " + finalLocation, e); throw e; } catch (IOException e) { LOG.error("IOException while including result '" + finalLocation + "'", e); throw e; } }
void function(String finalLocation, ActionInvocation actionInvocation) throws ServletException, IOException { ServletContext ctx = ServletActionContext.getServletContext(); HttpServletRequest req = ServletActionContext.getRequest(); HttpServletResponse res = ServletActionContext.getResponse(); try { ctx.getRequestDispatcher(finalLocation).include(req, res); } catch (ServletException e) { LOG.error(STR + finalLocation, e); throw e; } catch (IOException e) { LOG.error(STR + finalLocation + "'", e); throw e; } }
/** * Executes the regular servlet result. */
Executes the regular servlet result
executeRegularServletResult
{ "repo_name": "codeApeFromChina/resource", "path": "frame_packages/java_libs/struts-2.3.15.2/src/plugins/portlet/src/main/java/org/apache/struts2/portlet/result/PortletResult.java", "license": "unlicense", "size": 9327 }
[ "com.opensymphony.xwork2.ActionInvocation", "java.io.IOException", "javax.servlet.ServletContext", "javax.servlet.ServletException", "javax.servlet.http.HttpServletRequest", "javax.servlet.http.HttpServletResponse", "org.apache.struts2.ServletActionContext" ]
import com.opensymphony.xwork2.ActionInvocation; import java.io.IOException; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.struts2.ServletActionContext;
import com.opensymphony.xwork2.*; import java.io.*; import javax.servlet.*; import javax.servlet.http.*; import org.apache.struts2.*;
[ "com.opensymphony.xwork2", "java.io", "javax.servlet", "org.apache.struts2" ]
com.opensymphony.xwork2; java.io; javax.servlet; org.apache.struts2;
1,795,228
protected void checkVectorDimensions(int n) throws MathIllegalArgumentException { if (getDimension() != n) { throw new MathIllegalArgumentException(LocalizedCoreFormats.DIMENSIONS_MISMATCH, getDimension(), n); } }
void function(int n) throws MathIllegalArgumentException { if (getDimension() != n) { throw new MathIllegalArgumentException(LocalizedCoreFormats.DIMENSIONS_MISMATCH, getDimension(), n); } }
/** * Check if instance dimension is equal to some expected value. * * @param n Expected dimension. * @throws MathIllegalArgumentException if the dimensions do not match. */
Check if instance dimension is equal to some expected value
checkVectorDimensions
{ "repo_name": "sdinot/hipparchus", "path": "hipparchus-core/src/main/java/org/hipparchus/linear/SparseFieldVector.java", "license": "apache-2.0", "size": 28240 }
[ "org.hipparchus.exception.LocalizedCoreFormats", "org.hipparchus.exception.MathIllegalArgumentException" ]
import org.hipparchus.exception.LocalizedCoreFormats; import org.hipparchus.exception.MathIllegalArgumentException;
import org.hipparchus.exception.*;
[ "org.hipparchus.exception" ]
org.hipparchus.exception;
230,356
public Map getClientQueueSizes() { Map queueSizes = new HashMap(); for (Object o : _clientProxies.values()) { CacheClientProxy proxy = (CacheClientProxy) o; queueSizes.put(proxy.getProxyID(), proxy.getQueueSize()); } return queueSizes; }
Map function() { Map queueSizes = new HashMap(); for (Object o : _clientProxies.values()) { CacheClientProxy proxy = (CacheClientProxy) o; queueSizes.put(proxy.getProxyID(), proxy.getQueueSize()); } return queueSizes; }
/** * Returns (possibly stale) map of queue sizes for all clients notified by this server. * * @return map with CacheClientProxy as key, and Integer as a value */
Returns (possibly stale) map of queue sizes for all clients notified by this server
getClientQueueSizes
{ "repo_name": "davinash/geode", "path": "geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CacheClientNotifier.java", "license": "apache-2.0", "size": 82063 }
[ "java.util.HashMap", "java.util.Map" ]
import java.util.HashMap; import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
581,068
public Object getAttribute(String key) { if (this.userAttributes == null) { return null; } final List<Object> values = this.userAttributes.get(key); if (values != null && values.size() > 0) { return values.get(0); } return null; }
Object function(String key) { if (this.userAttributes == null) { return null; } final List<Object> values = this.userAttributes.get(key); if (values != null && values.size() > 0) { return values.get(0); } return null; }
/** * Returns an attribute for a key. For objects represented as strings, * a <code>java.lang.String</code> will be returned. Binary values will * be represented as byte arrays. * @param key the attribute name. * @return value the attribute value identified by the key. */
Returns an attribute for a key. For objects represented as strings, a <code>java.lang.String</code> will be returned. Binary values will be represented as byte arrays
getAttribute
{ "repo_name": "chomman/uPortal", "path": "uportal-war/src/main/java/org/jasig/portal/security/provider/PersonImpl.java", "license": "apache-2.0", "size": 10396 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,544,581
void scheduleDayOfWeekJob(String subject, Map<Object, Object> parameters, DateTime start, DateTime end, List<Object> days, DateTime time, Boolean ignorePastFiresAtStart);
void scheduleDayOfWeekJob(String subject, Map<Object, Object> parameters, DateTime start, DateTime end, List<Object> days, DateTime time, Boolean ignorePastFiresAtStart);
/** * Schedules job, which will be fired at given time on days of week provided by user. * * @param subject the subject for {@code MotechEvent} fired, when job is triggered, not null * @param parameters the parameters for {@code MotechEvent}, not null * @param start the {@code DateTime} at which should become ACTIVE, not null * @param end the {@code DateTime} at which job should be stopped, null treated as never end * @param days the list of days at which job should be fired, not null * @param time the {@code Time} at which job should be fired * @param ignorePastFiresAtStart the flag defining whether job should ignore past fires at start or not, not null */
Schedules job, which will be fired at given time on days of week provided by user
scheduleDayOfWeekJob
{ "repo_name": "adamkalmus/motech", "path": "modules/scheduler/scheduler/src/main/java/org/motechproject/scheduler/service/MotechSchedulerActionProxyService.java", "license": "bsd-3-clause", "size": 5090 }
[ "java.util.List", "java.util.Map", "org.joda.time.DateTime" ]
import java.util.List; import java.util.Map; import org.joda.time.DateTime;
import java.util.*; import org.joda.time.*;
[ "java.util", "org.joda.time" ]
java.util; org.joda.time;
71,297
public synchronized File getBaseDirRelative() { // Must first convert to absolute path names to ensure parents are available File parent = new File(DEFAULT_BASE).getAbsoluteFile(); File f = base.getAbsoluteFile(); ArrayDeque<String> l = new ArrayDeque<>(); while (f != null) { if (f.equals(parent)){ if (l.isEmpty()){ break; } File rel = new File(l.pop()); while(!l.isEmpty()) { rel = new File(rel, l.pop()); } return rel; } l.push(f.getName()); f = f.getParentFile(); } return new File("."); }
synchronized File function() { File parent = new File(DEFAULT_BASE).getAbsoluteFile(); File f = base.getAbsoluteFile(); ArrayDeque<String> l = new ArrayDeque<>(); while (f != null) { if (f.equals(parent)){ if (l.isEmpty()){ break; } File rel = new File(l.pop()); while(!l.isEmpty()) { rel = new File(rel, l.pop()); } return rel; } l.push(f.getName()); f = f.getParentFile(); } return new File("."); }
/** * Calculates the relative path from DEFAULT_BASE to the current base, * which must be the same as or a child of the default. * * @return the relative path, or {@code "."} if the path cannot be determined */
Calculates the relative path from DEFAULT_BASE to the current base, which must be the same as or a child of the default
getBaseDirRelative
{ "repo_name": "benbenw/jmeter", "path": "src/core/src/main/java/org/apache/jmeter/services/FileServer.java", "license": "apache-2.0", "size": 23326 }
[ "java.io.File", "java.util.ArrayDeque" ]
import java.io.File; import java.util.ArrayDeque;
import java.io.*; import java.util.*;
[ "java.io", "java.util" ]
java.io; java.util;
2,523,828
protected net.opengis.ogc.ComparisonOperatorType.Enum getEnum4ComparisonOperator( ComparisonOperator comparisonOperator) { switch (comparisonOperator) { case PropertyIsBetween: return ComparisonOperatorType.BETWEEN; case PropertyIsEqualTo: return ComparisonOperatorType.EQUAL_TO; case PropertyIsGreaterThan: return ComparisonOperatorType.GREATER_THAN; case PropertyIsGreaterThanOrEqualTo: return ComparisonOperatorType.GREATER_THAN_EQUAL_TO; case PropertyIsLessThan: return ComparisonOperatorType.LESS_THAN; case PropertyIsLessThanOrEqualTo: return ComparisonOperatorType.LESS_THAN_EQUAL_TO; case PropertyIsLike: return ComparisonOperatorType.LIKE; case PropertyIsNotEqualTo: return ComparisonOperatorType.NOT_EQUAL_TO; case PropertyIsNull: return ComparisonOperatorType.NULL_CHECK; default: return null; } }
net.opengis.ogc.ComparisonOperatorType.Enum function( ComparisonOperator comparisonOperator) { switch (comparisonOperator) { case PropertyIsBetween: return ComparisonOperatorType.BETWEEN; case PropertyIsEqualTo: return ComparisonOperatorType.EQUAL_TO; case PropertyIsGreaterThan: return ComparisonOperatorType.GREATER_THAN; case PropertyIsGreaterThanOrEqualTo: return ComparisonOperatorType.GREATER_THAN_EQUAL_TO; case PropertyIsLessThan: return ComparisonOperatorType.LESS_THAN; case PropertyIsLessThanOrEqualTo: return ComparisonOperatorType.LESS_THAN_EQUAL_TO; case PropertyIsLike: return ComparisonOperatorType.LIKE; case PropertyIsNotEqualTo: return ComparisonOperatorType.NOT_EQUAL_TO; case PropertyIsNull: return ComparisonOperatorType.NULL_CHECK; default: return null; } }
/** * Get the Enum for the comparison operator. * * @param comparisonOperator * Supported comparison operator * @return Enum */
Get the Enum for the comparison operator
getEnum4ComparisonOperator
{ "repo_name": "ahuarte47/SOS", "path": "coding/sos-v100/src/main/java/org/n52/sos/encode/sos/v1/GetCapabilitiesResponseEncoder.java", "license": "gpl-2.0", "size": 20630 }
[ "net.opengis.ogc.ComparisonOperatorType", "org.n52.sos.ogc.filter.FilterConstants" ]
import net.opengis.ogc.ComparisonOperatorType; import org.n52.sos.ogc.filter.FilterConstants;
import net.opengis.ogc.*; import org.n52.sos.ogc.filter.*;
[ "net.opengis.ogc", "org.n52.sos" ]
net.opengis.ogc; org.n52.sos;
2,826,840
public AppStateClient getAppStateClient() { if (mAppStateClient == null) { throw new IllegalStateException("No AppStateClient. Did you request it at setup?"); } return mAppStateClient; }
AppStateClient function() { if (mAppStateClient == null) { throw new IllegalStateException(STR); } return mAppStateClient; }
/** * Returns the AppStateClient object. In order to call this method, you must have * called @link{#setup} with a set of clients that includes CLIENT_APPSTATE. */
Returns the AppStateClient object. In order to call this method, you must have called @link{#setup} with a set of clients that includes CLIENT_APPSTATE
getAppStateClient
{ "repo_name": "cdeange/Marathon", "path": "marathon/src/main/java/com/deange/marathonapp/google/GoogleClients.java", "license": "apache-2.0", "size": 7466 }
[ "com.google.android.gms.appstate.AppStateClient" ]
import com.google.android.gms.appstate.AppStateClient;
import com.google.android.gms.appstate.*;
[ "com.google.android" ]
com.google.android;
2,060,262
Integer updateDownloadCompleteInfoByDmId(long dmId, VideoModel de, DataCallback<Integer> callback);
Integer updateDownloadCompleteInfoByDmId(long dmId, VideoModel de, DataCallback<Integer> callback);
/** * Marks the download as complete for the given dmid. * NOTE - This should be done irrespective of username as if the user is * logged out and download is in progress, it should update download complete in the db. * * @param dmId * @return */
Marks the download as complete for the given dmid. NOTE - This should be done irrespective of username as if the user is logged out and download is in progress, it should update download complete in the db
updateDownloadCompleteInfoByDmId
{ "repo_name": "ahmedaljazzar/edx-app-android", "path": "OpenEdXMobile/src/main/java/org/edx/mobile/module/db/IDatabase.java", "license": "apache-2.0", "size": 16351 }
[ "org.edx.mobile.model.VideoModel" ]
import org.edx.mobile.model.VideoModel;
import org.edx.mobile.model.*;
[ "org.edx.mobile" ]
org.edx.mobile;
1,735,028
protected JvmMemGCTableMeta createJvmMemGCTableMetaNode(String tableName, String groupName, SnmpMib mib, MBeanServer server) { return new JvmMemGCTableMeta(mib, objectserver); }
JvmMemGCTableMeta function(String tableName, String groupName, SnmpMib mib, MBeanServer server) { return new JvmMemGCTableMeta(mib, objectserver); }
/** * Factory method for "JvmMemGCTable" table metadata class. * * You can redefine this method if you need to replace the default * generated metadata class with your own customized class. * * @param tableName Name of the table object ("JvmMemGCTable") * @param groupName Name of the group to which this table belong ("JvmMemory") * @param mib The SnmpMib object in which this table is registered * @param server MBeanServer for this table entries (may be null) * * @return An instance of the metadata class generated for the * "JvmMemGCTable" table (JvmMemGCTableMeta) * **/
Factory method for "JvmMemGCTable" table metadata class. You can redefine this method if you need to replace the default generated metadata class with your own customized class
createJvmMemGCTableMetaNode
{ "repo_name": "rokn/Count_Words_2015", "path": "testing/openjdk2/jdk/src/share/classes/sun/management/snmp/jvmmib/JvmMemoryMeta.java", "license": "mit", "size": 22300 }
[ "com.sun.jmx.snmp.agent.SnmpMib", "javax.management.MBeanServer" ]
import com.sun.jmx.snmp.agent.SnmpMib; import javax.management.MBeanServer;
import com.sun.jmx.snmp.agent.*; import javax.management.*;
[ "com.sun.jmx", "javax.management" ]
com.sun.jmx; javax.management;
333,584
public Pattern getValidationPattern() { return this.validationPattern; }
Pattern function() { return this.validationPattern; }
/** * Gets the Pattern object used to validate user input for this Property. * * @return the user input validation Pattern object, or null if none is set */
Gets the Pattern object used to validate user input for this Property
getValidationPattern
{ "repo_name": "SuperUnitato/UnLonely", "path": "build/tmp/recompileMc/sources/net/minecraftforge/common/config/Property.java", "license": "lgpl-2.1", "size": 34468 }
[ "java.util.regex.Pattern" ]
import java.util.regex.Pattern;
import java.util.regex.*;
[ "java.util" ]
java.util;
1,401,554
public NodeList<TypeParameter> getTypeParameters() { return typeParameters; }
NodeList<TypeParameter> function() { return typeParameters; }
/** * Gets the type parameters. * * @return the type parameters */
Gets the type parameters
getTypeParameters
{ "repo_name": "DigiArea/jse-model", "path": "com.digiarea.jse/src/com/digiarea/jse/MethodDeclaration.java", "license": "epl-1.0", "size": 8741 }
[ "com.digiarea.jse.NodeList", "com.digiarea.jse.TypeParameter" ]
import com.digiarea.jse.NodeList; import com.digiarea.jse.TypeParameter;
import com.digiarea.jse.*;
[ "com.digiarea.jse" ]
com.digiarea.jse;
2,719,729
public int isProvidingWeakPower(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) { TileEntityPiInput tile = (TileEntityPiInput) par1IBlockAccess.getTileEntity(par2, par3, par4); return tile.getInputStatus() ? 15 : 0; }
int function(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) { TileEntityPiInput tile = (TileEntityPiInput) par1IBlockAccess.getTileEntity(par2, par3, par4); return tile.getInputStatus() ? 15 : 0; }
/** * Returns true if the block is emitting direct/strong redstone power on the specified side. Args: World, X, Y, Z, * side */
Returns true if the block is emitting direct/strong redstone power on the specified side. Args: World, X, Y, Z, side
isProvidingWeakPower
{ "repo_name": "infchem/RealRobots", "path": "src/main/java/infchem/realrobots/block/BlockPiInput.java", "license": "lgpl-2.1", "size": 4285 }
[ "net.minecraft.world.IBlockAccess" ]
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.*;
[ "net.minecraft.world" ]
net.minecraft.world;
2,506,351
public String hmset(final byte[] key, final Map<byte[], byte[]> hash) { checkIsInMulti(); client.hmset(key, hash); return client.getStatusCodeReply(); }
String function(final byte[] key, final Map<byte[], byte[]> hash) { checkIsInMulti(); client.hmset(key, hash); return client.getStatusCodeReply(); }
/** * Set the respective fields to the respective values. HMSET replaces old * values with new values. * <p> * If key does not exist, a new key holding a hash is created. * <p> * <b>Time complexity:</b> O(N) (with N being the number of fields) * * @param key * @param hash * @return Always OK because HMSET can't fail */
Set the respective fields to the respective values. HMSET replaces old values with new values. If key does not exist, a new key holding a hash is created. Time complexity: O(N) (with N being the number of fields)
hmset
{ "repo_name": "grzegorz-dubicki/jedis", "path": "src/main/java/redis/clients/jedis/BinaryJedis.java", "license": "mit", "size": 110999 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
1,362,473
public static int countLines(String filepath) throws IOException { LineNumberReader reader = new LineNumberReader(new FileReader(filepath)); while(reader.readLine() != null) {} int count = reader.getLineNumber(); reader.close(); return count; }
static int function(String filepath) throws IOException { LineNumberReader reader = new LineNumberReader(new FileReader(filepath)); while(reader.readLine() != null) {} int count = reader.getLineNumber(); reader.close(); return count; }
/** * This methods counts the number of lines in a text file. * @param filepath the path to the file * @return the number of lines as an int * @throws IOException Exception if error reading/writting file */
This methods counts the number of lines in a text file
countLines
{ "repo_name": "ArneBinder/LanguageAnalyzer", "path": "src/main/java/ca/pfv/spmf/test/MainTestEIHI_Xupdates.java", "license": "gpl-3.0", "size": 2940 }
[ "java.io.FileReader", "java.io.IOException", "java.io.LineNumberReader" ]
import java.io.FileReader; import java.io.IOException; import java.io.LineNumberReader;
import java.io.*;
[ "java.io" ]
java.io;
1,390,059
@Test public void testContinuousMode() throws Exception { depMode = DeploymentMode.CONTINUOUS; processTest(); }
void function() throws Exception { depMode = DeploymentMode.CONTINUOUS; processTest(); }
/** * Test GridDeploymentMode.CONTINUOUS mode. * * @throws Exception If failed. */
Test GridDeploymentMode.CONTINUOUS mode
testContinuousMode
{ "repo_name": "ilantukh/ignite", "path": "modules/core/src/test/java/org/apache/ignite/p2p/GridP2PComputeWithNestedEntryProcessorTest.java", "license": "apache-2.0", "size": 9182 }
[ "org.apache.ignite.configuration.DeploymentMode" ]
import org.apache.ignite.configuration.DeploymentMode;
import org.apache.ignite.configuration.*;
[ "org.apache.ignite" ]
org.apache.ignite;
2,146,839
@Test public void testReflect2() throws WalaException, IllegalArgumentException, CancelException, IOException { AnalysisScope scope = findOrCreateAnalysisScope(); IClassHierarchy cha = findOrCreateCHA(scope); Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha, TestConstants.REFLECT2_MAIN); AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints); CallGraph cg = CallGraphTestUtil.buildZeroOneCFA(options, new AnalysisCache(), cha, scope, false); TypeReference tr = TypeReference.findOrCreate(ClassLoaderReference.Application, "Ljava/lang/Integer"); MethodReference mr = MethodReference.findOrCreate(tr, "<clinit>", "()V"); Set<CGNode> nodes = cg.getNodes(mr); Assert.assertFalse(nodes.isEmpty()); }
void function() throws WalaException, IllegalArgumentException, CancelException, IOException { AnalysisScope scope = findOrCreateAnalysisScope(); IClassHierarchy cha = findOrCreateCHA(scope); Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha, TestConstants.REFLECT2_MAIN); AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints); CallGraph cg = CallGraphTestUtil.buildZeroOneCFA(options, new AnalysisCache(), cha, scope, false); TypeReference tr = TypeReference.findOrCreate(ClassLoaderReference.Application, STR); MethodReference mr = MethodReference.findOrCreate(tr, STR, "()V"); Set<CGNode> nodes = cg.getNodes(mr); Assert.assertFalse(nodes.isEmpty()); }
/** * Test that when analyzing reflect2, the call graph includes a node for * java.lang.Integer.<clinit>. This should be forced by the call for * Class.forName("java.lang.Integer"). */
Test that when analyzing reflect2, the call graph includes a node for java.lang.Integer.. This should be forced by the call for Class.forName("java.lang.Integer")
testReflect2
{ "repo_name": "nithinvnath/PAVProject", "path": "com.ibm.wala.core.tests/src/com/ibm/wala/core/tests/callGraph/ReflectionTest.java", "license": "mit", "size": 35065 }
[ "com.ibm.wala.core.tests.util.TestConstants", "com.ibm.wala.ipa.callgraph.AnalysisCache", "com.ibm.wala.ipa.callgraph.AnalysisOptions", "com.ibm.wala.ipa.callgraph.AnalysisScope", "com.ibm.wala.ipa.callgraph.CGNode", "com.ibm.wala.ipa.callgraph.CallGraph", "com.ibm.wala.ipa.callgraph.Entrypoint", "com.ibm.wala.ipa.cha.IClassHierarchy", "com.ibm.wala.types.ClassLoaderReference", "com.ibm.wala.types.MethodReference", "com.ibm.wala.types.TypeReference", "com.ibm.wala.util.CancelException", "com.ibm.wala.util.WalaException", "java.io.IOException", "java.util.Set", "org.junit.Assert" ]
import com.ibm.wala.core.tests.util.TestConstants; import com.ibm.wala.ipa.callgraph.AnalysisCache; import com.ibm.wala.ipa.callgraph.AnalysisOptions; import com.ibm.wala.ipa.callgraph.AnalysisScope; import com.ibm.wala.ipa.callgraph.CGNode; import com.ibm.wala.ipa.callgraph.CallGraph; import com.ibm.wala.ipa.callgraph.Entrypoint; import com.ibm.wala.ipa.cha.IClassHierarchy; import com.ibm.wala.types.ClassLoaderReference; import com.ibm.wala.types.MethodReference; import com.ibm.wala.types.TypeReference; import com.ibm.wala.util.CancelException; import com.ibm.wala.util.WalaException; import java.io.IOException; import java.util.Set; import org.junit.Assert;
import com.ibm.wala.core.tests.util.*; import com.ibm.wala.ipa.callgraph.*; import com.ibm.wala.ipa.cha.*; import com.ibm.wala.types.*; import com.ibm.wala.util.*; import java.io.*; import java.util.*; import org.junit.*;
[ "com.ibm.wala", "java.io", "java.util", "org.junit" ]
com.ibm.wala; java.io; java.util; org.junit;
2,856,084
private String getLayoutDescriptor(InputDeviceIdentifier identifier) { if (identifier == null || identifier.getDescriptor() == null) { throw new IllegalArgumentException("identifier and descriptor must not be null"); } if (identifier.getVendorId() == 0 && identifier.getProductId() == 0) { return identifier.getDescriptor(); } StringBuilder bob = new StringBuilder(); bob.append("vendor:").append(identifier.getVendorId()); bob.append(",product:").append(identifier.getProductId()); return bob.toString(); }
String function(InputDeviceIdentifier identifier) { if (identifier == null identifier.getDescriptor() == null) { throw new IllegalArgumentException(STR); } if (identifier.getVendorId() == 0 && identifier.getProductId() == 0) { return identifier.getDescriptor(); } StringBuilder bob = new StringBuilder(); bob.append(STR).append(identifier.getVendorId()); bob.append(STR).append(identifier.getProductId()); return bob.toString(); }
/** * Builds a layout descriptor for the vendor/product. This returns the * descriptor for ids that aren't useful (such as the default 0, 0). */
Builds a layout descriptor for the vendor/product. This returns the descriptor for ids that aren't useful (such as the default 0, 0)
getLayoutDescriptor
{ "repo_name": "OmniEvo/android_frameworks_base", "path": "services/core/java/com/android/server/input/InputManagerService.java", "license": "gpl-3.0", "size": 78202 }
[ "android.hardware.input.InputDeviceIdentifier" ]
import android.hardware.input.InputDeviceIdentifier;
import android.hardware.input.*;
[ "android.hardware" ]
android.hardware;
195,231
@PostMapping("/saveattributemapping") public String saveAttributeMapping( @RequestParam() String mappingProjectId, @RequestParam() String target, @RequestParam() String source, @RequestParam() String targetAttribute, @RequestParam() String algorithm, @RequestParam() AlgorithmState algorithmState) { MappingProject mappingProject = mappingService.getMappingProject(mappingProjectId); MappingTarget mappingTarget = mappingProject.getMappingTarget(target); EntityMapping mappingForSource = mappingTarget.getMappingForSource(source); if (algorithm.isEmpty()) { mappingForSource.deleteAttributeMapping(targetAttribute); } else { AttributeMapping attributeMapping = mappingForSource.getAttributeMapping(targetAttribute); if (attributeMapping == null) { attributeMapping = mappingForSource.addAttributeMapping(targetAttribute); } attributeMapping.setAlgorithm(algorithm); attributeMapping.setAlgorithmState(algorithmState); } mappingService.updateMappingProject(mappingProject); return "redirect:" + getMappingServiceMenuUrl() + "/mappingproject/" + mappingProject.getIdentifier(); }
@PostMapping(STR) String function( @RequestParam() String mappingProjectId, @RequestParam() String target, @RequestParam() String source, @RequestParam() String targetAttribute, @RequestParam() String algorithm, @RequestParam() AlgorithmState algorithmState) { MappingProject mappingProject = mappingService.getMappingProject(mappingProjectId); MappingTarget mappingTarget = mappingProject.getMappingTarget(target); EntityMapping mappingForSource = mappingTarget.getMappingForSource(source); if (algorithm.isEmpty()) { mappingForSource.deleteAttributeMapping(targetAttribute); } else { AttributeMapping attributeMapping = mappingForSource.getAttributeMapping(targetAttribute); if (attributeMapping == null) { attributeMapping = mappingForSource.addAttributeMapping(targetAttribute); } attributeMapping.setAlgorithm(algorithm); attributeMapping.setAlgorithmState(algorithmState); } mappingService.updateMappingProject(mappingProject); return STR + getMappingServiceMenuUrl() + STR + mappingProject.getIdentifier(); }
/** * Adds a new {@link AttributeMapping} to an {@link EntityMapping}. * * @param mappingProjectId ID of the mapping project * @param target name of the target entity * @param source name of the source entity * @param targetAttribute name of the target attribute * @param algorithm the mapping algorithm * @return redirect URL for the attributemapping */
Adds a new <code>AttributeMapping</code> to an <code>EntityMapping</code>
saveAttributeMapping
{ "repo_name": "marikaris/molgenis", "path": "molgenis-semantic-mapper/src/main/java/org/molgenis/semanticmapper/controller/MappingServiceController.java", "license": "lgpl-3.0", "size": 44481 }
[ "org.molgenis.semanticmapper.mapping.model.AttributeMapping", "org.molgenis.semanticmapper.mapping.model.EntityMapping", "org.molgenis.semanticmapper.mapping.model.MappingProject", "org.molgenis.semanticmapper.mapping.model.MappingTarget", "org.springframework.web.bind.annotation.PostMapping", "org.springframework.web.bind.annotation.RequestParam" ]
import org.molgenis.semanticmapper.mapping.model.AttributeMapping; import org.molgenis.semanticmapper.mapping.model.EntityMapping; import org.molgenis.semanticmapper.mapping.model.MappingProject; import org.molgenis.semanticmapper.mapping.model.MappingTarget; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestParam;
import org.molgenis.semanticmapper.mapping.model.*; import org.springframework.web.bind.annotation.*;
[ "org.molgenis.semanticmapper", "org.springframework.web" ]
org.molgenis.semanticmapper; org.springframework.web;
1,940,161
public K firstKey() { if (size() == 0) { throw new NoSuchElementException("Map is empty"); } return insertOrder.get(0); }
K function() { if (size() == 0) { throw new NoSuchElementException(STR); } return insertOrder.get(0); }
/** * Gets the first key in this map by insert order. * * @return the first key currently in this map * @throws NoSuchElementException if this map is empty */
Gets the first key in this map by insert order
firstKey
{ "repo_name": "gonmarques/commons-collections", "path": "src/main/java/org/apache/commons/collections4/map/ListOrderedMap.java", "license": "apache-2.0", "size": 25462 }
[ "java.util.NoSuchElementException" ]
import java.util.NoSuchElementException;
import java.util.*;
[ "java.util" ]
java.util;
1,390,902
private boolean findAndVerifyAvro(String url, String newStoreDefXml, boolean hasCompression, int replicationFactor, int requiredReads, int requiredWrites, String serializerName, KeyValueSchema schemaObj) { log.info("Verifying store against cluster URL: " + url + " (node id " + this.nodeId + ")\n" + newStoreDefXml.toString()); StoreDefinition newStoreDef = VoldemortUtils.getStoreDef(newStoreDefXml); // get store def from cluster List<StoreDefinition> remoteStoreDefs = adminClientPerCluster.get(url).metadataMgmtOps.getRemoteStoreDefList(this.nodeId).getValue(); boolean foundStore = false; // go over all store defs and see if one has the same name as the store we're trying to build for(StoreDefinition remoteStoreDef: remoteStoreDefs) { if(remoteStoreDef.getName().equals(storeName)) { // if the store already exists, but doesn't match what we want to push, we need to worry if(!remoteStoreDef.equals(newStoreDef)) { // let's check to see if the key/value serializers are // REALLY equal. SerializerDefinition localKeySerializerDef = newStoreDef.getKeySerializer(); SerializerDefinition localValueSerializerDef = newStoreDef.getValueSerializer(); SerializerDefinition remoteKeySerializerDef = remoteStoreDef.getKeySerializer(); SerializerDefinition remoteValueSerializerDef = remoteStoreDef.getValueSerializer(); if(remoteKeySerializerDef.getName().equals(serializerName) && remoteValueSerializerDef.getName().equals(serializerName)) { Schema remoteKeyDef = Schema.parse(remoteKeySerializerDef.getCurrentSchemaInfo()); Schema remoteValDef = Schema.parse(remoteValueSerializerDef.getCurrentSchemaInfo()); Schema localKeyDef = Schema.parse(localKeySerializerDef.getCurrentSchemaInfo()); Schema localValDef = Schema.parse(localValueSerializerDef.getCurrentSchemaInfo()); if(remoteKeyDef.equals(localKeyDef) && remoteValDef.equals(localValDef)) { String compressionPolicy = ""; if(hasCompression) { compressionPolicy = "\n\t\t<compression><type>gzip</type></compression>"; } // if the key/value serializers are REALLY equal // (even though the strings may not match), then // just use the remote stores to GUARANTEE that // they // match, and try again. String keySerializerStr = "\n\t\t<type>" + remoteKeySerializerDef.getName() + "</type>"; if(remoteKeySerializerDef.hasVersion()) { Map<Integer, String> versions = new HashMap<Integer, String>(); for(Map.Entry<Integer, String> entry: remoteKeySerializerDef.getAllSchemaInfoVersions() .entrySet()) { keySerializerStr += "\n\t\t <schema-info version=\"" + entry.getKey() + "\">" + entry.getValue() + "</schema-info>\n\t"; } } else { keySerializerStr = "\n\t\t<type>" + serializerName + "</type>\n\t\t<schema-info version=\"0\">" + remoteKeySerializerDef.getCurrentSchemaInfo() + "</schema-info>\n\t"; } schemaObj.keySchema = keySerializerStr; String valueSerializerStr = "\n\t\t<type>" + remoteValueSerializerDef.getName() + "</type>"; if(remoteValueSerializerDef.hasVersion()) { Map<Integer, String> versions = new HashMap<Integer, String>(); for(Map.Entry<Integer, String> entry: remoteValueSerializerDef.getAllSchemaInfoVersions() .entrySet()) { valueSerializerStr += "\n\t\t <schema-info version=\"" + entry.getKey() + "\">" + entry.getValue() + "</schema-info>\n\t"; } valueSerializerStr += compressionPolicy + "\n\t"; } else { valueSerializerStr = "\n\t\t<type>" + serializerName + "</type>\n\t\t<schema-info version=\"0\">" + remoteValueSerializerDef.getCurrentSchemaInfo() + "</schema-info>" + compressionPolicy + "\n\t"; } schemaObj.valSchema = valueSerializerStr; newStoreDefXml = VoldemortUtils.getStoreDefXml(storeName, replicationFactor, requiredReads, requiredWrites, props.containsKey(BUILD_PREFERRED_READS) ? props.getInt(BUILD_PREFERRED_READS) : null, props.containsKey(BUILD_PREFERRED_WRITES) ? props.getInt(BUILD_PREFERRED_WRITES) : null, keySerializerStr, valueSerializerStr); newStoreDef = VoldemortUtils.getStoreDef(newStoreDefXml); if(!remoteStoreDef.equals(newStoreDef)) { // if we still get a fail, then we know that the store defs don't match for reasons // OTHER than the key/value serializer String errorMessage = "Your store schema is identical, " + "but the store definition does not match on cluster URL: " + url; log.error(errorMessage + diffMessage(newStoreDef, remoteStoreDef)); throw new VoldemortException(errorMessage); } } else { // if the key/value serializers are not equal (even in java, not just json strings), // then fail String errorMessage = "Your data schema does not match the schema which is already " + "defined on cluster URL " + url; log.error(errorMessage + diffMessage(newStoreDef, remoteStoreDef)); throw new VoldemortException(errorMessage); } } else { String errorMessage = "Your store definition does not match the store definition that is " + "already defined on cluster URL: " + url; log.error(errorMessage + diffMessage(newStoreDef, remoteStoreDef)); throw new VoldemortException(errorMessage); } } foundStore = true; break; } } return foundStore; } private class HeartBeatHookRunnable implements Runnable { final int sleepTimeMs; boolean keepRunning = true; HeartBeatHookRunnable(int sleepTimeMs) { this.sleepTimeMs = sleepTimeMs; }
boolean function(String url, String newStoreDefXml, boolean hasCompression, int replicationFactor, int requiredReads, int requiredWrites, String serializerName, KeyValueSchema schemaObj) { log.info(STR + url + STR + this.nodeId + ")\n" + newStoreDefXml.toString()); StoreDefinition newStoreDef = VoldemortUtils.getStoreDef(newStoreDefXml); List<StoreDefinition> remoteStoreDefs = adminClientPerCluster.get(url).metadataMgmtOps.getRemoteStoreDefList(this.nodeId).getValue(); boolean foundStore = false; for(StoreDefinition remoteStoreDef: remoteStoreDefs) { if(remoteStoreDef.getName().equals(storeName)) { if(!remoteStoreDef.equals(newStoreDef)) { SerializerDefinition localKeySerializerDef = newStoreDef.getKeySerializer(); SerializerDefinition localValueSerializerDef = newStoreDef.getValueSerializer(); SerializerDefinition remoteKeySerializerDef = remoteStoreDef.getKeySerializer(); SerializerDefinition remoteValueSerializerDef = remoteStoreDef.getValueSerializer(); if(remoteKeySerializerDef.getName().equals(serializerName) && remoteValueSerializerDef.getName().equals(serializerName)) { Schema remoteKeyDef = Schema.parse(remoteKeySerializerDef.getCurrentSchemaInfo()); Schema remoteValDef = Schema.parse(remoteValueSerializerDef.getCurrentSchemaInfo()); Schema localKeyDef = Schema.parse(localKeySerializerDef.getCurrentSchemaInfo()); Schema localValDef = Schema.parse(localValueSerializerDef.getCurrentSchemaInfo()); if(remoteKeyDef.equals(localKeyDef) && remoteValDef.equals(localValDef)) { String compressionPolicy = STR\n\t\t<compression><type>gzip</type></compression>STR\n\t\t<type>STR</type>STR\n\t\t <schema-info version=\STR\">" + entry.getValue() + STR; } } else { keySerializerStr = STR + serializerName + STR0\">" + remoteKeySerializerDef.getCurrentSchemaInfo() + STR; } schemaObj.keySchema = keySerializerStr; String valueSerializerStr = STR + remoteValueSerializerDef.getName() + STR; if(remoteValueSerializerDef.hasVersion()) { Map<Integer, String> versions = new HashMap<Integer, String>(); for(Map.Entry<Integer, String> entry: remoteValueSerializerDef.getAllSchemaInfoVersions() .entrySet()) { valueSerializerStr += "\n\t\t <schema-info version=\STR\">" + entry.getValue() + STR; } valueSerializerStr += compressionPolicy + "\n\t"; } else { valueSerializerStr = STR + serializerName + STR0\">" + remoteValueSerializerDef.getCurrentSchemaInfo() + STR + compressionPolicy + "\n\t"; } schemaObj.valSchema = valueSerializerStr; newStoreDefXml = VoldemortUtils.getStoreDefXml(storeName, replicationFactor, requiredReads, requiredWrites, props.containsKey(BUILD_PREFERRED_READS) ? props.getInt(BUILD_PREFERRED_READS) : null, props.containsKey(BUILD_PREFERRED_WRITES) ? props.getInt(BUILD_PREFERRED_WRITES) : null, keySerializerStr, valueSerializerStr); newStoreDef = VoldemortUtils.getStoreDef(newStoreDefXml); if(!remoteStoreDef.equals(newStoreDef)) { String errorMessage = STR + STR + url; log.error(errorMessage + diffMessage(newStoreDef, remoteStoreDef)); throw new VoldemortException(errorMessage); } } else { String errorMessage = STR + STR + url; log.error(errorMessage + diffMessage(newStoreDef, remoteStoreDef)); throw new VoldemortException(errorMessage); } } else { String errorMessage = STR + STR + url; log.error(errorMessage + diffMessage(newStoreDef, remoteStoreDef)); throw new VoldemortException(errorMessage); } } foundStore = true; break; } } return foundStore; } private class HeartBeatHookRunnable implements Runnable { final int sleepTimeMs; boolean keepRunning = true; HeartBeatHookRunnable(int sleepTimeMs) { this.sleepTimeMs = sleepTimeMs; }
/** * Check if store exists and then verify the schema. Returns false if store doesn't exist * * @param url to check * @param newStoreDefXml * @param hasCompression * @param replicationFactor * @param requiredReads * @param requiredWrites * @param serializerName * @param schemaObj key/value schema obj * @return boolean value true means store exists, false otherwise * */
Check if store exists and then verify the schema. Returns false if store doesn't exist
findAndVerifyAvro
{ "repo_name": "null-exception/voldemort", "path": "contrib/hadoop-store-builder/src/java/voldemort/store/readonly/mr/azkaban/VoldemortBuildAndPushJob.java", "license": "apache-2.0", "size": 65853 }
[ "java.util.HashMap", "java.util.List", "java.util.Map", "org.apache.avro.Schema" ]
import java.util.HashMap; import java.util.List; import java.util.Map; import org.apache.avro.Schema;
import java.util.*; import org.apache.avro.*;
[ "java.util", "org.apache.avro" ]
java.util; org.apache.avro;
2,843,703
protected Color getColor() { return colors[getTraceCount() % colors.length]; }
Color function() { return colors[getTraceCount() % colors.length]; }
/** * Returns a <code>Color</code> among the table of colors. * * @return a <code>Color</code> among the table of colors. */
Returns a <code>Color</code> among the table of colors
getColor
{ "repo_name": "sfrancis1970/EpochX", "path": "monitor/src/main/java/org/epochx/monitor/chart/Chart.java", "license": "gpl-3.0", "size": 8127 }
[ "java.awt.Color" ]
import java.awt.Color;
import java.awt.*;
[ "java.awt" ]
java.awt;
583,069
public HealthEnvironment health() { return healthEnvironment; }
HealthEnvironment function() { return healthEnvironment; }
/** * Returns the application's {@link HealthEnvironment}. */
Returns the application's <code>HealthEnvironment</code>
health
{ "repo_name": "phambryan/dropwizard", "path": "dropwizard-core/src/main/java/io/dropwizard/setup/Environment.java", "license": "apache-2.0", "size": 8077 }
[ "io.dropwizard.health.HealthEnvironment" ]
import io.dropwizard.health.HealthEnvironment;
import io.dropwizard.health.*;
[ "io.dropwizard.health" ]
io.dropwizard.health;
2,795,641
public List getProcessTree(int pid);
List function(int pid);
/** * Gets the process tree. * * @param pid * the pid * * @return the process tree */
Gets the process tree
getProcessTree
{ "repo_name": "cstroe/yajsw", "path": "src/yajsw/src/main/java/org/rzo/yajsw/os/ProcessManager.java", "license": "apache-2.0", "size": 1762 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
317,804
DatabaseManager dbm = Global.getInstance().getDatabaseManager(); InventoryDbo dbo = null; try ( PreparedStatement pstmt = dbm.prepareStatement( connection, "/sql/Inventory/SelectByPlayerId.sql", p -> p.setLong(1, playerId)); ResultSet rs = pstmt.executeQuery() ) { if (rs.next()) { dbo = new InventoryDbo(); dbo.fromResultSet(connection, rs); } } catch (Exception sqle) { LOGGER.error("Failed to find inventory for playerId={}", playerId, sqle); } return dbo; }
DatabaseManager dbm = Global.getInstance().getDatabaseManager(); InventoryDbo dbo = null; try ( PreparedStatement pstmt = dbm.prepareStatement( connection, STR, p -> p.setLong(1, playerId)); ResultSet rs = pstmt.executeQuery() ) { if (rs.next()) { dbo = new InventoryDbo(); dbo.fromResultSet(connection, rs); } } catch (Exception sqle) { LOGGER.error(STR, playerId, sqle); } return dbo; }
/** * Inventory for a player * @param connection Connection * @param playerId PLayerDbo id * @return InventoryDbo or null if none */
Inventory for a player
getByPlayerId
{ "repo_name": "achacha/SomeWebCardGame", "path": "src/main/java/org/achacha/webcardgame/game/dbo/InventoryDboFactory.java", "license": "mit", "size": 1347 }
[ "java.sql.PreparedStatement", "java.sql.ResultSet", "org.achacha.base.db.DatabaseManager", "org.achacha.base.global.Global" ]
import java.sql.PreparedStatement; import java.sql.ResultSet; import org.achacha.base.db.DatabaseManager; import org.achacha.base.global.Global;
import java.sql.*; import org.achacha.base.db.*; import org.achacha.base.global.*;
[ "java.sql", "org.achacha.base" ]
java.sql; org.achacha.base;
1,167,070
private static void checkCodecs(final Configuration c) throws IOException { // check to see if the codec list is available: String [] codecs = c.getStrings("hbase.regionserver.codecs", (String[])null); if (codecs == null) return; for (String codec : codecs) { if (!CompressionTest.testCompression(codec)) { throw new IOException("Compression codec " + codec + " not supported, aborting RS construction"); } } }
static void function(final Configuration c) throws IOException { String [] codecs = c.getStrings(STR, (String[])null); if (codecs == null) return; for (String codec : codecs) { if (!CompressionTest.testCompression(codec)) { throw new IOException(STR + codec + STR); } } }
/** * Run test on configured codecs to make sure supporting libs are in place. * @param c * @throws IOException */
Run test on configured codecs to make sure supporting libs are in place
checkCodecs
{ "repo_name": "baishuo/hbase-1.0.0-cdh5.4.7_baishuo", "path": "hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java", "license": "apache-2.0", "size": 119179 }
[ "java.io.IOException", "org.apache.hadoop.conf.Configuration", "org.apache.hadoop.hbase.util.CompressionTest" ]
import java.io.IOException; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.util.CompressionTest;
import java.io.*; import org.apache.hadoop.conf.*; import org.apache.hadoop.hbase.util.*;
[ "java.io", "org.apache.hadoop" ]
java.io; org.apache.hadoop;
2,499,697
Map<UUID, ServerUpdateResult> getDeploymentActionResults();
Map<UUID, ServerUpdateResult> getDeploymentActionResults();
/** * Gets the result of a {@link DeploymentAction} action associated with * the deployment set plan. * * @return the result */
Gets the result of a <code>DeploymentAction</code> action associated with the deployment set plan
getDeploymentActionResults
{ "repo_name": "luck3y/wildfly-core", "path": "controller-client/src/main/java/org/jboss/as/controller/client/helpers/domain/ServerDeploymentPlanResult.java", "license": "lgpl-2.1", "size": 1676 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
860,826
protected void addClientProxy(CacheClientProxy proxy) throws IOException { // this._logger.info(LocalizedStrings.DEBUG, "adding client proxy " + proxy); getCache(); // ensure cache reference is up to date so firstclient state is correct this._clientProxies.put(proxy.getProxyID(), proxy); // Remove this proxy from the init proxy list. removeClientInitProxy(proxy); this._connectionListener.queueAdded(proxy.getProxyID()); if (!(proxy.clientConflation == HandShake.CONFLATION_ON)) { // Delta not supported with conflation ON ClientHealthMonitor chm = ClientHealthMonitor.getInstance(); if (chm != null) { chm.numOfClientsPerVersion.incrementAndGet(proxy.getVersion().ordinal()); } } }
void function(CacheClientProxy proxy) throws IOException { getCache(); this._clientProxies.put(proxy.getProxyID(), proxy); removeClientInitProxy(proxy); this._connectionListener.queueAdded(proxy.getProxyID()); if (!(proxy.clientConflation == HandShake.CONFLATION_ON)) { ClientHealthMonitor chm = ClientHealthMonitor.getInstance(); if (chm != null) { chm.numOfClientsPerVersion.incrementAndGet(proxy.getVersion().ordinal()); } } }
/** * Adds a new <code>CacheClientProxy</code> to the list of known client * proxies * * @param proxy * The <code>CacheClientProxy</code> to add */
Adds a new <code>CacheClientProxy</code> to the list of known client proxies
addClientProxy
{ "repo_name": "SnappyDataInc/snappy-store", "path": "gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/CacheClientNotifier.java", "license": "apache-2.0", "size": 101839 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
1,165,696
Single<Boolean> addAll(Collection<V> objects);
Single<Boolean> addAll(Collection<V> objects);
/** * Adds all elements contained in <code>objects</code> collection into this structure * * @param objects - elements to add * @return <code>true</code> if at least one object has been added * or <code>false</code> if all were already added */
Adds all elements contained in <code>objects</code> collection into this structure
addAll
{ "repo_name": "mrniko/redisson", "path": "redisson/src/main/java/org/redisson/api/RHyperLogLogRx.java", "license": "apache-2.0", "size": 2336 }
[ "io.reactivex.rxjava3.core.Single", "java.util.Collection" ]
import io.reactivex.rxjava3.core.Single; import java.util.Collection;
import io.reactivex.rxjava3.core.*; import java.util.*;
[ "io.reactivex.rxjava3", "java.util" ]
io.reactivex.rxjava3; java.util;
2,910,313
public void put(Object requestEntity, WebResource webResource, String contentType) { decorate(webResource, contentType).put(requestEntity); }
void function(Object requestEntity, WebResource webResource, String contentType) { decorate(webResource, contentType).put(requestEntity); }
/** * Adds authorization and media type headers and executes PUT request. * * @param c * expected type * @param requestEntity * object to be sent. * @param webResource * requested resource * @return */
Adds authorization and media type headers and executes PUT request
put
{ "repo_name": "ow2-xlcloud/openstack-sdk", "path": "openstack-commons/src/main/java/org/xlcloud/openstack/client/WebResourceRequestBuilderDecorator.java", "license": "apache-2.0", "size": 12765 }
[ "com.sun.jersey.api.client.WebResource" ]
import com.sun.jersey.api.client.WebResource;
import com.sun.jersey.api.client.*;
[ "com.sun.jersey" ]
com.sun.jersey;
924,135
@SuppressWarnings("unchecked") public static <T> HierarchyBuilderRedactionBased<T> create(File file) throws IOException{ ObjectInputStream ois = null; try { ois = new ObjectInputStream(new FileInputStream(file)); HierarchyBuilderRedactionBased<T> result = (HierarchyBuilderRedactionBased<T>)ois.readObject(); return result; } catch (Exception e) { throw new IOException(e); } finally { if (ois != null) ois.close(); } }
@SuppressWarnings(STR) static <T> HierarchyBuilderRedactionBased<T> function(File file) throws IOException{ ObjectInputStream ois = null; try { ois = new ObjectInputStream(new FileInputStream(file)); HierarchyBuilderRedactionBased<T> result = (HierarchyBuilderRedactionBased<T>)ois.readObject(); return result; } catch (Exception e) { throw new IOException(e); } finally { if (ois != null) ois.close(); } }
/** * Loads a builder specification from the given file. * * @param <T> * @param file * @return * @throws IOException */
Loads a builder specification from the given file
create
{ "repo_name": "arx-deidentifier/arx", "path": "src/main/org/deidentifier/arx/aggregates/HierarchyBuilderRedactionBased.java", "license": "apache-2.0", "size": 18413 }
[ "java.io.File", "java.io.FileInputStream", "java.io.IOException", "java.io.ObjectInputStream" ]
import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.ObjectInputStream;
import java.io.*;
[ "java.io" ]
java.io;
864,896
public Builder withButtonSize(int size) { size = convertToPixels(size, scale); params = new FrameLayout.LayoutParams(size, size); return this; }
Builder function(int size) { size = convertToPixels(size, scale); params = new FrameLayout.LayoutParams(size, size); return this; }
/** * Sets the FAB size in dp */
Sets the FAB size in dp
withButtonSize
{ "repo_name": "ForkTheCode/Knot-It", "path": "KnotIt/app/src/main/java/utilities/FloatingActionButton.java", "license": "mit", "size": 6377 }
[ "android.widget.FrameLayout" ]
import android.widget.FrameLayout;
import android.widget.*;
[ "android.widget" ]
android.widget;
995,830
void addAlias(String alias, String definition); } static final AliasTransformationHandler NULL_ALIAS_TRANSFORMATION_HANDLER = new NullAliasTransformationHandler(); private static class NullAliasTransformationHandler implements AliasTransformationHandler, Serializable { private static final long serialVersionUID = 0L; private static final AliasTransformation NULL_ALIAS_TRANSFORMATION = new NullAliasTransformation();
void addAlias(String alias, String definition); } static final AliasTransformationHandler NULL_ALIAS_TRANSFORMATION_HANDLER = new NullAliasTransformationHandler(); private static class NullAliasTransformationHandler implements AliasTransformationHandler, Serializable { private static final long serialVersionUID = 0L; private static final AliasTransformation NULL_ALIAS_TRANSFORMATION = new NullAliasTransformation();
/** * Adds an alias definition to the AliasTransformation instance. * <p> * Last definition for a given alias is kept if an alias is inserted * multiple times (since this is generally the behavior in JavaScript code). * * @param alias the name of the alias. * @param definition the definition of the alias. */
Adds an alias definition to the AliasTransformation instance. Last definition for a given alias is kept if an alias is inserted multiple times (since this is generally the behavior in JavaScript code)
addAlias
{ "repo_name": "PengXing/closure-compiler", "path": "src/com/google/javascript/jscomp/CompilerOptions.java", "license": "apache-2.0", "size": 67488 }
[ "java.io.Serializable" ]
import java.io.Serializable;
import java.io.*;
[ "java.io" ]
java.io;
956,143
public IgniteLogger log(String ctgr);
IgniteLogger function(String ctgr);
/** * Gets logger for given category. * * @param ctgr Category. * @return Logger. */
Gets logger for given category
log
{ "repo_name": "vldpyatkov/ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/GridKernalContext.java", "license": "apache-2.0", "size": 17217 }
[ "org.apache.ignite.IgniteLogger" ]
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.*;
[ "org.apache.ignite" ]
org.apache.ignite;
271,283
public int getInvoiceC_Currency_ID() { if (m_C_Invoice_ID == 0) return 0; String sql = "SELECT C_Currency_ID " + "FROM C_Invoice " + "WHERE C_Invoice_ID=?"; return DB.getSQLValue(null, sql, m_C_Invoice_ID); } // getInvoiceC_Currency_ID
int function() { if (m_C_Invoice_ID == 0) return 0; String sql = STR + STR + STR; return DB.getSQLValue(null, sql, m_C_Invoice_ID); }
/** * Get Invoice C_Currency_ID * @return 0 if no invoice -1 if not found */
Get Invoice C_Currency_ID
getInvoiceC_Currency_ID
{ "repo_name": "erpcya/adempierePOS", "path": "base/src/org/compiere/acct/DocLine_Allocation.java", "license": "gpl-2.0", "size": 4639 }
[ "org.compiere.util.DB" ]
import org.compiere.util.DB;
import org.compiere.util.*;
[ "org.compiere.util" ]
org.compiere.util;
1,161,861
@Test public void wrongNumberOfFxRates() { DoubleArray values = DoubleArray.of(1, 2, 3); FxRateScenarioArray rates = FxRateScenarioArray.of(GBP, USD, DoubleArray.of(1.61, 1.62)); ScenarioFxRateProvider fxProvider = new TestScenarioFxRateProvider(rates); CurrencyScenarioArray test = CurrencyScenarioArray.of(GBP, values); assertThatIllegalArgumentException() .isThrownBy(() -> test.convertedTo(USD, fxProvider)) .withMessage("Expected 3 FX rates but received 2"); }
void function() { DoubleArray values = DoubleArray.of(1, 2, 3); FxRateScenarioArray rates = FxRateScenarioArray.of(GBP, USD, DoubleArray.of(1.61, 1.62)); ScenarioFxRateProvider fxProvider = new TestScenarioFxRateProvider(rates); CurrencyScenarioArray test = CurrencyScenarioArray.of(GBP, values); assertThatIllegalArgumentException() .isThrownBy(() -> test.convertedTo(USD, fxProvider)) .withMessage(STR); }
/** * Test the expected exception is thrown if there are not the same number of rates as there are values. */
Test the expected exception is thrown if there are not the same number of rates as there are values
wrongNumberOfFxRates
{ "repo_name": "OpenGamma/Strata", "path": "modules/data/src/test/java/com/opengamma/strata/data/scenario/CurrencyScenarioArrayTest.java", "license": "apache-2.0", "size": 8468 }
[ "com.opengamma.strata.collect.array.DoubleArray", "org.assertj.core.api.Assertions" ]
import com.opengamma.strata.collect.array.DoubleArray; import org.assertj.core.api.Assertions;
import com.opengamma.strata.collect.array.*; import org.assertj.core.api.*;
[ "com.opengamma.strata", "org.assertj.core" ]
com.opengamma.strata; org.assertj.core;
1,564,691
public void setLastSeen(Date lastSeen) { this.lastSeen = lastSeen; }
void function(Date lastSeen) { this.lastSeen = lastSeen; }
/** * Sets the last seen. * * @param lastSeen the new last seen */
Sets the last seen
setLastSeen
{ "repo_name": "cristcost/sensormix", "path": "sensormix-dataservice-bundle/src/main/java/com/google/developers/gdgfirenze/datamodeljpa/JpaSensor.java", "license": "apache-2.0", "size": 4044 }
[ "java.util.Date" ]
import java.util.Date;
import java.util.*;
[ "java.util" ]
java.util;
958,832
public BigFraction pow(final BigInteger exponent) { if (exponent.compareTo(BigInteger.ZERO) < 0) { final BigInteger eNeg = exponent.negate(); return new BigFraction(MathUtils.pow(denominator, eNeg), MathUtils.pow(numerator, eNeg)); } return new BigFraction(MathUtils.pow(numerator, exponent), MathUtils.pow(denominator, exponent)); }
BigFraction function(final BigInteger exponent) { if (exponent.compareTo(BigInteger.ZERO) < 0) { final BigInteger eNeg = exponent.negate(); return new BigFraction(MathUtils.pow(denominator, eNeg), MathUtils.pow(numerator, eNeg)); } return new BigFraction(MathUtils.pow(numerator, exponent), MathUtils.pow(denominator, exponent)); }
/** * <p> * Returns a <code>BigFraction</code> whose value is * <tt>(this<sup>exponent</sup>)</tt>, returning the result in reduced form. * </p> * * @param exponent * exponent to which this <code>BigFraction</code> is to be raised. * @return <tt>this<sup>exponent</sup></tt> as a <code>BigFraction</code>. */
Returns a <code>BigFraction</code> whose value is (thisexponent), returning the result in reduced form.
pow
{ "repo_name": "SpoonLabs/astor", "path": "examples/math_85/src/java/org/apache/commons/math/fraction/BigFraction.java", "license": "gpl-2.0", "size": 37211 }
[ "java.math.BigInteger", "org.apache.commons.math.util.MathUtils" ]
import java.math.BigInteger; import org.apache.commons.math.util.MathUtils;
import java.math.*; import org.apache.commons.math.util.*;
[ "java.math", "org.apache.commons" ]
java.math; org.apache.commons;
968,793
private void showErrorDialog(String message) { new AlertDialog.Builder(this) .setTitle("Error") .setMessage(message) .setPositiveButton(android.R.string.ok, null) .setIcon(android.R.drawable.ic_dialog_alert) .show(); }
void function(String message) { new AlertDialog.Builder(this) .setTitle("Error") .setMessage(message) .setPositiveButton(android.R.string.ok, null) .setIcon(android.R.drawable.ic_dialog_alert) .show(); }
/** * Show errors to users */
Show errors to users
showErrorDialog
{ "repo_name": "WildDogTeam/demo-android-login", "path": "app/src/main/java/com/wilddog/samples/logindemo/MainActivity.java", "license": "mit", "size": 11275 }
[ "android.app.AlertDialog" ]
import android.app.AlertDialog;
import android.app.*;
[ "android.app" ]
android.app;
120,971
public void test_WriteArrayComplex() { Exception ex = null; try{ System.setProperty("org.apache.wink.common.model.json.factory.impl", "org.apache.wink.json4j.compat.impl.ApacheJSONFactory"); JSONFactory factory = JSONFactory.newInstance(); JSONStringer jStringer = factory.createJSONStringer(); jStringer.array(); jStringer.value("String1"); jStringer.value(false); jStringer.value(1); // Place an object jStringer.object(); jStringer.key("string"); jStringer.value("String2"); jStringer.endObject(); // Place an array jStringer.array(); jStringer.value(1); jStringer.value((double)2); jStringer.value((short)3); jStringer.endArray(); //Close top array. jStringer.endArray(); String str = jStringer.toString(); // Verify it parses. JSONArray test = factory.createJSONArray(str); assertTrue(str.equals("[\"String1\",false,1,{\"string\":\"String2\"},[1,2.0,3]]")); }catch(Exception ex1){ ex = ex1; ex.printStackTrace(); } assertTrue(ex == null); }
void function() { Exception ex = null; try{ System.setProperty(STR, STR); JSONFactory factory = JSONFactory.newInstance(); JSONStringer jStringer = factory.createJSONStringer(); jStringer.array(); jStringer.value(STR); jStringer.value(false); jStringer.value(1); jStringer.object(); jStringer.key(STR); jStringer.value(STR); jStringer.endObject(); jStringer.array(); jStringer.value(1); jStringer.value((double)2); jStringer.value((short)3); jStringer.endArray(); jStringer.endArray(); String str = jStringer.toString(); JSONArray test = factory.createJSONArray(str); assertTrue(str.equals("[\"String1\STRstring\":\"String2\STR)); }catch(Exception ex1){ ex = ex1; ex.printStackTrace(); } assertTrue(ex == null); }
/** * Test a simple object with multiple keys of varying types */
Test a simple object with multiple keys of varying types
test_WriteArrayComplex
{ "repo_name": "ElyxorCorp/wink-json4j", "path": "src/test/java/org/apache/wink/json4j/compat/tests/ApacheJSONStringerTest.java", "license": "apache-2.0", "size": 7854 }
[ "org.apache.wink.json4j.compat.JSONArray", "org.apache.wink.json4j.compat.JSONFactory", "org.apache.wink.json4j.compat.JSONStringer" ]
import org.apache.wink.json4j.compat.JSONArray; import org.apache.wink.json4j.compat.JSONFactory; import org.apache.wink.json4j.compat.JSONStringer;
import org.apache.wink.json4j.compat.*;
[ "org.apache.wink" ]
org.apache.wink;
417,429
@SuppressWarnings("unchecked") public void testAddCampaignAllReqAndAllOptionalFields() throws XmlRpcException, MalformedURLException { assertNotNull(advertiserId); Map<String, Object> myCampaign = new HashMap<String, Object>(); myCampaign.put(ADVERTISER_ID, advertiserId); myCampaign.put(CAMPAIGN_NAME, "test campaign"); myCampaign.put(START_DATE, DateUtils.MIN_DATE_VALUE); myCampaign.put(END_DATE, DateUtils.MAX_DATE_VALUE); myCampaign.put(IMPRESSIONS, 100); myCampaign.put(CLICKS, 210); myCampaign.put(PRIORITY, -1); myCampaign.put(WEIGHT, 102); myCampaign.put(TARGET_IMPRESSIONS, 0); myCampaign.put(TARGET_CLICKS, 0); myCampaign.put(TARGET_CONVERSIONS, -10); myCampaign.put(REVENUE, 10.50); myCampaign.put(REVENUE_TYPE, 2); Object[] XMLRPCMethodParameters = new Object[] { sessionId, myCampaign }; final Integer result = (Integer) execute(ADD_CAMPAIGN_METHOD, XMLRPCMethodParameters); assertNotNull(result); try { XMLRPCMethodParameters = new Object[] { sessionId, result }; final Map<String, Object> campaign = (Map<String, Object>) execute( GET_CAMPAIGN_METHOD, XMLRPCMethodParameters); checkParameter(campaign, ADVERTISER_ID, advertiserId); checkParameter(campaign, CAMPAIGN_ID, result); checkParameter(campaign, CAMPAIGN_NAME, myCampaign.get(CAMPAIGN_NAME)); checkParameter(campaign, START_DATE, myCampaign.get(START_DATE)); checkParameter(campaign, PRIORITY, myCampaign.get(PRIORITY)); checkParameter(campaign, WEIGHT, myCampaign.get(WEIGHT)); checkParameter(campaign, TARGET_IMPRESSIONS, myCampaign.get(TARGET_IMPRESSIONS)); checkParameter(campaign, TARGET_CLICKS, myCampaign.get(TARGET_CLICKS)); checkParameter(campaign, TARGET_CONVERSIONS, myCampaign.get(TARGET_CONVERSIONS)); checkParameter(campaign, REVENUE, myCampaign.get(REVENUE)); checkParameter(campaign, REVENUE_TYPE, myCampaign.get(REVENUE_TYPE)); } finally { deleteCampaign(result); } }
@SuppressWarnings(STR) void function() throws XmlRpcException, MalformedURLException { assertNotNull(advertiserId); Map<String, Object> myCampaign = new HashMap<String, Object>(); myCampaign.put(ADVERTISER_ID, advertiserId); myCampaign.put(CAMPAIGN_NAME, STR); myCampaign.put(START_DATE, DateUtils.MIN_DATE_VALUE); myCampaign.put(END_DATE, DateUtils.MAX_DATE_VALUE); myCampaign.put(IMPRESSIONS, 100); myCampaign.put(CLICKS, 210); myCampaign.put(PRIORITY, -1); myCampaign.put(WEIGHT, 102); myCampaign.put(TARGET_IMPRESSIONS, 0); myCampaign.put(TARGET_CLICKS, 0); myCampaign.put(TARGET_CONVERSIONS, -10); myCampaign.put(REVENUE, 10.50); myCampaign.put(REVENUE_TYPE, 2); Object[] XMLRPCMethodParameters = new Object[] { sessionId, myCampaign }; final Integer result = (Integer) execute(ADD_CAMPAIGN_METHOD, XMLRPCMethodParameters); assertNotNull(result); try { XMLRPCMethodParameters = new Object[] { sessionId, result }; final Map<String, Object> campaign = (Map<String, Object>) execute( GET_CAMPAIGN_METHOD, XMLRPCMethodParameters); checkParameter(campaign, ADVERTISER_ID, advertiserId); checkParameter(campaign, CAMPAIGN_ID, result); checkParameter(campaign, CAMPAIGN_NAME, myCampaign.get(CAMPAIGN_NAME)); checkParameter(campaign, START_DATE, myCampaign.get(START_DATE)); checkParameter(campaign, PRIORITY, myCampaign.get(PRIORITY)); checkParameter(campaign, WEIGHT, myCampaign.get(WEIGHT)); checkParameter(campaign, TARGET_IMPRESSIONS, myCampaign.get(TARGET_IMPRESSIONS)); checkParameter(campaign, TARGET_CLICKS, myCampaign.get(TARGET_CLICKS)); checkParameter(campaign, TARGET_CONVERSIONS, myCampaign.get(TARGET_CONVERSIONS)); checkParameter(campaign, REVENUE, myCampaign.get(REVENUE)); checkParameter(campaign, REVENUE_TYPE, myCampaign.get(REVENUE_TYPE)); } finally { deleteCampaign(result); } }
/** * Test method with all required fields and all optional. * * @throws XmlRpcException * @throws MalformedURLException */
Test method with all required fields and all optional
testAddCampaignAllReqAndAllOptionalFields
{ "repo_name": "Tate-ad/revive-adserver", "path": "www/api/v2/xmlrpc/tests/unit/src/test/java/org/openx/campaign/TestAddCampaign.java", "license": "gpl-2.0", "size": 16084 }
[ "java.net.MalformedURLException", "java.util.HashMap", "java.util.Map", "org.apache.xmlrpc.XmlRpcException", "org.openx.utils.DateUtils" ]
import java.net.MalformedURLException; import java.util.HashMap; import java.util.Map; import org.apache.xmlrpc.XmlRpcException; import org.openx.utils.DateUtils;
import java.net.*; import java.util.*; import org.apache.xmlrpc.*; import org.openx.utils.*;
[ "java.net", "java.util", "org.apache.xmlrpc", "org.openx.utils" ]
java.net; java.util; org.apache.xmlrpc; org.openx.utils;
1,740,409
@Override public void setDataSource(String path) throws IOException, IllegalArgumentException, SecurityException, IllegalStateException { mDataSource = path; _setDataSource(path, null, null); }
void function(String path) throws IOException, IllegalArgumentException, SecurityException, IllegalStateException { mDataSource = path; _setDataSource(path, null, null); }
/** * Sets the data source (file-path or http/rtsp URL) to use. * * @param path * the path of the file, or the http/rtsp URL of the stream you * want to play * @throws IllegalStateException * if it is called in an invalid state * * <p> * When <code>path</code> refers to a local file, the file may * actually be opened by a process other than the calling * application. This implies that the pathname should be an * absolute path (as any other process runs with unspecified * current working directory), and that the pathname should * reference a world-readable file. */
Sets the data source (file-path or http/rtsp URL) to use
setDataSource
{ "repo_name": "lingfliu/dv_omnicontrol_android", "path": "ijkplayer-java/src/main/java/tv/danmaku/ijk/media/player/IjkMediaPlayer.java", "license": "apache-2.0", "size": 47129 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
650,910
public static < DigestorT extends MessageDigest , BBT extends ByteBuffer > UUID gen ( UUID namespaceID , String name ) { byte[] namespaceIDBytes = BBT .allocateDirect(16) .order( ByteOrder .BIG_ENDIAN ) .putLong( 0 , namespaceID .getMostSignificantBits() ) .putLong( 8 , namespaceID .getLeastSignificantBits() ) .array() ; byte[] nameBytes = BBT .wrap(name .getBytes( Charset .forName( "UTF-8" ) ) ) .order( ByteOrder .BIG_ENDIAN ) .array() ; byte[] concatenatedBytes = Arrays .copyOf( namespaceIDBytes , namespaceIDBytes.length + nameBytes.length ) ; System .arraycopy( nameBytes , 0 , concatenatedBytes , namespaceIDBytes.length , nameBytes.length ) ; byte[] hash = DigestorT .getInstance( "SHA-1" ) .digest( concatenatedBytes ) ; hash[ 7 ] = ( hash[ 7 ] & 0b0000_1111 ) | 0b0101_0000 ; hash[ 8 ] = ( hash[ 8 ] & 0b0011_1111 ) | 0b1000_0000 ; ByteBuffer hashBB = BBT .wrap(hash) .order( ByteOrder .BIG_ENDIAN ) ; return new UUID(hashBB.getLong(0), hashBB.getLong(8)) ; }
static < DigestorT extends MessageDigest , BBT extends ByteBuffer > UUID function ( UUID namespaceID , String name ) { byte[] namespaceIDBytes = BBT .allocateDirect(16) .order( ByteOrder .BIG_ENDIAN ) .putLong( 0 , namespaceID .getMostSignificantBits() ) .putLong( 8 , namespaceID .getLeastSignificantBits() ) .array() ; byte[] nameBytes = BBT .wrap(name .getBytes( Charset .forName( "UTF-8" ) ) ) .order( ByteOrder .BIG_ENDIAN ) .array() ; byte[] concatenatedBytes = Arrays .copyOf( namespaceIDBytes , namespaceIDBytes.length + nameBytes.length ) ; System .arraycopy( nameBytes , 0 , concatenatedBytes , namespaceIDBytes.length , nameBytes.length ) ; byte[] hash = DigestorT .getInstance( "SHA-1" ) .digest( concatenatedBytes ) ; hash[ 7 ] = ( hash[ 7 ] & 0b0000_1111 ) 0b0101_0000 ; hash[ 8 ] = ( hash[ 8 ] & 0b0011_1111 ) 0b1000_0000 ; ByteBuffer hashBB = BBT .wrap(hash) .order( ByteOrder .BIG_ENDIAN ) ; return new UUID(hashBB.getLong(0), hashBB.getLong(8)) ; }
/** * Generate an RFC4122 version 5 UUID * * @param namespaceID UUID of the current namespace * @param name name of thing for which we are generating a UUID */
Generate an RFC4122 version 5 UUID
gen
{ "repo_name": "emma11gene/CPSC2100_Project", "path": "src/main/java/edu/utc/2015cpsc2100/ejkk/UUID_Generator.java", "license": "gpl-3.0", "size": 3665 }
[ "java.nio.ByteBuffer", "java.nio.ByteOrder", "java.nio.charset.Charset", "java.security.MessageDigest", "java.util.Arrays" ]
import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.charset.Charset; import java.security.MessageDigest; import java.util.Arrays;
import java.nio.*; import java.nio.charset.*; import java.security.*; import java.util.*;
[ "java.nio", "java.security", "java.util" ]
java.nio; java.security; java.util;
1,220,728
public ExecutionResult executeFlow(String projectName, String flow) { try { final List<NameValuePair> postPairs = new ArrayList<>(); postPairs.add(new BasicNameValuePair("session.id", sessionId)); postPairs.add(new BasicNameValuePair("ajax", "executeFlow")); postPairs.add(new BasicNameValuePair("project", projectName)); postPairs.add(new BasicNameValuePair("flow", flow)); final HttpPost post = new HttpPost(executionUri); post.setEntity(new UrlEncodedFormEntity(postPairs)); final String json = HttpManager.post(post); return (ExecutionResult) JsonUtil.deserialize(json, ExecutionResult.class); } catch (Exception ex) { ex.printStackTrace(); return new ExecutionResult(ex.getMessage()); } }
ExecutionResult function(String projectName, String flow) { try { final List<NameValuePair> postPairs = new ArrayList<>(); postPairs.add(new BasicNameValuePair(STR, sessionId)); postPairs.add(new BasicNameValuePair("ajax", STR)); postPairs.add(new BasicNameValuePair(STR, projectName)); postPairs.add(new BasicNameValuePair("flow", flow)); final HttpPost post = new HttpPost(executionUri); post.setEntity(new UrlEncodedFormEntity(postPairs)); final String json = HttpManager.post(post); return (ExecutionResult) JsonUtil.deserialize(json, ExecutionResult.class); } catch (Exception ex) { ex.printStackTrace(); return new ExecutionResult(ex.getMessage()); } }
/** * Logs into Azkaban and returns the result with the session ID * * @param projectName The project name containing the flow to execute * @param flow The flow to execute * @return {@link ezbake.azkaban.manager.result.AuthenticationResult} containing the session ID if successful */
Logs into Azkaban and returns the result with the session ID
executeFlow
{ "repo_name": "infochimps-forks/ezbake-platform-services", "path": "deployer/azkaban-submitter/src/main/java/ezbake/azkaban/manager/ExecutionManager.java", "license": "apache-2.0", "size": 7351 }
[ "java.util.ArrayList", "java.util.List", "org.apache.http.NameValuePair", "org.apache.http.client.entity.UrlEncodedFormEntity", "org.apache.http.client.methods.HttpPost", "org.apache.http.message.BasicNameValuePair" ]
import java.util.ArrayList; import java.util.List; import org.apache.http.NameValuePair; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.message.BasicNameValuePair;
import java.util.*; import org.apache.http.*; import org.apache.http.client.entity.*; import org.apache.http.client.methods.*; import org.apache.http.message.*;
[ "java.util", "org.apache.http" ]
java.util; org.apache.http;
2,908,947
protected void addGpuP2PPropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_P2_16xlarge_gpuP2P_feature"), getString("_UI_PropertyDescriptor_description", "_UI_P2_16xlarge_gpuP2P_feature", "_UI_P2_16xlarge_type"), Ec2Package.eINSTANCE.getP2_16xlarge_GpuP2P(), true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); }
void function(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString(STR), getString(STR, STR, STR), Ec2Package.eINSTANCE.getP2_16xlarge_GpuP2P(), true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); }
/** * This adds a property descriptor for the Gpu P2P feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
This adds a property descriptor for the Gpu P2P feature.
addGpuP2PPropertyDescriptor
{ "repo_name": "occiware/Multi-Cloud-Studio", "path": "plugins/org.eclipse.cmf.occi.multicloud.aws.ec2.edit/src-gen/org/eclipse/cmf/occi/multicloud/aws/ec2/provider/P2_16xlargeItemProvider.java", "license": "epl-1.0", "size": 8419 }
[ "org.eclipse.cmf.occi.multicloud.aws.ec2.Ec2Package", "org.eclipse.emf.edit.provider.ComposeableAdapterFactory", "org.eclipse.emf.edit.provider.ItemPropertyDescriptor" ]
import org.eclipse.cmf.occi.multicloud.aws.ec2.Ec2Package; import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
import org.eclipse.cmf.occi.multicloud.aws.ec2.*; import org.eclipse.emf.edit.provider.*;
[ "org.eclipse.cmf", "org.eclipse.emf" ]
org.eclipse.cmf; org.eclipse.emf;
147,923
@ServiceMethod(returns = ReturnType.SINGLE) public Mono<Response<Flux<ByteBuffer>>> createUpdateTableWithResponseAsync( String resourceGroupName, String accountName, String tableName, TableCreateUpdateParameters createUpdateTableParameters) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } if (accountName == null) { return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); } if (tableName == null) { return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); } if (createUpdateTableParameters == null) { return Mono .error( new IllegalArgumentException( "Parameter createUpdateTableParameters is required and cannot be null.")); } else { createUpdateTableParameters.validate(); } final String accept = "application/json"; return FluxUtil .withContext( context -> service .createUpdateTable( this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, accountName, tableName, this.client.getApiVersion(), createUpdateTableParameters, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); }
@ServiceMethod(returns = ReturnType.SINGLE) Mono<Response<Flux<ByteBuffer>>> function( String resourceGroupName, String accountName, String tableName, TableCreateUpdateParameters createUpdateTableParameters) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( STR)); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( STR)); } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException(STR)); } if (accountName == null) { return Mono.error(new IllegalArgumentException(STR)); } if (tableName == null) { return Mono.error(new IllegalArgumentException(STR)); } if (createUpdateTableParameters == null) { return Mono .error( new IllegalArgumentException( STR)); } else { createUpdateTableParameters.validate(); } final String accept = STR; return FluxUtil .withContext( context -> service .createUpdateTable( this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, accountName, tableName, this.client.getApiVersion(), createUpdateTableParameters, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); }
/** * Create or update an Azure Cosmos DB Table. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param tableName Cosmos DB table name. * @param createUpdateTableParameters The parameters to provide for the current Table. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return an Azure Cosmos DB Table. */
Create or update an Azure Cosmos DB Table
createUpdateTableWithResponseAsync
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/resourcemanager/azure-resourcemanager-cosmos/src/main/java/com/azure/resourcemanager/cosmos/implementation/TableResourcesClientImpl.java", "license": "mit", "size": 109634 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.http.rest.Response", "com.azure.core.util.FluxUtil", "com.azure.resourcemanager.cosmos.models.TableCreateUpdateParameters", "java.nio.ByteBuffer" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.Response; import com.azure.core.util.FluxUtil; import com.azure.resourcemanager.cosmos.models.TableCreateUpdateParameters; import java.nio.ByteBuffer;
import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.util.*; import com.azure.resourcemanager.cosmos.models.*; import java.nio.*;
[ "com.azure.core", "com.azure.resourcemanager", "java.nio" ]
com.azure.core; com.azure.resourcemanager; java.nio;
59,506
public static AccountTypeManager getInstance(Context context) { context = context.getApplicationContext(); AccountTypeManager service = (AccountTypeManager) context.getSystemService(ACCOUNT_TYPE_SERVICE); if (service == null) { service = createAccountTypeManager(context); Log.e(TAG, "No account type service in context: " + context); } return service; }
static AccountTypeManager function(Context context) { context = context.getApplicationContext(); AccountTypeManager service = (AccountTypeManager) context.getSystemService(ACCOUNT_TYPE_SERVICE); if (service == null) { service = createAccountTypeManager(context); Log.e(TAG, STR + context); } return service; }
/** * Requests the singleton instance of {@link AccountTypeManager} with data bound from * the available authenticators. This method can safely be called from the UI thread. */
Requests the singleton instance of <code>AccountTypeManager</code> with data bound from the available authenticators. This method can safely be called from the UI thread
getInstance
{ "repo_name": "rex-xxx/mt6572_x201", "path": "packages/apps/Contacts/src/com/android/contacts/model/AccountTypeManager.java", "license": "gpl-2.0", "size": 43550 }
[ "android.content.Context", "android.util.Log" ]
import android.content.Context; import android.util.Log;
import android.content.*; import android.util.*;
[ "android.content", "android.util" ]
android.content; android.util;
418,699
public void setScreenmenu(boolean b) { mScreenMenuBar = new Boolean(b); }
void function(boolean b) { mScreenMenuBar = new Boolean(b); }
/** * Setter for the "screenmenu" attribute (optional) */
Setter for the "screenmenu" attribute (optional)
setScreenmenu
{ "repo_name": "tofi86/Jarbundler", "path": "src/net/sourceforge/jarbundler/JarBundler.java", "license": "apache-2.0", "size": 44706 }
[ "java.lang.Boolean" ]
import java.lang.Boolean;
import java.lang.*;
[ "java.lang" ]
java.lang;
2,081,613
public AnvilMat getType(final AnvilBlockDamage damage, final RotateAxisMat axis, final boolean rotated) { return getByID(combine(damage, axis, rotated)); }
AnvilMat function(final AnvilBlockDamage damage, final RotateAxisMat axis, final boolean rotated) { return getByID(combine(damage, axis, rotated)); }
/** * Returns one of Anvil sub-type based on {@link AnvilMat.AnvilBlockDamage} stage, {@link RotateAxisMat} and rotated state. * * @param damage damage stage of Anvil. * @param axis axis of placment. * @param rotated if anvil should be rotated, so NORTH_SOUTH {@literal ->} SOUTH_NORTH * * @return sub-type of Anvil */
Returns one of Anvil sub-type based on <code>AnvilMat.AnvilBlockDamage</code> stage, <code>RotateAxisMat</code> and rotated state
getType
{ "repo_name": "sgdc3/Diorite", "path": "DioriteAPI/src/main/java/org/diorite/material/blocks/tools/AnvilMat.java", "license": "mit", "size": 11526 }
[ "org.diorite.material.blocks.RotateAxisMat" ]
import org.diorite.material.blocks.RotateAxisMat;
import org.diorite.material.blocks.*;
[ "org.diorite.material" ]
org.diorite.material;
588,692
@Nullable public String getRecipeImageUrl() { String res = getStringOrNull(RecipeColumns.IMAGE_URL); return res; }
String function() { String res = getStringOrNull(RecipeColumns.IMAGE_URL); return res; }
/** * Image Url of the recipe. * Can be {@code null}. */
Image Url of the recipe. Can be null
getRecipeImageUrl
{ "repo_name": "chris115379/Recipr", "path": "data/src/main/java/de/androidbytes/recipr/data/provider/step/StepCursor.java", "license": "apache-2.0", "size": 4229 }
[ "de.androidbytes.recipr.data.provider.recipe.RecipeColumns" ]
import de.androidbytes.recipr.data.provider.recipe.RecipeColumns;
import de.androidbytes.recipr.data.provider.recipe.*;
[ "de.androidbytes.recipr" ]
de.androidbytes.recipr;
466,042
public static List<TransactionSynchronization> getSynchronizations() throws IllegalStateException { Set<TransactionSynchronization> synchs = synchronizations.get(); if (synchs == null) { throw new IllegalStateException("Transaction synchronization is not active"); } // Return unmodifiable snapshot, to avoid ConcurrentModificationExceptions // while iterating and invoking synchronization callbacks that in turn // might register further synchronizations. if (synchs.isEmpty()) { return Collections.emptyList(); } else { // Sort lazily here, not in registerSynchronization. List<TransactionSynchronization> sortedSynchs = new ArrayList<TransactionSynchronization>(synchs); OrderComparator.sort(sortedSynchs); return Collections.unmodifiableList(sortedSynchs); } }
static List<TransactionSynchronization> function() throws IllegalStateException { Set<TransactionSynchronization> synchs = synchronizations.get(); if (synchs == null) { throw new IllegalStateException(STR); } if (synchs.isEmpty()) { return Collections.emptyList(); } else { List<TransactionSynchronization> sortedSynchs = new ArrayList<TransactionSynchronization>(synchs); OrderComparator.sort(sortedSynchs); return Collections.unmodifiableList(sortedSynchs); } }
/** * Return an unmodifiable snapshot list of all registered synchronizations * for the current thread. * @return unmodifiable List of TransactionSynchronization instances * @throws IllegalStateException if synchronization is not active * @see TransactionSynchronization */
Return an unmodifiable snapshot list of all registered synchronizations for the current thread
getSynchronizations
{ "repo_name": "leogoing/spring_jeesite", "path": "spring-tx-4.0/org/springframework/transaction/support/TransactionSynchronizationManager.java", "license": "apache-2.0", "size": 20210 }
[ "java.util.ArrayList", "java.util.Collections", "java.util.List", "java.util.Set", "org.springframework.core.OrderComparator" ]
import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Set; import org.springframework.core.OrderComparator;
import java.util.*; import org.springframework.core.*;
[ "java.util", "org.springframework.core" ]
java.util; org.springframework.core;
2,128,354
public void awwSnapCron(Wavelet wavelet, String message) { wavelet.appendBlip().getDocument().append("Awww Snap! Something went wrong. Try reloading the robot\n\n" + message); }
void function(Wavelet wavelet, String message) { wavelet.appendBlip().getDocument().append(STR + message); }
/** * Provides a niceish way to output unknown errors to the user from a cron event * @param rootBlip the root blip of the wave * @param message additional information about the error * @param cSession the currently running session */
Provides a niceish way to output unknown errors to the user from a cron event
awwSnapCron
{ "repo_name": "up1/Google-wave-Wave-Live-Messenger", "path": "Robot/WaveLiveMessenger/src/wavelivemessenger/BlipRender.java", "license": "mit", "size": 8530 }
[ "com.google.wave.api.Wavelet" ]
import com.google.wave.api.Wavelet;
import com.google.wave.api.*;
[ "com.google.wave" ]
com.google.wave;
2,324,912
protected void initHostCollectors() { for (int i = 0; i < configuration.getNumberOfGcThreads(); i++) { ReferenceQueue<BaseDataBuffer> queue = new ReferenceQueue<>(); UnifiedGarbageCollectorThread uThread = new UnifiedGarbageCollectorThread(i, queue); // all GC threads should be attached to default device Nd4j.getAffinityManager().attachThreadToDevice(uThread, getDeviceId()); queueMap.put(i, queue); uThread.start(); collectorsUnified.put(i, uThread); } }
void function() { for (int i = 0; i < configuration.getNumberOfGcThreads(); i++) { ReferenceQueue<BaseDataBuffer> queue = new ReferenceQueue<>(); UnifiedGarbageCollectorThread uThread = new UnifiedGarbageCollectorThread(i, queue); Nd4j.getAffinityManager().attachThreadToDevice(uThread, getDeviceId()); queueMap.put(i, queue); uThread.start(); collectorsUnified.put(i, uThread); } }
/** * This method executes preconfigured number of host memory garbage collectors */
This method executes preconfigured number of host memory garbage collectors
initHostCollectors
{ "repo_name": "smarthi/nd4j", "path": "nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/jita/allocator/impl/AtomicAllocator.java", "license": "apache-2.0", "size": 40949 }
[ "java.lang.ref.ReferenceQueue", "org.nd4j.linalg.api.buffer.BaseDataBuffer", "org.nd4j.linalg.factory.Nd4j" ]
import java.lang.ref.ReferenceQueue; import org.nd4j.linalg.api.buffer.BaseDataBuffer; import org.nd4j.linalg.factory.Nd4j;
import java.lang.ref.*; import org.nd4j.linalg.api.buffer.*; import org.nd4j.linalg.factory.*;
[ "java.lang", "org.nd4j.linalg" ]
java.lang; org.nd4j.linalg;
552,838
public Builder uniquify() { final List<String> uniqueNames = SqlValidatorUtil.uniquify(names, typeFactory.getTypeSystem().isSchemaCaseSensitive()); if (uniqueNames != names) { names.clear(); names.addAll(uniqueNames); } return this; }
Builder function() { final List<String> uniqueNames = SqlValidatorUtil.uniquify(names, typeFactory.getTypeSystem().isSchemaCaseSensitive()); if (uniqueNames != names) { names.clear(); names.addAll(uniqueNames); } return this; }
/** * Makes sure that field names are unique. */
Makes sure that field names are unique
uniquify
{ "repo_name": "datametica/calcite", "path": "core/src/main/java/org/apache/calcite/rel/type/RelDataTypeFactory.java", "license": "apache-2.0", "size": 19841 }
[ "java.util.List", "org.apache.calcite.sql.validate.SqlValidatorUtil" ]
import java.util.List; import org.apache.calcite.sql.validate.SqlValidatorUtil;
import java.util.*; import org.apache.calcite.sql.validate.*;
[ "java.util", "org.apache.calcite" ]
java.util; org.apache.calcite;
1,623,158
public Builder urls(List<SourceOptionsWebCrawl> urls) { this.urls = urls; return this; }
Builder function(List<SourceOptionsWebCrawl> urls) { this.urls = urls; return this; }
/** * Set the urls. Existing urls will be replaced. * * @param urls the urls * @return the SourceOptions builder */
Set the urls. Existing urls will be replaced
urls
{ "repo_name": "watson-developer-cloud/java-sdk", "path": "discovery/src/main/java/com/ibm/watson/discovery/v1/model/SourceOptions.java", "license": "apache-2.0", "size": 8656 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,760,120
public JasperPrintLP printLieferscheinetikett(Integer iIdLieferscheinI, Integer iPaketnummer) throws ExceptionLP { JasperPrintLP print = null; try { print = lieferscheinReportFac.printLieferscheinEtikett( iIdLieferscheinI, iPaketnummer, LPMain.getTheClient()); } catch (Throwable t) { handleThrowable(t); } return print; }
JasperPrintLP function(Integer iIdLieferscheinI, Integer iPaketnummer) throws ExceptionLP { JasperPrintLP print = null; try { print = lieferscheinReportFac.printLieferscheinEtikett( iIdLieferscheinI, iPaketnummer, LPMain.getTheClient()); } catch (Throwable t) { handleThrowable(t); } return print; }
/** * Lieferscheinetikett drucken. * * @param iIdLieferscheinI * pk des Lieferscheins * @param iPaketnummer * Integer * @throws ExceptionLP * @return JasperPrint der Druck */
Lieferscheinetikett drucken
printLieferscheinetikett
{ "repo_name": "erdincay/lpclientpc", "path": "src/com/lp/client/frame/delegate/LieferscheinReportDelegate.java", "license": "agpl-3.0", "size": 7231 }
[ "com.lp.client.frame.ExceptionLP", "com.lp.client.pc.LPMain", "com.lp.server.util.report.JasperPrintLP" ]
import com.lp.client.frame.ExceptionLP; import com.lp.client.pc.LPMain; import com.lp.server.util.report.JasperPrintLP;
import com.lp.client.frame.*; import com.lp.client.pc.*; import com.lp.server.util.report.*;
[ "com.lp.client", "com.lp.server" ]
com.lp.client; com.lp.server;
1,957
public void actionCriterionPull(ModelCriterion criterion) { // Collect all other criteria List<ModelExplicitCriterion> others = new ArrayList<ModelExplicitCriterion>(); if (criterion instanceof ModelLDiversityCriterion) { for (ModelLDiversityCriterion other : model.getLDiversityModel().values()) { if (!other.equals(criterion) && other.isEnabled()) { others.add((ModelExplicitCriterion) other); } } } else if (criterion instanceof ModelTClosenessCriterion) { for (ModelTClosenessCriterion other : model.getTClosenessModel().values()) { if (!other.equals(criterion) && other.isEnabled()) { others.add((ModelExplicitCriterion) other); } } } else if (criterion instanceof ModelDDisclosurePrivacyCriterion) { for (ModelDDisclosurePrivacyCriterion other : model.getDDisclosurePrivacyModel().values()) { if (!other.equals(criterion) && other.isEnabled()) { others.add((ModelExplicitCriterion) other); } } } else { throw new RuntimeException(Resources.getMessage("Controller.1")); //$NON-NLS-1$ } // Break if none found if (others.isEmpty()) { main.showInfoDialog(main.getShell(), Resources.getMessage("Controller.95"), //$NON-NLS-1$ Resources.getMessage("Controller.96")); //$NON-NLS-1$ return; } // Select criterion ModelExplicitCriterion element = main.showSelectCriterionDialog(others); if (element == null) { return; } else { ((ModelExplicitCriterion) criterion).pull(element); update(new ModelEvent(this, ModelPart.CRITERION_DEFINITION, criterion)); } }
void function(ModelCriterion criterion) { List<ModelExplicitCriterion> others = new ArrayList<ModelExplicitCriterion>(); if (criterion instanceof ModelLDiversityCriterion) { for (ModelLDiversityCriterion other : model.getLDiversityModel().values()) { if (!other.equals(criterion) && other.isEnabled()) { others.add((ModelExplicitCriterion) other); } } } else if (criterion instanceof ModelTClosenessCriterion) { for (ModelTClosenessCriterion other : model.getTClosenessModel().values()) { if (!other.equals(criterion) && other.isEnabled()) { others.add((ModelExplicitCriterion) other); } } } else if (criterion instanceof ModelDDisclosurePrivacyCriterion) { for (ModelDDisclosurePrivacyCriterion other : model.getDDisclosurePrivacyModel().values()) { if (!other.equals(criterion) && other.isEnabled()) { others.add((ModelExplicitCriterion) other); } } } else { throw new RuntimeException(Resources.getMessage(STR)); } if (others.isEmpty()) { main.showInfoDialog(main.getShell(), Resources.getMessage(STR), Resources.getMessage(STR)); return; } ModelExplicitCriterion element = main.showSelectCriterionDialog(others); if (element == null) { return; } else { ((ModelExplicitCriterion) criterion).pull(element); update(new ModelEvent(this, ModelPart.CRITERION_DEFINITION, criterion)); } }
/** * Pull settings into the criterion. * * @param criterion */
Pull settings into the criterion
actionCriterionPull
{ "repo_name": "fstahnke/arx", "path": "src/gui/org/deidentifier/arx/gui/Controller.java", "license": "apache-2.0", "size": 81865 }
[ "java.util.ArrayList", "java.util.List", "org.deidentifier.arx.gui.model.ModelCriterion", "org.deidentifier.arx.gui.model.ModelDDisclosurePrivacyCriterion", "org.deidentifier.arx.gui.model.ModelEvent", "org.deidentifier.arx.gui.model.ModelExplicitCriterion", "org.deidentifier.arx.gui.model.ModelLDiversityCriterion", "org.deidentifier.arx.gui.model.ModelTClosenessCriterion", "org.deidentifier.arx.gui.resources.Resources" ]
import java.util.ArrayList; import java.util.List; import org.deidentifier.arx.gui.model.ModelCriterion; import org.deidentifier.arx.gui.model.ModelDDisclosurePrivacyCriterion; import org.deidentifier.arx.gui.model.ModelEvent; import org.deidentifier.arx.gui.model.ModelExplicitCriterion; import org.deidentifier.arx.gui.model.ModelLDiversityCriterion; import org.deidentifier.arx.gui.model.ModelTClosenessCriterion; import org.deidentifier.arx.gui.resources.Resources;
import java.util.*; import org.deidentifier.arx.gui.model.*; import org.deidentifier.arx.gui.resources.*;
[ "java.util", "org.deidentifier.arx" ]
java.util; org.deidentifier.arx;
922,179
public static Coin reduceTo4Decimals(Coin coin, CoinFormatter coinFormatter) { return ParsingUtils.parseToCoin(coinFormatter.formatCoin(coin), coinFormatter); }
static Coin function(Coin coin, CoinFormatter coinFormatter) { return ParsingUtils.parseToCoin(coinFormatter.formatCoin(coin), coinFormatter); }
/** * Transform a coin with the properties defined in the format (used to reduce decimal places) * * @param coin the coin which should be transformed * @param coinFormatter the coin formatter instance * @return the transformed coin */
Transform a coin with the properties defined in the format (used to reduce decimal places)
reduceTo4Decimals
{ "repo_name": "bitsquare/bitsquare", "path": "desktop/src/main/java/bisq/desktop/util/DisplayUtils.java", "license": "agpl-3.0", "size": 14152 }
[ "org.bitcoinj.core.Coin" ]
import org.bitcoinj.core.Coin;
import org.bitcoinj.core.*;
[ "org.bitcoinj.core" ]
org.bitcoinj.core;
2,743,836
@Nullable public EducationClass get() throws ClientException { return send(HttpMethod.GET, null); }
EducationClass function() throws ClientException { return send(HttpMethod.GET, null); }
/** * Gets the EducationClass from the service * * @return the EducationClass from the request * @throws ClientException this exception occurs if the request was unable to complete for any reason */
Gets the EducationClass from the service
get
{ "repo_name": "microsoftgraph/msgraph-sdk-java", "path": "src/main/java/com/microsoft/graph/requests/EducationClassRequest.java", "license": "mit", "size": 6748 }
[ "com.microsoft.graph.core.ClientException", "com.microsoft.graph.http.HttpMethod", "com.microsoft.graph.models.EducationClass" ]
import com.microsoft.graph.core.ClientException; import com.microsoft.graph.http.HttpMethod; import com.microsoft.graph.models.EducationClass;
import com.microsoft.graph.core.*; import com.microsoft.graph.http.*; import com.microsoft.graph.models.*;
[ "com.microsoft.graph" ]
com.microsoft.graph;
196,977
public GlyphVector createGlyphVector(FontRenderContext ctx, int[] glyphCodes) { return peer.createGlyphVector(this, ctx, glyphCodes); }
GlyphVector function(FontRenderContext ctx, int[] glyphCodes) { return peer.createGlyphVector(this, ctx, glyphCodes); }
/** * Extracts a sequence of glyphs from a font, returning a new {@link * GlyphVector} with a mapped glyph for each input glyph code. * * @param ctx The rendering context used for precise glyph placement. * @param glyphCodes Array of characters to convert to glyphs. * * @return A new {@link GlyphVector} containing glyphs mapped from str, * through the font's cmap table. * * @see #layoutGlyphVector(FontRenderContext, char[], int, int, int) * * @specnote This method is documented to perform character-to-glyph * conversions, in the Sun documentation, but its second parameter name is * "glyphCodes" and it is not clear to me why it would exist if its * purpose was to transport character codes inside integers. I assume it * is mis-documented in the Sun documentation. */
Extracts a sequence of glyphs from a font, returning a new <code>GlyphVector</code> with a mapped glyph for each input glyph code
createGlyphVector
{ "repo_name": "taciano-perez/JamVM-PH", "path": "src/classpath/java/awt/Font.java", "license": "gpl-2.0", "size": 44671 }
[ "java.awt.font.FontRenderContext", "java.awt.font.GlyphVector" ]
import java.awt.font.FontRenderContext; import java.awt.font.GlyphVector;
import java.awt.font.*;
[ "java.awt" ]
java.awt;
504,220
public static void clearInstance() { synchronized (INSTANCE_MONITOR) { instance = null; } } private class LeakSafeThread extends Thread { private Callable<?> callable; private Object result; LeakSafeThread() { setDaemon(false); }
static void function() { synchronized (INSTANCE_MONITOR) { instance = null; } } private class LeakSafeThread extends Thread { private Callable<?> callable; private Object result; LeakSafeThread() { setDaemon(false); }
/** * Clear the instance. Primarily provided for tests and not usually used in * application code. */
Clear the instance. Primarily provided for tests and not usually used in application code
clearInstance
{ "repo_name": "spring-projects/spring-boot", "path": "spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/Restarter.java", "license": "apache-2.0", "size": 19926 }
[ "java.util.concurrent.Callable" ]
import java.util.concurrent.Callable;
import java.util.concurrent.*;
[ "java.util" ]
java.util;
2,497,619
public Timestamp getUpdated(); public static final String COLUMNNAME_UpdatedBy = "UpdatedBy";
Timestamp function(); public static final String COLUMNNAME_UpdatedBy = STR;
/** Get Aktualisiert. * Datum, an dem dieser Eintrag aktualisiert wurde */
Get Aktualisiert. Datum, an dem dieser Eintrag aktualisiert wurde
getUpdated
{ "repo_name": "klst-com/metasfresh", "path": "de.metas.commission/de.metas.commission.base/src/main/java-gen/de/metas/commission/model/I_C_AdvComRelevantPO_Type.java", "license": "gpl-2.0", "size": 6356 }
[ "java.sql.Timestamp" ]
import java.sql.Timestamp;
import java.sql.*;
[ "java.sql" ]
java.sql;
1,757,166
@RequestMapping( method = RequestMethod.POST ) @ResponseBody public Style createAction( @RequestBody @Valid Style style, HttpServletResponse response ) { try { //- Set HTTP status -// response.setStatus( HttpStatus.CREATED.value() ); //- Success. Return created style -// return this.styleService.create( style ); } catch ( DataIntegrityViolationException e ) { //- Failure. Can not to create video type -// response.setStatus( HttpStatus.CONFLICT.value() ); } return null; }
@RequestMapping( method = RequestMethod.POST ) Style function( Style style, HttpServletResponse response ) { try { response.setStatus( HttpStatus.CREATED.value() ); return this.styleService.create( style ); } catch ( DataIntegrityViolationException e ) { response.setStatus( HttpStatus.CONFLICT.value() ); } return null; }
/** * Create a new style. * * @param style Form with input. * @param response Use for work with HTTP. * * @return Created style. */
Create a new style
createAction
{ "repo_name": "coffeine-009/Virtuoso", "path": "src/main/java/com/thecoffeine/virtuoso/music/controller/StyleController.java", "license": "mit", "size": 5730 }
[ "com.thecoffeine.virtuoso.music.model.entity.Style", "javax.servlet.http.HttpServletResponse", "org.springframework.dao.DataIntegrityViolationException", "org.springframework.http.HttpStatus", "org.springframework.web.bind.annotation.RequestMapping", "org.springframework.web.bind.annotation.RequestMethod" ]
import com.thecoffeine.virtuoso.music.model.entity.Style; import javax.servlet.http.HttpServletResponse; import org.springframework.dao.DataIntegrityViolationException; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod;
import com.thecoffeine.virtuoso.music.model.entity.*; import javax.servlet.http.*; import org.springframework.dao.*; import org.springframework.http.*; import org.springframework.web.bind.annotation.*;
[ "com.thecoffeine.virtuoso", "javax.servlet", "org.springframework.dao", "org.springframework.http", "org.springframework.web" ]
com.thecoffeine.virtuoso; javax.servlet; org.springframework.dao; org.springframework.http; org.springframework.web;
240,654
public void removeAllTablesExcept(Table[] tables) { ArrayList allTables = new ArrayList(_tables); allTables.removeAll(Arrays.asList(tables)); _tables.removeAll(allTables); } // Helper methods
void function(Table[] tables) { ArrayList allTables = new ArrayList(_tables); allTables.removeAll(Arrays.asList(tables)); _tables.removeAll(allTables); }
/** * Removes all but the given tables. This method does not check whether there are foreign keys to the * removed tables. * * @param tables The tables to keep */
Removes all but the given tables. This method does not check whether there are foreign keys to the removed tables
removeAllTablesExcept
{ "repo_name": "9ci/ddlutils", "path": "src/main/java/org/apache/ddlutils/model/Database.java", "license": "apache-2.0", "size": 22733 }
[ "java.util.ArrayList", "java.util.Arrays" ]
import java.util.ArrayList; import java.util.Arrays;
import java.util.*;
[ "java.util" ]
java.util;
415,388
public static FixedFileTrailer readFromStream(FSDataInputStream istream, long fileSize) throws IOException { int bufferSize = MAX_TRAILER_SIZE; long seekPoint = fileSize - bufferSize; if (seekPoint < 0) { // It is hard to imagine such a small HFile. seekPoint = 0; bufferSize = (int) fileSize; } // zhangqianxi writes it // istream.seek(seekPoint); ByteBuffer buf = ByteBuffer.allocate(bufferSize); // istream.readFully(buf.array(), buf.arrayOffset(), // buf.arrayOffset() + buf.limit()); istream.read(seekPoint, buf.array(), buf.arrayOffset(), buf.arrayOffset() + buf.limit()); // Read the version from the last int of the file. buf.position(buf.limit() - Bytes.SIZEOF_INT); int version = buf.getInt(); // Extract the major and minor versions. int majorVersion = extractMajorVersion(version); int minorVersion = extractMinorVersion(version); HFile.checkFormatVersion(majorVersion); // throws IAE if invalid int trailerSize = getTrailerSize(majorVersion); FixedFileTrailer fft = new FixedFileTrailer(majorVersion, minorVersion); fft.deserialize(new DataInputStream(new ByteArrayInputStream(buf.array(), buf.arrayOffset() + bufferSize - trailerSize, trailerSize))); return fft; }
static FixedFileTrailer function(FSDataInputStream istream, long fileSize) throws IOException { int bufferSize = MAX_TRAILER_SIZE; long seekPoint = fileSize - bufferSize; if (seekPoint < 0) { seekPoint = 0; bufferSize = (int) fileSize; } ByteBuffer buf = ByteBuffer.allocate(bufferSize); istream.read(seekPoint, buf.array(), buf.arrayOffset(), buf.arrayOffset() + buf.limit()); buf.position(buf.limit() - Bytes.SIZEOF_INT); int version = buf.getInt(); int majorVersion = extractMajorVersion(version); int minorVersion = extractMinorVersion(version); HFile.checkFormatVersion(majorVersion); int trailerSize = getTrailerSize(majorVersion); FixedFileTrailer fft = new FixedFileTrailer(majorVersion, minorVersion); fft.deserialize(new DataInputStream(new ByteArrayInputStream(buf.array(), buf.arrayOffset() + bufferSize - trailerSize, trailerSize))); return fft; }
/** * Reads a file trailer from the given file. * * @param istream the input stream with the ability to seek. Does not have to * be buffered, as only one read operation is made. * @param fileSize the file size. Can be obtained using * {@link org.apache.hadoop.fs.FileSystem#getFileStatus( * org.apache.hadoop.fs.Path)}. * @return the fixed file trailer read * @throws IOException if failed to read from the underlying stream, or the * trailer is corrupted, or the version of the trailer is * unsupported */
Reads a file trailer from the given file
readFromStream
{ "repo_name": "zqxjjj/NobidaBase", "path": "src/main/java/org/apache/hadoop/hbase/io/hfile/FixedFileTrailer.java", "license": "apache-2.0", "size": 17477 }
[ "java.io.ByteArrayInputStream", "java.io.DataInputStream", "java.io.IOException", "java.nio.ByteBuffer", "org.apache.hadoop.fs.FSDataInputStream", "org.apache.hadoop.hbase.util.Bytes" ]
import java.io.ByteArrayInputStream; import java.io.DataInputStream; import java.io.IOException; import java.nio.ByteBuffer; import org.apache.hadoop.fs.FSDataInputStream; import org.apache.hadoop.hbase.util.Bytes;
import java.io.*; import java.nio.*; import org.apache.hadoop.fs.*; import org.apache.hadoop.hbase.util.*;
[ "java.io", "java.nio", "org.apache.hadoop" ]
java.io; java.nio; org.apache.hadoop;
1,657,286
public void configure( final Configuration config ) { if ( getConfig() != null ) { // already configured ... return; } super.configure( config ); final Iterator it = factories.iterator(); while ( it.hasNext() ) { final TemplateCollection od = (TemplateCollection) it.next(); od.configure( config ); } }
void function( final Configuration config ) { if ( getConfig() != null ) { return; } super.configure( config ); final Iterator it = factories.iterator(); while ( it.hasNext() ) { final TemplateCollection od = (TemplateCollection) it.next(); od.configure( config ); } }
/** * Configures this factory. The configuration contains several keys and their defined values. The given reference to * the configuration object will remain valid until the report parsing or writing ends. * <p/> * The configuration contents may change during the reporting. * * @param config * the configuration, never null */
Configures this factory. The configuration contains several keys and their defined values. The given reference to the configuration object will remain valid until the report parsing or writing ends. The configuration contents may change during the reporting
configure
{ "repo_name": "mbatchelor/pentaho-reporting", "path": "engine/core/src/main/java/org/pentaho/reporting/engine/classic/core/modules/parser/ext/factory/templates/TemplateCollector.java", "license": "lgpl-2.1", "size": 4643 }
[ "java.util.Iterator", "org.pentaho.reporting.libraries.base.config.Configuration" ]
import java.util.Iterator; import org.pentaho.reporting.libraries.base.config.Configuration;
import java.util.*; import org.pentaho.reporting.libraries.base.config.*;
[ "java.util", "org.pentaho.reporting" ]
java.util; org.pentaho.reporting;
2,010,158
public ArrayList getChunks() { return null; }
ArrayList function() { return null; }
/** * Returns null - not used * * @return null */
Returns null - not used
getChunks
{ "repo_name": "yogthos/itext", "path": "src/com/lowagie/text/pdf/MultiColumnText.java", "license": "lgpl-3.0", "size": 20515 }
[ "java.util.ArrayList" ]
import java.util.ArrayList;
import java.util.*;
[ "java.util" ]
java.util;
2,483,823
boolean isOptional(Type type) { // Note we don't use typeFact().isOptionalType(type) because // that implements a stricter test used in the type checker. return typeFact().getNullValueDeclaration().getType().isSubtypeOf(type); }
boolean isOptional(Type type) { return typeFact().getNullValueDeclaration().getType().isSubtypeOf(type); }
/** * Determines whether the given type is optional. */
Determines whether the given type is optional
isOptional
{ "repo_name": "gijsleussink/ceylon", "path": "compiler-java/src/com/redhat/ceylon/compiler/java/codegen/AbstractTransformer.java", "license": "apache-2.0", "size": 262988 }
[ "com.redhat.ceylon.model.typechecker.model.Type" ]
import com.redhat.ceylon.model.typechecker.model.Type;
import com.redhat.ceylon.model.typechecker.model.*;
[ "com.redhat.ceylon" ]
com.redhat.ceylon;
2,419,604
static HBaseResource get() { return FactoryUtils.loadAndInvokeFactory( HBaseResourceFactory.class, HBaseResourceFactory::create, LocalStandaloneHBaseResourceFactory::new); }
static HBaseResource get() { return FactoryUtils.loadAndInvokeFactory( HBaseResourceFactory.class, HBaseResourceFactory::create, LocalStandaloneHBaseResourceFactory::new); }
/** * Returns the configured HBaseResource implementation, or a {@link LocalStandaloneHBaseResource} if none is configured. * * @return configured HbaseResource, or {@link LocalStandaloneHBaseResource} if none is configured */
Returns the configured HBaseResource implementation, or a <code>LocalStandaloneHBaseResource</code> if none is configured
get
{ "repo_name": "tzulitai/flink", "path": "flink-end-to-end-tests/flink-end-to-end-tests-hbase/src/main/java/org/apache/flink/tests/util/hbase/HBaseResource.java", "license": "apache-2.0", "size": 2478 }
[ "org.apache.flink.tests.util.util.FactoryUtils" ]
import org.apache.flink.tests.util.util.FactoryUtils;
import org.apache.flink.tests.util.util.*;
[ "org.apache.flink" ]
org.apache.flink;
699,568
public ColumnData sub(ColumnData colData, String colName) { DataTypes thisType = dataColumn.getDataType(); if (!thisType.isNumeric()) { return null; } DataTypes inType = colData.getDataType(); if (!inType.isNumeric()) { return null; } ColumnData rColData = null; int i; switch (thisType) { case Integer: switch (inType) { case Integer: rColData = new ColumnData(colName, DataTypes.Integer); for (i = 0; i < data.size(); i++) { if (i < colData.size()) { rColData.addData((Integer) this.getValue(i) - (Integer) colData.getValue(i)); } } break; case Float: rColData = new ColumnData(colName, DataTypes.Float); for (i = 0; i < data.size(); i++) { if (i < colData.size()) { rColData.addData((Integer) this.getValue(i) - (Float) colData.getValue(i)); } } break; case Double: rColData = new ColumnData(colName, DataTypes.Double); for (i = 0; i < data.size(); i++) { if (i < colData.size()) { rColData.addData((Integer) this.getValue(i) - (Double) colData.getValue(i)); } } break; } break; case Float: switch (inType) { case Integer: rColData = new ColumnData(colName, DataTypes.Float); for (i = 0; i < data.size(); i++) { if (i < colData.size()) { rColData.addData((Float) this.getValue(i) - (Integer) colData.getValue(i)); } } break; case Float: rColData = new ColumnData(colName, DataTypes.Float); for (i = 0; i < data.size(); i++) { if (i < colData.size()) { rColData.addData((Float) this.getValue(i) - (Float) colData.getValue(i)); } } break; case Double: rColData = new ColumnData(colName, DataTypes.Double); for (i = 0; i < data.size(); i++) { if (i < colData.size()) { rColData.addData((Float) this.getValue(i) - (Double) colData.getValue(i)); } } break; } break; case Double: switch (inType) { case Integer: rColData = new ColumnData(colName, DataTypes.Double); for (i = 0; i < data.size(); i++) { if (i < colData.size()) { rColData.addData((Double) this.getValue(i) - (Integer) colData.getValue(i)); } } break; case Float: rColData = new ColumnData(colName, DataTypes.Double); for (i = 0; i < data.size(); i++) { if (i < colData.size()) { rColData.addData((Double) this.getValue(i) - (Float) colData.getValue(i)); } } break; case Double: rColData = new ColumnData(colName, DataTypes.Double); for (i = 0; i < data.size(); i++) { if (i < colData.size()) { rColData.addData((Double) this.getValue(i) - (Double) colData.getValue(i)); } } break; } break; } return rColData; }
ColumnData function(ColumnData colData, String colName) { DataTypes thisType = dataColumn.getDataType(); if (!thisType.isNumeric()) { return null; } DataTypes inType = colData.getDataType(); if (!inType.isNumeric()) { return null; } ColumnData rColData = null; int i; switch (thisType) { case Integer: switch (inType) { case Integer: rColData = new ColumnData(colName, DataTypes.Integer); for (i = 0; i < data.size(); i++) { if (i < colData.size()) { rColData.addData((Integer) this.getValue(i) - (Integer) colData.getValue(i)); } } break; case Float: rColData = new ColumnData(colName, DataTypes.Float); for (i = 0; i < data.size(); i++) { if (i < colData.size()) { rColData.addData((Integer) this.getValue(i) - (Float) colData.getValue(i)); } } break; case Double: rColData = new ColumnData(colName, DataTypes.Double); for (i = 0; i < data.size(); i++) { if (i < colData.size()) { rColData.addData((Integer) this.getValue(i) - (Double) colData.getValue(i)); } } break; } break; case Float: switch (inType) { case Integer: rColData = new ColumnData(colName, DataTypes.Float); for (i = 0; i < data.size(); i++) { if (i < colData.size()) { rColData.addData((Float) this.getValue(i) - (Integer) colData.getValue(i)); } } break; case Float: rColData = new ColumnData(colName, DataTypes.Float); for (i = 0; i < data.size(); i++) { if (i < colData.size()) { rColData.addData((Float) this.getValue(i) - (Float) colData.getValue(i)); } } break; case Double: rColData = new ColumnData(colName, DataTypes.Double); for (i = 0; i < data.size(); i++) { if (i < colData.size()) { rColData.addData((Float) this.getValue(i) - (Double) colData.getValue(i)); } } break; } break; case Double: switch (inType) { case Integer: rColData = new ColumnData(colName, DataTypes.Double); for (i = 0; i < data.size(); i++) { if (i < colData.size()) { rColData.addData((Double) this.getValue(i) - (Integer) colData.getValue(i)); } } break; case Float: rColData = new ColumnData(colName, DataTypes.Double); for (i = 0; i < data.size(); i++) { if (i < colData.size()) { rColData.addData((Double) this.getValue(i) - (Float) colData.getValue(i)); } } break; case Double: rColData = new ColumnData(colName, DataTypes.Double); for (i = 0; i < data.size(); i++) { if (i < colData.size()) { rColData.addData((Double) this.getValue(i) - (Double) colData.getValue(i)); } } break; } break; } return rColData; }
/** * Subtract function * * @param colData Anorther column data * @param colName New column data name * @return Result column data */
Subtract function
sub
{ "repo_name": "meteoinfo/meteoinfolib", "path": "src/org/meteoinfo/table/ColumnData.java", "license": "lgpl-3.0", "size": 44765 }
[ "org.meteoinfo.data.DataTypes" ]
import org.meteoinfo.data.DataTypes;
import org.meteoinfo.data.*;
[ "org.meteoinfo.data" ]
org.meteoinfo.data;
659,115
protected Connection doGetNativeConnection(Connection con) throws SQLException { return con; }
Connection function(Connection con) throws SQLException { return con; }
/** * Not able to unwrap: return passed-in Connection. */
Not able to unwrap: return passed-in Connection
doGetNativeConnection
{ "repo_name": "raedle/univis", "path": "lib/springframework-1.2.8/src/org/springframework/jdbc/support/nativejdbc/NativeJdbcExtractorAdapter.java", "license": "lgpl-2.1", "size": 5842 }
[ "java.sql.Connection", "java.sql.SQLException" ]
import java.sql.Connection; import java.sql.SQLException;
import java.sql.*;
[ "java.sql" ]
java.sql;
2,519,100
private void maybeVisit(MappingVisitor v, Mapping m) throws IOException { int nextLine = getAdjustedLine(m.endPosition); int nextCol = getAdjustedCol(m.endPosition); // If this anything remaining in this mapping beyond the // current line and column position, write it out now. if (line < nextLine || (line == nextLine && col < nextCol)) { visit(v, m, nextLine, nextCol); } }
void function(MappingVisitor v, Mapping m) throws IOException { int nextLine = getAdjustedLine(m.endPosition); int nextCol = getAdjustedCol(m.endPosition); if (line < nextLine (line == nextLine && col < nextCol)) { visit(v, m, nextLine, nextCol); } }
/** * Write any needed entries from the current position to the end of the * provided mapping. */
Write any needed entries from the current position to the end of the provided mapping
maybeVisit
{ "repo_name": "ehsan/js-symbolic-executor", "path": "closure-compiler/src/com/google/javascript/jscomp/SourceMapLegacy.java", "license": "apache-2.0", "size": 19605 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
922,976
public TimerUpdateBuilder setTimer(TimerData setTimer) { deletedTimers.remove(setTimer); setTimers.add(setTimer); return this; }
TimerUpdateBuilder function(TimerData setTimer) { deletedTimers.remove(setTimer); setTimers.add(setTimer); return this; }
/** * Adds the provided timer to the collection of set timers, removing it from deleted timers if * it has previously been deleted. Returns this {@link TimerUpdateBuilder}. */
Adds the provided timer to the collection of set timers, removing it from deleted timers if it has previously been deleted. Returns this <code>TimerUpdateBuilder</code>
setTimer
{ "repo_name": "tweise/beam", "path": "runners/direct-java/src/main/java/org/apache/beam/runners/direct/WatermarkManager.java", "license": "apache-2.0", "size": 55302 }
[ "org.apache.beam.sdk.util.TimerInternals" ]
import org.apache.beam.sdk.util.TimerInternals;
import org.apache.beam.sdk.util.*;
[ "org.apache.beam" ]
org.apache.beam;
2,283,710