method
stringlengths 13
441k
| clean_method
stringlengths 7
313k
| doc
stringlengths 17
17.3k
| comment
stringlengths 3
1.42k
| method_name
stringlengths 1
273
| extra
dict | imports
sequence | imports_info
stringlengths 19
34.8k
| cluster_imports_info
stringlengths 15
3.66k
| libraries
sequence | libraries_info
stringlengths 6
661
| id
int64 0
2.92M
|
---|---|---|---|---|---|---|---|---|---|---|---|
SerDeStats getStats(); | SerDeStats getStats(); | /**
* Returns the statistics information
* @return SerDeStats
*/ | Returns the statistics information | getStats | {
"repo_name": "WANdisco/amplab-hive",
"path": "ql/src/java/org/apache/hadoop/hive/ql/io/StatsProvidingRecordWriter.java",
"license": "apache-2.0",
"size": 1462
} | [
"org.apache.hadoop.hive.serde2.SerDeStats"
] | import org.apache.hadoop.hive.serde2.SerDeStats; | import org.apache.hadoop.hive.serde2.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 2,659,331 |
Frame makeFrame(URI uri); | Frame makeFrame(URI uri); | /**
* Create a new named frame
*/ | Create a new named frame | makeFrame | {
"repo_name": "monnetproject/lemon.api",
"path": "main/src/main/java/eu/monnetproject/lemon/LemonFactory.java",
"license": "bsd-3-clause",
"size": 7066
} | [
"eu.monnetproject.lemon.model.Frame"
] | import eu.monnetproject.lemon.model.Frame; | import eu.monnetproject.lemon.model.*; | [
"eu.monnetproject.lemon"
] | eu.monnetproject.lemon; | 1,217,043 |
public static List<Map<String, Object>> getDayValueList(Locale locale) {
Calendar tempCal = Calendar.getInstance(locale);
tempCal.set(Calendar.DAY_OF_WEEK, tempCal.getFirstDayOfWeek());
SimpleDateFormat dateFormat = new SimpleDateFormat("EEEE", locale);
List<Map<String, Object>> result = new ArrayList<>(7);
for (int i = 0; i < 7; i++) {
result.add(UtilMisc.toMap("description", (Object)dateFormat.format(tempCal.getTime()), "value", tempCal.get(Calendar.DAY_OF_WEEK)));
tempCal.roll(Calendar.DAY_OF_WEEK, 1);
}
return result;
} | static List<Map<String, Object>> function(Locale locale) { Calendar tempCal = Calendar.getInstance(locale); tempCal.set(Calendar.DAY_OF_WEEK, tempCal.getFirstDayOfWeek()); SimpleDateFormat dateFormat = new SimpleDateFormat("EEEE", locale); List<Map<String, Object>> result = new ArrayList<>(7); for (int i = 0; i < 7; i++) { result.add(UtilMisc.toMap(STR, (Object)dateFormat.format(tempCal.getTime()), "value", tempCal.get(Calendar.DAY_OF_WEEK))); tempCal.roll(Calendar.DAY_OF_WEEK, 1); } return result; } | /** Returns a List of Maps containing day of the week values.
* @param locale
* @return List of Maps. Each Map has a
* <code>description</code> entry and a <code>value</code> entry.
*/ | Returns a List of Maps containing day of the week values | getDayValueList | {
"repo_name": "yuri0x7c1/ofbiz-explorer",
"path": "src/test/resources/apache-ofbiz-17.12.04/framework/service/src/main/java/org/apache/ofbiz/service/calendar/ExpressionUiHelper.java",
"license": "apache-2.0",
"size": 7550
} | [
"com.ibm.icu.util.Calendar",
"java.text.SimpleDateFormat",
"java.util.ArrayList",
"java.util.List",
"java.util.Locale",
"java.util.Map",
"org.apache.ofbiz.base.util.UtilMisc"
] | import com.ibm.icu.util.Calendar; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.List; import java.util.Locale; import java.util.Map; import org.apache.ofbiz.base.util.UtilMisc; | import com.ibm.icu.util.*; import java.text.*; import java.util.*; import org.apache.ofbiz.base.util.*; | [
"com.ibm.icu",
"java.text",
"java.util",
"org.apache.ofbiz"
] | com.ibm.icu; java.text; java.util; org.apache.ofbiz; | 2,033,578 |
public void setRatingService(RatingService ratingService)
{
this.ratingService = ratingService;
}
| void function(RatingService ratingService) { this.ratingService = ratingService; } | /**
* Sets the rating service instance
*
* @param ratingService the rating service to set
*/ | Sets the rating service instance | setRatingService | {
"repo_name": "nguyentienlong/community-edition",
"path": "projects/remote-api/source/java/org/alfresco/repo/web/scripts/rating/AbstractRatingWebScript.java",
"license": "lgpl-3.0",
"size": 3578
} | [
"org.alfresco.service.cmr.rating.RatingService"
] | import org.alfresco.service.cmr.rating.RatingService; | import org.alfresco.service.cmr.rating.*; | [
"org.alfresco.service"
] | org.alfresco.service; | 667,599 |
in = new FileReader(productsFile);
reader = new BufferedReader(in);
} | in = new FileReader(productsFile); reader = new BufferedReader(in); } | /**
* Initialize reader.
*
* @throws IOException if file cannot be opened.
*/ | Initialize reader | init | {
"repo_name": "KungFuLucky7/NetBeansProjects",
"path": "Code Potato/POST2/PostClient/src/post/ClientProductReader.java",
"license": "gpl-2.0",
"size": 2137
} | [
"java.io.BufferedReader",
"java.io.FileReader"
] | import java.io.BufferedReader; import java.io.FileReader; | import java.io.*; | [
"java.io"
] | java.io; | 2,568,176 |
public void setAuthenticationService(AuthenticationService authenticationService)
{
log.warn("Bean property 'authenticationService' no longer required.");
}
| void function(AuthenticationService authenticationService) { log.warn(STR); } | /**
* Set the authentication service
*
* @param authenticationService
*/ | Set the authentication service | setAuthenticationService | {
"repo_name": "loftuxab/community-edition-old",
"path": "projects/repository/source/java/org/alfresco/repo/security/permissions/impl/acegi/ACLEntryAfterInvocationProvider.java",
"license": "lgpl-3.0",
"size": 47363
} | [
"org.alfresco.service.cmr.security.AuthenticationService"
] | import org.alfresco.service.cmr.security.AuthenticationService; | import org.alfresco.service.cmr.security.*; | [
"org.alfresco.service"
] | org.alfresco.service; | 1,625,063 |
public VectorIterator nonZeroIteratorOfColumn(int j) {
final int jj = j;
return new VectorIterator(rows) {
private int i = -1; | VectorIterator function(int j) { final int jj = j; return new VectorIterator(rows) { private int i = -1; | /**
* Returns a non-zero vector iterator of the given column {@code j}.
*
* @return a non-zero vector iterator
*/ | Returns a non-zero vector iterator of the given column j | nonZeroIteratorOfColumn | {
"repo_name": "rabbanyk/CommunityEvaluation",
"path": "libs/la4j-0.5.0/src/main/java/org/la4j/matrix/sparse/SparseMatrix.java",
"license": "mit",
"size": 17360
} | [
"org.la4j.iterator.VectorIterator"
] | import org.la4j.iterator.VectorIterator; | import org.la4j.iterator.*; | [
"org.la4j.iterator"
] | org.la4j.iterator; | 2,707,698 |
public void setCoverageTo(Date coverageto) {
this.coverageto = (Date) coverageto.clone();
} | void function(Date coverageto) { this.coverageto = (Date) coverageto.clone(); } | /**
* Sets the coverage to.
*
* @param coverageto
* the coverageto to set
*/ | Sets the coverage to | setCoverageTo | {
"repo_name": "fraunhoferfokus/odp-opendataregistry-client",
"path": "src/main/java/de/fhg/fokus/odp/registry/queries/Query.java",
"license": "agpl-3.0",
"size": 7457
} | [
"java.util.Date"
] | import java.util.Date; | import java.util.*; | [
"java.util"
] | java.util; | 1,692,851 |
@Override
public void serialEvent(SerialPortEvent event) {
switch(event.getEventType()) {
case SerialPortEvent.BI:
case SerialPortEvent.CD:
case SerialPortEvent.CTS:
case SerialPortEvent.DSR:
case SerialPortEvent.FE:
case SerialPortEvent.OE:
case SerialPortEvent.OUTPUT_BUFFER_EMPTY:
case SerialPortEvent.PE:
case SerialPortEvent.RI:
break;
case SerialPortEvent.DATA_AVAILABLE:
short[] payload;
int b;
while (true) {
try {
if (in.available() == 0) {
// No more data available.
break;
}
b = in.read();
} catch (IOException e) {
displayMessage.displayLogLater("error on receive: " + e.getMessage());
break;
}
payload = frameHandler.frameAssembler(b);
if (payload != null) {
displayMessage.displayFrameLater(frameHandler.displayFrame(payload));
}
}
break;
default:
displayMessage.displayLogLater("FrameHandler.serialEvent() - unknown event type: " + event.getEventType());
}
}
| void function(SerialPortEvent event) { switch(event.getEventType()) { case SerialPortEvent.BI: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.FE: case SerialPortEvent.OE: case SerialPortEvent.OUTPUT_BUFFER_EMPTY: case SerialPortEvent.PE: case SerialPortEvent.RI: break; case SerialPortEvent.DATA_AVAILABLE: short[] payload; int b; while (true) { try { if (in.available() == 0) { break; } b = in.read(); } catch (IOException e) { displayMessage.displayLogLater(STR + e.getMessage()); break; } payload = frameHandler.frameAssembler(b); if (payload != null) { displayMessage.displayFrameLater(frameHandler.displayFrame(payload)); } } break; default: displayMessage.displayLogLater(STR + event.getEventType()); } } | /**
* Event notification must be enabled for every event in setSerialPort() above.
* We can't call displayMessage.display() from this method, as we are not in FX thread.
*
* @param event
*/ | Event notification must be enabled for every event in setSerialPort() above. We can't call displayMessage.display() from this method, as we are not in FX thread | serialEvent | {
"repo_name": "Orange-OpenSource/iot-libelium-lora-gateway",
"path": "src/com/orange/pb/loragatewaycontroller/PortHandler.java",
"license": "gpl-2.0",
"size": 7137
} | [
"gnu.io.SerialPortEvent",
"java.io.IOException"
] | import gnu.io.SerialPortEvent; import java.io.IOException; | import gnu.io.*; import java.io.*; | [
"gnu.io",
"java.io"
] | gnu.io; java.io; | 2,817,777 |
private synchronized IndexService createIndexService(final String reason,
IndexMetaData indexMetaData, IndicesQueryCache indicesQueryCache,
IndicesFieldDataCache indicesFieldDataCache,
List<IndexEventListener> builtInListeners,
IndexingOperationListener... indexingOperationListeners) throws IOException {
final IndexSettings idxSettings = new IndexSettings(indexMetaData, this.settings, indexScopeSetting);
logger.debug("creating Index [{}], shards [{}]/[{}] - reason [{}]",
indexMetaData.getIndex(),
idxSettings.getNumberOfShards(),
idxSettings.getNumberOfReplicas(),
reason);
final IndexModule indexModule = new IndexModule(idxSettings, analysisRegistry);
for (IndexingOperationListener operationListener : indexingOperationListeners) {
indexModule.addIndexOperationListener(operationListener);
}
pluginsService.onIndexModule(indexModule);
for (IndexEventListener listener : builtInListeners) {
indexModule.addIndexEventListener(listener);
}
return indexModule.newIndexService(
nodeEnv,
xContentRegistry,
this,
circuitBreakerService,
bigArrays,
threadPool,
scriptService,
client,
indicesQueryCache,
mapperRegistry,
indicesFieldDataCache);
} | synchronized IndexService function(final String reason, IndexMetaData indexMetaData, IndicesQueryCache indicesQueryCache, IndicesFieldDataCache indicesFieldDataCache, List<IndexEventListener> builtInListeners, IndexingOperationListener... indexingOperationListeners) throws IOException { final IndexSettings idxSettings = new IndexSettings(indexMetaData, this.settings, indexScopeSetting); logger.debug(STR, indexMetaData.getIndex(), idxSettings.getNumberOfShards(), idxSettings.getNumberOfReplicas(), reason); final IndexModule indexModule = new IndexModule(idxSettings, analysisRegistry); for (IndexingOperationListener operationListener : indexingOperationListeners) { indexModule.addIndexOperationListener(operationListener); } pluginsService.onIndexModule(indexModule); for (IndexEventListener listener : builtInListeners) { indexModule.addIndexEventListener(listener); } return indexModule.newIndexService( nodeEnv, xContentRegistry, this, circuitBreakerService, bigArrays, threadPool, scriptService, client, indicesQueryCache, mapperRegistry, indicesFieldDataCache); } | /**
* This creates a new IndexService without registering it
*/ | This creates a new IndexService without registering it | createIndexService | {
"repo_name": "jimczi/elasticsearch",
"path": "core/src/main/java/org/elasticsearch/indices/IndicesService.java",
"license": "apache-2.0",
"size": 62466
} | [
"java.io.IOException",
"java.util.List",
"org.elasticsearch.cluster.metadata.IndexMetaData",
"org.elasticsearch.index.IndexModule",
"org.elasticsearch.index.IndexService",
"org.elasticsearch.index.IndexSettings",
"org.elasticsearch.index.shard.IndexEventListener",
"org.elasticsearch.index.shard.IndexingOperationListener",
"org.elasticsearch.indices.fielddata.cache.IndicesFieldDataCache"
] | import java.io.IOException; import java.util.List; import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.index.IndexModule; import org.elasticsearch.index.IndexService; import org.elasticsearch.index.IndexSettings; import org.elasticsearch.index.shard.IndexEventListener; import org.elasticsearch.index.shard.IndexingOperationListener; import org.elasticsearch.indices.fielddata.cache.IndicesFieldDataCache; | import java.io.*; import java.util.*; import org.elasticsearch.cluster.metadata.*; import org.elasticsearch.index.*; import org.elasticsearch.index.shard.*; import org.elasticsearch.indices.fielddata.cache.*; | [
"java.io",
"java.util",
"org.elasticsearch.cluster",
"org.elasticsearch.index",
"org.elasticsearch.indices"
] | java.io; java.util; org.elasticsearch.cluster; org.elasticsearch.index; org.elasticsearch.indices; | 936,172 |
@Test
public void testDeserialize() throws IOException {
Mockito.when(this.parser.getText()).thenReturn(DATE_STRING);
final JsonDateDeserializer deserializer = new JsonDateDeserializer();
final Date date = deserializer.deserialize(this.parser, this.context);
Assert.assertEquals(EXPECTED_MILLISECONDS, date.getTime());
} | void function() throws IOException { Mockito.when(this.parser.getText()).thenReturn(DATE_STRING); final JsonDateDeserializer deserializer = new JsonDateDeserializer(); final Date date = deserializer.deserialize(this.parser, this.context); Assert.assertEquals(EXPECTED_MILLISECONDS, date.getTime()); } | /**
* Test the de-serialization method.
*
* @throws IOException When exception happens during serialization
*/ | Test the de-serialization method | testDeserialize | {
"repo_name": "irontable/genie",
"path": "genie-common/src/test/java/com/netflix/genie/common/util/JsonDateDeserializerUnitTests.java",
"license": "apache-2.0",
"size": 3151
} | [
"java.io.IOException",
"java.util.Date",
"org.junit.Assert",
"org.mockito.Mockito"
] | import java.io.IOException; import java.util.Date; import org.junit.Assert; import org.mockito.Mockito; | import java.io.*; import java.util.*; import org.junit.*; import org.mockito.*; | [
"java.io",
"java.util",
"org.junit",
"org.mockito"
] | java.io; java.util; org.junit; org.mockito; | 408,848 |
public void loadPlattformar() {
PanelHelper.cleanPanel(plattformHolder);
ArrayList<String> al = null;
try {
al = DB.fetchColumn("select pid from plattform");
} catch (InfException e) {
e.getMessage();
}
for (String st : al) {
if (Validate.containsOnlyDigits(st)) {
PanelHelper.addPanelToPanel(new PlattformShowBox(Integer.parseInt(st)), plattformHolder, 500, 50);
Dimension d = plattformHolder.getPreferredSize();
d.setSize(d.getWidth(), (d.getHeight() + 105));
plattformHolder.setPreferredSize(d);
}
}
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel labelAddPlattform;
private javax.swing.JPanel plattformHolder;
private javax.swing.JScrollPane plattformScroll;
// End of variables declaration//GEN-END:variables | void function() { PanelHelper.cleanPanel(plattformHolder); ArrayList<String> al = null; try { al = DB.fetchColumn(STR); } catch (InfException e) { e.getMessage(); } for (String st : al) { if (Validate.containsOnlyDigits(st)) { PanelHelper.addPanelToPanel(new PlattformShowBox(Integer.parseInt(st)), plattformHolder, 500, 50); Dimension d = plattformHolder.getPreferredSize(); d.setSize(d.getWidth(), (d.getHeight() + 105)); plattformHolder.setPreferredSize(d); } } } private javax.swing.JLabel jLabel1; private javax.swing.JLabel labelAddPlattform; private javax.swing.JPanel plattformHolder; private javax.swing.JScrollPane plattformScroll; | /**
* loads the avalible plattformar into view
*/ | loads the avalible plattformar into view | loadPlattformar | {
"repo_name": "DegJ/miceschoolproject",
"path": "MICE/src/mice/plattform/PlattformPanel.java",
"license": "apache-2.0",
"size": 6538
} | [
"java.awt.Dimension",
"java.util.ArrayList"
] | import java.awt.Dimension; import java.util.ArrayList; | import java.awt.*; import java.util.*; | [
"java.awt",
"java.util"
] | java.awt; java.util; | 650,042 |
public static String getMappingFile(Properties properties, DataStore<?,?> store
, String defaultValue) throws IOException {
String mappingFilename = findProperty(properties, store, MAPPING_FILE, defaultValue);
InputStream mappingFile = store.getClass().getClassLoader().getResourceAsStream(mappingFilename);
if (mappingFile == null)
throw new IOException("Unable to open mapping file: "+mappingFilename);
return mappingFilename;
} | static String function(Properties properties, DataStore<?,?> store , String defaultValue) throws IOException { String mappingFilename = findProperty(properties, store, MAPPING_FILE, defaultValue); InputStream mappingFile = store.getClass().getClassLoader().getResourceAsStream(mappingFilename); if (mappingFile == null) throw new IOException(STR+mappingFilename); return mappingFilename; } | /**
* Looks for the <code>gora-<classname>-mapping.xml</code> as a resource
* on the classpath. This can however also be specified within the
* <code>gora.properties</code> file with the key
* <code>gora.<classname>.mapping.file=</code>.
* @param properties which hold keys from which we can obtain values for datastore mappings.
* @param store {@link org.apache.gora.store.DataStore} object to get the mapping for.
* @param defaultValue default value for the <code>gora-<classname>-mapping.xml</code>
* @return mappingFilename if one is located.
* @throws IOException if there is a problem reading or obtaining the mapping file.
*/ | Looks for the <code>gora-<classname>-mapping.xml</code> as a resource on the classpath. This can however also be specified within the <code>gora.properties</code> file with the key <code>gora.<classname>.mapping.file=</code> | getMappingFile | {
"repo_name": "SwathiMystery/gora",
"path": "gora-core/src/main/java/org/apache/gora/store/DataStoreFactory.java",
"license": "apache-2.0",
"size": 17002
} | [
"java.io.IOException",
"java.io.InputStream",
"java.util.Properties"
] | import java.io.IOException; import java.io.InputStream; import java.util.Properties; | import java.io.*; import java.util.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 1,298,618 |
public String authenticate() {
String loginXml = HttpUtil.executeUrl("GET", getURL("login_sid.lua", addSID("")), 10 * timeout);
if (loginXml == null) {
logger.error("FritzBox does not respond");
return null;
}
Matcher sidmatch = SID_PATTERN.matcher(loginXml);
if (!sidmatch.find()) {
logger.error("FritzBox does not respond with SID");
logger.debug("Output:\n" + loginXml);
return null;
}
sid = sidmatch.group(1);
Matcher accmatch = ACCESS_PATTERN.matcher(loginXml);
if (accmatch.find()) {
if (accmatch.group(1) == "2")
logger.info("Resuming FritzBox connection with SID " + sid);
return sid;
}
Matcher challengematch = CHALLENGE_PATTERN.matcher(loginXml);
if (!challengematch.find()) {
logger.error("FritzBox does not respond with challenge for authentication");
return null;
}
String challenge = challengematch.group(1);
String response = createResponse(challenge);
loginXml = HttpUtil.executeUrl(
"GET",
getURL("login_sid.lua", (!username.equals("") ? ("username=" + username + "&") : "") + "response="
+ response), timeout);
if (loginXml == null) {
logger.error("FritzBox does not respond");
return null;
}
sidmatch = SID_PATTERN.matcher(loginXml);
if (!sidmatch.find()) {
logger.error("FritzBox does not respond with SID");
return null;
}
sid = sidmatch.group(1);
accmatch = ACCESS_PATTERN.matcher(loginXml);
if (accmatch.find()) {
if (accmatch.group(1) == "2")
logger.info("Established FritzBox connection with SID " + sid);
return sid;
}
logger.error("User " + username + " has no access to FritzBox home automation functions");
return null;
} | String function() { String loginXml = HttpUtil.executeUrl("GET", getURL(STR, addSID(STRFritzBox does not respondSTRFritzBox does not respond with SIDSTROutput:\nSTR2STRResuming FritzBox connection with SID STRFritzBox does not respond with challenge for authenticationSTRGET", getURL(STR, (!username.equals("STRusername=STR&STRSTRresponse=STRFritzBox does not respondSTRFritzBox does not respond with SIDSTR2STREstablished FritzBox connection with SID STRUser STR has no access to FritzBox home automation functions"); return null; } | /**
* This method authenticates with the Fritz!OS Web Interface and updates the
* session ID accordingly
*
* @return New session ID
*/ | This method authenticates with the Fritz!OS Web Interface and updates the session ID accordingly | authenticate | {
"repo_name": "Ole8700/openhab",
"path": "bundles/binding/org.openhab.binding.fritzaha/src/main/java/org/openhab/binding/fritzaha/internal/hardware/FritzahaWebInterface.java",
"license": "gpl-3.0",
"size": 11062
} | [
"org.openhab.io.net.http.HttpUtil"
] | import org.openhab.io.net.http.HttpUtil; | import org.openhab.io.net.http.*; | [
"org.openhab.io"
] | org.openhab.io; | 1,246,708 |
void select(ViewHolder selected, int actionState) {
if (selected == mSelected && actionState == mActionState) {
return;
}
mDragScrollStartTimeInMs = Long.MIN_VALUE;
final int prevActionState = mActionState;
// prevent duplicate animations
endRecoverAnimation(selected, true);
mActionState = actionState;
if (actionState == ACTION_STATE_DRAG) {
// we remove after animation is complete. this means we only elevate the last drag
// child but that should perform good enough as it is very hard to start dragging a
// new child before the previous one settles.
mOverdrawChild = selected.itemView;
addChildDrawingOrderCallback();
}
int actionStateMask = (1 << (DIRECTION_FLAG_COUNT + DIRECTION_FLAG_COUNT * actionState))
- 1;
boolean preventLayout = false;
if (mSelected != null) {
final ViewHolder prevSelected = mSelected;
if (prevSelected.itemView.getParent() != null) {
final int swipeDir = prevActionState == ACTION_STATE_DRAG ? 0
: swipeIfNecessary(prevSelected);
releaseVelocityTracker();
// find where we should animate to
final float targetTranslateX, targetTranslateY;
int animationType;
switch (swipeDir) {
case LEFT:
case RIGHT:
case START:
case END:
targetTranslateY = 0;
targetTranslateX = Math.signum(mDx) * mRecyclerView.getWidth();
break;
case UP:
case DOWN:
targetTranslateX = 0;
targetTranslateY = Math.signum(mDy) * mRecyclerView.getHeight();
break;
default:
targetTranslateX = 0;
targetTranslateY = 0;
}
if (prevActionState == ACTION_STATE_DRAG) {
animationType = ANIMATION_TYPE_DRAG;
} else if (swipeDir > 0) {
animationType = ANIMATION_TYPE_SWIPE_SUCCESS;
} else {
animationType = ANIMATION_TYPE_SWIPE_CANCEL;
} | void select(ViewHolder selected, int actionState) { if (selected == mSelected && actionState == mActionState) { return; } mDragScrollStartTimeInMs = Long.MIN_VALUE; final int prevActionState = mActionState; endRecoverAnimation(selected, true); mActionState = actionState; if (actionState == ACTION_STATE_DRAG) { mOverdrawChild = selected.itemView; addChildDrawingOrderCallback(); } int actionStateMask = (1 << (DIRECTION_FLAG_COUNT + DIRECTION_FLAG_COUNT * actionState)) - 1; boolean preventLayout = false; if (mSelected != null) { final ViewHolder prevSelected = mSelected; if (prevSelected.itemView.getParent() != null) { final int swipeDir = prevActionState == ACTION_STATE_DRAG ? 0 : swipeIfNecessary(prevSelected); releaseVelocityTracker(); final float targetTranslateX, targetTranslateY; int animationType; switch (swipeDir) { case LEFT: case RIGHT: case START: case END: targetTranslateY = 0; targetTranslateX = Math.signum(mDx) * mRecyclerView.getWidth(); break; case UP: case DOWN: targetTranslateX = 0; targetTranslateY = Math.signum(mDy) * mRecyclerView.getHeight(); break; default: targetTranslateX = 0; targetTranslateY = 0; } if (prevActionState == ACTION_STATE_DRAG) { animationType = ANIMATION_TYPE_DRAG; } else if (swipeDir > 0) { animationType = ANIMATION_TYPE_SWIPE_SUCCESS; } else { animationType = ANIMATION_TYPE_SWIPE_CANCEL; } | /**
* Starts dragging or swiping the given View. Call with null if you want to clear it.
*
* @param selected The ViewHolder to drag or swipe. Can be null if you want to cancel the
* current action
* @param actionState The type of action
*/ | Starts dragging or swiping the given View. Call with null if you want to clear it | select | {
"repo_name": "slp/Telegram-FOSS",
"path": "TMessagesProj/src/main/java/org/telegram/messenger/support/widget/helper/ItemTouchHelper.java",
"license": "gpl-2.0",
"size": 106711
} | [
"org.telegram.messenger.support.widget.RecyclerView"
] | import org.telegram.messenger.support.widget.RecyclerView; | import org.telegram.messenger.support.widget.*; | [
"org.telegram.messenger"
] | org.telegram.messenger; | 2,651,714 |
@Override
public String getValue() {
if (super.getValue() == null && myHaveComponentParts) {
if (determineLocalPrefix(myBaseUrl) != null && myResourceType == null && myUnqualifiedVersionId == null) {
return myBaseUrl + myUnqualifiedId;
}
StringBuilder b = new StringBuilder();
if (isNotBlank(myBaseUrl)) {
b.append(myBaseUrl);
if (myBaseUrl.charAt(myBaseUrl.length() - 1) != '/') {
b.append('/');
}
}
if (isNotBlank(myResourceType)) {
b.append(myResourceType);
}
if (b.length() > 0) {
b.append('/');
}
b.append(myUnqualifiedId);
if (isNotBlank(myUnqualifiedVersionId)) {
b.append('/');
b.append(Constants.PARAM_HISTORY);
b.append('/');
b.append(myUnqualifiedVersionId);
}
String value = b.toString();
super.setValue(value);
}
return super.getValue();
} | String function() { if (super.getValue() == null && myHaveComponentParts) { if (determineLocalPrefix(myBaseUrl) != null && myResourceType == null && myUnqualifiedVersionId == null) { return myBaseUrl + myUnqualifiedId; } StringBuilder b = new StringBuilder(); if (isNotBlank(myBaseUrl)) { b.append(myBaseUrl); if (myBaseUrl.charAt(myBaseUrl.length() - 1) != '/') { b.append('/'); } } if (isNotBlank(myResourceType)) { b.append(myResourceType); } if (b.length() > 0) { b.append('/'); } b.append(myUnqualifiedId); if (isNotBlank(myUnqualifiedVersionId)) { b.append('/'); b.append(Constants.PARAM_HISTORY); b.append('/'); b.append(myUnqualifiedVersionId); } String value = b.toString(); super.setValue(value); } return super.getValue(); } | /**
* Returns the value of this ID. Note that this value may be a fully qualified URL, a relative/partial URL, or a simple ID. Use {@link #getIdPart()} to get just the ID portion.
*
* @see #getIdPart()
*/ | Returns the value of this ID. Note that this value may be a fully qualified URL, a relative/partial URL, or a simple ID. Use <code>#getIdPart()</code> to get just the ID portion | getValue | {
"repo_name": "Cloudyle/hapi-fhir",
"path": "hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/IdDt.java",
"license": "apache-2.0",
"size": 19465
} | [
"ca.uhn.fhir.rest.server.Constants"
] | import ca.uhn.fhir.rest.server.Constants; | import ca.uhn.fhir.rest.server.*; | [
"ca.uhn.fhir"
] | ca.uhn.fhir; | 881,502 |
private void attemptLogin() {
// Reset errors.
emailView.setError(null);
passwordView.setError(null);
// Store values at the time of the login attempt.
String email = emailView.getText().toString();
String password = passwordView.getText().toString();
boolean cancel = false;
View focusView = null;
// Check for a valid password, if the user entered one.
if (!TextUtils.isEmpty(password) && !isPasswordValid(password)) {
passwordView.setError(getString(R.string.error_invalid_password));
focusView = passwordView;
cancel = true;
}
// Check for a valid email address.
if (TextUtils.isEmpty(email)) {
emailView.setError(getString(R.string.error_field_required));
focusView = emailView;
cancel = true;
}
// else if (!isEmailValid(email)) {
// emailView.setError(getString(R.string.error_invalid_email));
// focusView = emailView;
// cancel = true;
// }
if (cancel) {
// There was an error; don't attempt login and focus the first
// form field with an error.
focusView.requestFocus();
} else {
// Show a progress spinner, and kick off a background task to
// perform the user login attempt.
User user = new User();
user.setUserEmail(emailView.getText().toString());
user.setUserPassword(passwordView.getText().toString());
user.setLogin_type(1);
progressDialog = ProgressDialog.show(this, "", "Loading...", true);
Utility.authenticate(getContext(), progressDialog, API.LOGIN, user);
}
} | void function() { emailView.setError(null); passwordView.setError(null); String email = emailView.getText().toString(); String password = passwordView.getText().toString(); boolean cancel = false; View focusView = null; if (!TextUtils.isEmpty(password) && !isPasswordValid(password)) { passwordView.setError(getString(R.string.error_invalid_password)); focusView = passwordView; cancel = true; } if (TextUtils.isEmpty(email)) { emailView.setError(getString(R.string.error_field_required)); focusView = emailView; cancel = true; } if (cancel) { focusView.requestFocus(); } else { User user = new User(); user.setUserEmail(emailView.getText().toString()); user.setUserPassword(passwordView.getText().toString()); user.setLogin_type(1); progressDialog = ProgressDialog.show(this, STRLoading...", true); Utility.authenticate(getContext(), progressDialog, API.LOGIN, user); } } | /**
* Attempts to sign in or register the account specified by the login form.
* If there are form errors (invalid email, missing fields, etc.), the
* errors are presented and no actual login attempt is made.
*/ | Attempts to sign in or register the account specified by the login form. If there are form errors (invalid email, missing fields, etc.), the errors are presented and no actual login attempt is made | attemptLogin | {
"repo_name": "AadityaDev/Tracker",
"path": "app/src/main/java/com/skybee/tracker/activities/LoginActivity.java",
"license": "apache-2.0",
"size": 8933
} | [
"android.app.ProgressDialog",
"android.text.TextUtils",
"android.view.View",
"com.skybee.tracker.Utility",
"com.skybee.tracker.model.User"
] | import android.app.ProgressDialog; import android.text.TextUtils; import android.view.View; import com.skybee.tracker.Utility; import com.skybee.tracker.model.User; | import android.app.*; import android.text.*; import android.view.*; import com.skybee.tracker.*; import com.skybee.tracker.model.*; | [
"android.app",
"android.text",
"android.view",
"com.skybee.tracker"
] | android.app; android.text; android.view; com.skybee.tracker; | 639,041 |
public static Map<String, String> getProperties(Object object) throws Exception {
if (object == null) {
return Collections.emptyMap();
}
Map<String, String> properties = new LinkedHashMap<String, String>();
BeanInfo beanInfo = Introspector.getBeanInfo(object.getClass());
Object[] NULL_ARG = {};
PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
if (propertyDescriptors != null) {
for (int i = 0; i < propertyDescriptors.length; i++) {
PropertyDescriptor pd = propertyDescriptors[i];
if (pd.getReadMethod() != null && !pd.getName().equals("class") && !pd.getName().equals("properties") && !pd.getName().equals("reference")) {
Object value = pd.getReadMethod().invoke(object, NULL_ARG);
if (value != null) {
if (value instanceof Boolean || value instanceof Number || value instanceof String || value instanceof URI || value instanceof URL) {
properties.put(pd.getName(), ("" + value));
} else if (value instanceof SSLContext) {
// ignore this one..
} else {
Map<String, String> inner = getProperties(value);
for (Map.Entry<String, String> entry : inner.entrySet()) {
properties.put(pd.getName() + "." + entry.getKey(), entry.getValue());
}
}
}
}
}
}
return properties;
} | static Map<String, String> function(Object object) throws Exception { if (object == null) { return Collections.emptyMap(); } Map<String, String> properties = new LinkedHashMap<String, String>(); BeanInfo beanInfo = Introspector.getBeanInfo(object.getClass()); Object[] NULL_ARG = {}; PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors(); if (propertyDescriptors != null) { for (int i = 0; i < propertyDescriptors.length; i++) { PropertyDescriptor pd = propertyDescriptors[i]; if (pd.getReadMethod() != null && !pd.getName().equals("class") && !pd.getName().equals(STR) && !pd.getName().equals(STR)) { Object value = pd.getReadMethod().invoke(object, NULL_ARG); if (value != null) { if (value instanceof Boolean value instanceof Number value instanceof String value instanceof URI value instanceof URL) { properties.put(pd.getName(), (STR." + entry.getKey(), entry.getValue()); } } } } } } return properties; } | /**
* Get properties from an object using reflection. If the passed object is null an
* empty <code>Map</code> is returned.
*
* @param object
* the Object whose properties are to be extracted.
*
* @return <Code>Map</Code> of properties extracted from the given object.
*
* @throws Exception if an error occurs while examining the object's properties.
*/ | Get properties from an object using reflection. If the passed object is null an empty <code>Map</code> is returned | getProperties | {
"repo_name": "avranju/qpid-jms",
"path": "qpid-jms-client/src/main/java/org/apache/qpid/jms/util/PropertyUtil.java",
"license": "apache-2.0",
"size": 22264
} | [
"java.beans.BeanInfo",
"java.beans.Introspector",
"java.beans.PropertyDescriptor",
"java.util.Collections",
"java.util.LinkedHashMap",
"java.util.Map"
] | import java.beans.BeanInfo; import java.beans.Introspector; import java.beans.PropertyDescriptor; import java.util.Collections; import java.util.LinkedHashMap; import java.util.Map; | import java.beans.*; import java.util.*; | [
"java.beans",
"java.util"
] | java.beans; java.util; | 284,682 |
private static void handleErrorAndRethrow(Consumer<Exception> errorHandler, Exception exception) {
handleError(errorHandler, exception);
final Throwable cause = exception.getCause();
// Note: Instance of is false for null
if (cause instanceof RuntimeException) {
throw (RuntimeException) cause;
}
if (cause instanceof Error) {
throw (Error) cause;
}
throw new ConcurrentRuntimeException((cause == null) ? exception : cause);
} | static void function(Consumer<Exception> errorHandler, Exception exception) { handleError(errorHandler, exception); final Throwable cause = exception.getCause(); if (cause instanceof RuntimeException) { throw (RuntimeException) cause; } if (cause instanceof Error) { throw (Error) cause; } throw new ConcurrentRuntimeException((cause == null) ? exception : cause); } | /**
* Handle the error using the error handler and re-throw the underlying unchecked exception or a
* wrapped exception.
*
* @param errorHandler the error handler
* @param exception the exception
*/ | Handle the error using the error handler and re-throw the underlying unchecked exception or a wrapped exception | handleErrorAndRethrow | {
"repo_name": "aherbert/GDSC-Core",
"path": "src/main/java/uk/ac/sussex/gdsc/core/utils/concurrent/ConcurrencyUtils.java",
"license": "gpl-3.0",
"size": 12433
} | [
"java.util.function.Consumer",
"org.apache.commons.lang3.concurrent.ConcurrentRuntimeException"
] | import java.util.function.Consumer; import org.apache.commons.lang3.concurrent.ConcurrentRuntimeException; | import java.util.function.*; import org.apache.commons.lang3.concurrent.*; | [
"java.util",
"org.apache.commons"
] | java.util; org.apache.commons; | 2,475,507 |
public BusinessObjectService getBoService() {
if (boService == null) {
boService = SpringContext.getBean(BusinessObjectService.class);
}
return boService;
} | BusinessObjectService function() { if (boService == null) { boService = SpringContext.getBean(BusinessObjectService.class); } return boService; } | /**
* Gets the boService attribute.
*
* @return Returns the boService.
*/ | Gets the boService attribute | getBoService | {
"repo_name": "quikkian-ua-devops/will-financials",
"path": "kfs-ar/src/main/java/org/kuali/kfs/module/ar/web/struts/AccountsReceivableTemplateUploadAction.java",
"license": "agpl-3.0",
"size": 10441
} | [
"org.kuali.kfs.krad.service.BusinessObjectService",
"org.kuali.kfs.sys.context.SpringContext"
] | import org.kuali.kfs.krad.service.BusinessObjectService; import org.kuali.kfs.sys.context.SpringContext; | import org.kuali.kfs.krad.service.*; import org.kuali.kfs.sys.context.*; | [
"org.kuali.kfs"
] | org.kuali.kfs; | 2,366,762 |
void getNodeByPath(@NotNull String path, @NotNull AsyncCallback<TreeNode<?>> callback); | void getNodeByPath(@NotNull String path, @NotNull AsyncCallback<TreeNode<?>> callback); | /**
* Looks for the node with the specified path in the tree structure
* and returns it or {@code null} if it was not found.
*
* @param path
* node path
* @param callback
* callback to return node, may return {@code null} if node not found
*/ | Looks for the node with the specified path in the tree structure and returns it or null if it was not found | getNodeByPath | {
"repo_name": "alexVengrovsk/che",
"path": "core/ide/che-core-ide-api/src/main/java/org/eclipse/che/ide/api/project/tree/TreeStructure.java",
"license": "epl-1.0",
"size": 1651
} | [
"com.google.gwt.user.client.rpc.AsyncCallback",
"javax.validation.constraints.NotNull"
] | import com.google.gwt.user.client.rpc.AsyncCallback; import javax.validation.constraints.NotNull; | import com.google.gwt.user.client.rpc.*; import javax.validation.constraints.*; | [
"com.google.gwt",
"javax.validation"
] | com.google.gwt; javax.validation; | 4,730 |
public static List<Task> getAllocatedTask() {
ConnectionSource conn = SqlServerConnection.acquireConnection();
List<Task> tasks= new ArrayList<>();
if (conn != null) {
try {
Dao<Task, Integer> taskDao = DaoManager.createDao(conn, Task.class);
GenericRawResults<String[]> rawResults = taskDao.queryRaw(QUERY_ALLOCATED_TASKS);
List<String[]> results = rawResults.getResults();
System.out.println("rawResults: "+ results.size());
results.forEach(arrayOfString-> tasks.add(getTask(arrayOfString[0])));
rawResults.close();
} catch (IOException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
}
if (tasks!= null) {
return tasks;
}
}
return null;
} | static List<Task> function() { ConnectionSource conn = SqlServerConnection.acquireConnection(); List<Task> tasks= new ArrayList<>(); if (conn != null) { try { Dao<Task, Integer> taskDao = DaoManager.createDao(conn, Task.class); GenericRawResults<String[]> rawResults = taskDao.queryRaw(QUERY_ALLOCATED_TASKS); List<String[]> results = rawResults.getResults(); System.out.println(STR+ results.size()); results.forEach(arrayOfString-> tasks.add(getTask(arrayOfString[0]))); rawResults.close(); } catch (IOException e) { e.printStackTrace(); } catch (SQLException e) { e.printStackTrace(); } if (tasks!= null) { return tasks; } } return null; } | /**
* Gets all the allocated {@link Task} objects in the database.
*
* @return a list of <code>Task</code> objects
*/ | Gets all the allocated <code>Task</code> objects in the database | getAllocatedTask | {
"repo_name": "AinurMakhmet/allsys-standalone",
"path": "src/main/java/entity_utils/TaskUtils.java",
"license": "apache-2.0",
"size": 3832
} | [
"com.j256.ormlite.dao.Dao",
"com.j256.ormlite.dao.DaoManager",
"com.j256.ormlite.dao.GenericRawResults",
"com.j256.ormlite.support.ConnectionSource",
"java.io.IOException",
"java.sql.SQLException",
"java.util.ArrayList",
"java.util.List"
] | import com.j256.ormlite.dao.Dao; import com.j256.ormlite.dao.DaoManager; import com.j256.ormlite.dao.GenericRawResults; import com.j256.ormlite.support.ConnectionSource; import java.io.IOException; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; | import com.j256.ormlite.dao.*; import com.j256.ormlite.support.*; import java.io.*; import java.sql.*; import java.util.*; | [
"com.j256.ormlite",
"java.io",
"java.sql",
"java.util"
] | com.j256.ormlite; java.io; java.sql; java.util; | 2,489,953 |
List<Observation> get(final String patientUuid, final String conceptUuid) throws IOException; | List<Observation> get(final String patientUuid, final String conceptUuid) throws IOException; | /**
* Search observations for patient with matching uuid of the question.
*
* @param patientUuid the uuid of the patient.
* @param conceptUuid the uuid of the question of the observations.
* @return all observations for the patient with question matching the search term.
* @throws IOException when search api unable to process the resource.
*/ | Search observations for patient with matching uuid of the question | get | {
"repo_name": "vikaspandeysahaj/muzima-api-1",
"path": "src/main/java/com/muzima/api/dao/ObservationDao.java",
"license": "mpl-2.0",
"size": 1499
} | [
"com.muzima.api.model.Observation",
"java.io.IOException",
"java.util.List"
] | import com.muzima.api.model.Observation; import java.io.IOException; import java.util.List; | import com.muzima.api.model.*; import java.io.*; import java.util.*; | [
"com.muzima.api",
"java.io",
"java.util"
] | com.muzima.api; java.io; java.util; | 378,129 |
public CoreContainer getCoreContainer() {
return coreContainer;
} | CoreContainer function() { return coreContainer; } | /**
* Getter method for the CoreContainer
*
* @return the core container
*/ | Getter method for the CoreContainer | getCoreContainer | {
"repo_name": "apache/solr",
"path": "solr/core/src/java/org/apache/solr/client/solrj/embedded/EmbeddedSolrServer.java",
"license": "apache-2.0",
"size": 13063
} | [
"org.apache.solr.core.CoreContainer"
] | import org.apache.solr.core.CoreContainer; | import org.apache.solr.core.*; | [
"org.apache.solr"
] | org.apache.solr; | 780,141 |
EOperation getAssistModel__GetAllBoxes(); | EOperation getAssistModel__GetAllBoxes(); | /**
* Returns the meta object for the '{@link ch.hilbri.assist.model.AssistModel#getAllBoxes() <em>Get All Boxes</em>}' operation.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the '<em>Get All Boxes</em>' operation.
* @see ch.hilbri.assist.model.AssistModel#getAllBoxes()
* @generated
*/ | Returns the meta object for the '<code>ch.hilbri.assist.model.AssistModel#getAllBoxes() Get All Boxes</code>' operation. | getAssistModel__GetAllBoxes | {
"repo_name": "RobertHilbrich/assist",
"path": "ch.hilbri.assist.model/src-gen/ch/hilbri/assist/model/ModelPackage.java",
"license": "gpl-2.0",
"size": 419306
} | [
"org.eclipse.emf.ecore.EOperation"
] | import org.eclipse.emf.ecore.EOperation; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 304,086 |
public Font getItemLabelFont() {
return this.itemLabelFont;
} | Font function() { return this.itemLabelFont; } | /**
* Returns the font used for all item labels. This may be
* <code>null</code>, in which case the per series font settings will apply.
*
* @return The font (possibly <code>null</code>).
*/ | Returns the font used for all item labels. This may be <code>null</code>, in which case the per series font settings will apply | getItemLabelFont | {
"repo_name": "raedle/univis",
"path": "lib/jfreechart-1.0.1/src/org/jfree/chart/renderer/AbstractRenderer.java",
"license": "lgpl-2.1",
"size": 97537
} | [
"java.awt.Font"
] | import java.awt.Font; | import java.awt.*; | [
"java.awt"
] | java.awt; | 157,396 |
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<DocumentResultCollection<ExtractKeyPhraseResult>> extractKeyPhrasesWithResponse(
List<String> textInputs, String language, Context context) {
return client.extractKeyPhraseAsyncClient.extractKeyPhrasesWithResponse(textInputs, language, context).block();
} | @ServiceMethod(returns = ReturnType.SINGLE) Response<DocumentResultCollection<ExtractKeyPhraseResult>> function( List<String> textInputs, String language, Context context) { return client.extractKeyPhraseAsyncClient.extractKeyPhrasesWithResponse(textInputs, language, context).block(); } | /**
* Returns a list of strings denoting the key phrases in the input text.
* See <a href="https://aka.ms/talangs"></a> for the list of enabled languages.
*
* @param textInputs A list of text to be analyzed.
* @param language The 2 letter ISO 639-1 representation of language for the text. If not set, uses "en" for
* English as default.
* @param context Additional context that is passed through the Http pipeline during the service call.
*
* @return A {@link Response} containing the {@link DocumentResultCollection batch} of the
* {@link ExtractKeyPhraseResult key phrases}.
* @throws NullPointerException if {@code textInputs} is {@code null}.
*/ | Returns a list of strings denoting the key phrases in the input text. See for the list of enabled languages | extractKeyPhrasesWithResponse | {
"repo_name": "navalev/azure-sdk-for-java",
"path": "sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/TextAnalyticsClient.java",
"license": "mit",
"size": 35653
} | [
"com.azure.ai.textanalytics.models.DocumentResultCollection",
"com.azure.ai.textanalytics.models.ExtractKeyPhraseResult",
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.core.http.rest.Response",
"com.azure.core.util.Context",
"java.util.List"
] | import com.azure.ai.textanalytics.models.DocumentResultCollection; import com.azure.ai.textanalytics.models.ExtractKeyPhraseResult; import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.Response; import com.azure.core.util.Context; import java.util.List; | import com.azure.ai.textanalytics.models.*; import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.util.*; import java.util.*; | [
"com.azure.ai",
"com.azure.core",
"java.util"
] | com.azure.ai; com.azure.core; java.util; | 628,355 |
private State isState(String state) {
if (state.equals("ACTIVE")) {
return VirtualPort.State.ACTIVE;
} else {
return VirtualPort.State.DOWN;
}
} | State function(String state) { if (state.equals(STR)) { return VirtualPort.State.ACTIVE; } else { return VirtualPort.State.DOWN; } } | /**
* Returns VirtualPort State.
*
* @param state the virtualport state
* @return the virtualPort state
*/ | Returns VirtualPort State | isState | {
"repo_name": "sonu283304/onos",
"path": "apps/vtn/vtnweb/src/main/java/org/onosproject/vtnweb/resources/VirtualPortWebResource.java",
"license": "apache-2.0",
"size": 17780
} | [
"org.onosproject.vtnrsc.VirtualPort"
] | import org.onosproject.vtnrsc.VirtualPort; | import org.onosproject.vtnrsc.*; | [
"org.onosproject.vtnrsc"
] | org.onosproject.vtnrsc; | 865,279 |
protected IndexService createIndex(String index, Settings settings) {
return createIndex(index, settings, null, (XContentBuilder) null);
} | IndexService function(String index, Settings settings) { return createIndex(index, settings, null, (XContentBuilder) null); } | /**
* Create a new index on the singleton node with the provided index settings.
*/ | Create a new index on the singleton node with the provided index settings | createIndex | {
"repo_name": "yanjunh/elasticsearch",
"path": "test/framework/src/main/java/org/elasticsearch/test/ESSingleNodeTestCase.java",
"license": "apache-2.0",
"size": 14304
} | [
"org.elasticsearch.common.settings.Settings",
"org.elasticsearch.common.xcontent.XContentBuilder",
"org.elasticsearch.index.IndexService"
] | import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.index.IndexService; | import org.elasticsearch.common.settings.*; import org.elasticsearch.common.xcontent.*; import org.elasticsearch.index.*; | [
"org.elasticsearch.common",
"org.elasticsearch.index"
] | org.elasticsearch.common; org.elasticsearch.index; | 686,454 |
private void assertOutOfScopeLink(String link, String target, String expectedPath,
TestDelegator d) throws IOException {
Path l = testFS.getPath(SCOPE_ROOT.getRelative(link));
testFS.createSymbolicLink(l, new PathFragment(target));
l.exists();
assertEquals(expectedPath, d.lastPath().getPathString());
} | void function(String link, String target, String expectedPath, TestDelegator d) throws IOException { Path l = testFS.getPath(SCOPE_ROOT.getRelative(link)); testFS.createSymbolicLink(l, new PathFragment(target)); l.exists(); assertEquals(expectedPath, d.lastPath().getPathString()); } | /**
* Asserts that "link" is an out-of-scope link and that the re-delegated path
* matches expectedPath. If link is relative, its path is relative to SCOPE_ROOT.
*/ | Asserts that "link" is an out-of-scope link and that the re-delegated path matches expectedPath. If link is relative, its path is relative to SCOPE_ROOT | assertOutOfScopeLink | {
"repo_name": "abergmeier-dsfishlabs/bazel",
"path": "src/test/java/com/google/devtools/build/lib/vfs/ScopeEscapableFileSystemTest.java",
"license": "apache-2.0",
"size": 33018
} | [
"java.io.IOException",
"org.junit.Assert"
] | import java.io.IOException; import org.junit.Assert; | import java.io.*; import org.junit.*; | [
"java.io",
"org.junit"
] | java.io; org.junit; | 2,410,780 |
private PrinterData getPrinterData(final String type){
String cfgPrefix = "Drucker/" + type + "/"; //$NON-NLS-1$ //$NON-NLS-2$ $NON-NLS-2$
PrinterData pd = null;
String printer = CoreHub.localCfg.get(cfgPrefix + "Name", null); //$NON-NLS-1$
String driver = CoreHub.localCfg.get(cfgPrefix + "Driver", null); //$NON-NLS-1$
boolean choose = CoreHub.localCfg.get(cfgPrefix + "Choose", false); //$NON-NLS-1$
if (choose || StringTool.isNothing(printer) || StringTool.isNothing(driver)) {
Shell shell = UiDesk.getTopShell();
PrintDialog pdlg = new PrintDialog(shell);
pd = pdlg.open();
} else {
pd = new PrinterData(driver, printer);
}
return pd;
}
| PrinterData function(final String type){ String cfgPrefix = STR + type + "/"; PrinterData pd = null; String printer = CoreHub.localCfg.get(cfgPrefix + "Name", null); String driver = CoreHub.localCfg.get(cfgPrefix + STR, null); boolean choose = CoreHub.localCfg.get(cfgPrefix + STR, false); if (choose StringTool.isNothing(printer) StringTool.isNothing(driver)) { Shell shell = UiDesk.getTopShell(); PrintDialog pdlg = new PrintDialog(shell); pd = pdlg.open(); } else { pd = new PrinterData(driver, printer); } return pd; } | /**
* Return a PrinterData object according to the given type (e. g. "Etiketten") and the user
* settings. Shows a printer selection dialog if required.
*
* @param type
* the printer type according to the printer settings
* @return a PrinterData object describing the selected printer
*/ | Return a PrinterData object according to the given type (e. g. "Etiketten") and the user settings. Shows a printer selection dialog if required | getPrinterData | {
"repo_name": "sazgin/elexis-3-core",
"path": "ch.elexis.core.ui/src/ch/elexis/core/ui/actions/GlobalActions.java",
"license": "epl-1.0",
"size": 35968
} | [
"ch.elexis.core.data.activator.CoreHub",
"ch.elexis.core.ui.UiDesk",
"ch.rgw.tools.StringTool",
"org.eclipse.swt.printing.PrintDialog",
"org.eclipse.swt.printing.PrinterData",
"org.eclipse.swt.widgets.Shell"
] | import ch.elexis.core.data.activator.CoreHub; import ch.elexis.core.ui.UiDesk; import ch.rgw.tools.StringTool; import org.eclipse.swt.printing.PrintDialog; import org.eclipse.swt.printing.PrinterData; import org.eclipse.swt.widgets.Shell; | import ch.elexis.core.data.activator.*; import ch.elexis.core.ui.*; import ch.rgw.tools.*; import org.eclipse.swt.printing.*; import org.eclipse.swt.widgets.*; | [
"ch.elexis.core",
"ch.rgw.tools",
"org.eclipse.swt"
] | ch.elexis.core; ch.rgw.tools; org.eclipse.swt; | 1,155,260 |
void setGames(final ArrayList<Game> newGames)
{
//noinspection AssignmentToCollectionOrArrayFieldFromParameter
this.games = newGames;
} | void setGames(final ArrayList<Game> newGames) { this.games = newGames; } | /**
* Setter for the list of games
*
* @param newGames The list of games to replace the currently stored games
*/ | Setter for the list of games | setGames | {
"repo_name": "bigtobster/pgn-extract-alt",
"path": "src/main/java/com/bigtobster/pgnextractalt/chess/ChessContext.java",
"license": "gpl-3.0",
"size": 7524
} | [
"java.util.ArrayList"
] | import java.util.ArrayList; | import java.util.*; | [
"java.util"
] | java.util; | 1,860,090 |
@SuppressFBWarnings("EI_EXPOSE_REP")
public Comparable[] getComponents() {
return components;
} | @SuppressFBWarnings(STR) Comparable[] function() { return components; } | /**
* Returns the components of this composite value.
* <p>
* For performance reasons, the internal components array is directly
* exposed to the caller.
*/ | Returns the components of this composite value. For performance reasons, the internal components array is directly exposed to the caller | getComponents | {
"repo_name": "mdogan/hazelcast",
"path": "hazelcast/src/main/java/com/hazelcast/query/impl/CompositeValue.java",
"license": "apache-2.0",
"size": 9883
} | [
"edu.umd.cs.findbugs.annotations.SuppressFBWarnings"
] | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; | import edu.umd.cs.findbugs.annotations.*; | [
"edu.umd.cs"
] | edu.umd.cs; | 1,972,124 |
void queryCdmaRoamingPreference(Message response); | void queryCdmaRoamingPreference(Message response); | /**
* Query the CDMA roaming preference setting
*
* @param response is callback message to report one of CDMA_RM_*
*/ | Query the CDMA roaming preference setting | queryCdmaRoamingPreference | {
"repo_name": "rex-xxx/mt6572_x201",
"path": "frameworks/opt/telephony/src/java/com/android/internal/telephony/Phone.java",
"license": "gpl-2.0",
"size": 87022
} | [
"android.os.Message"
] | import android.os.Message; | import android.os.*; | [
"android.os"
] | android.os; | 1,805,957 |
public boolean invokeFunction(String funcName, Object[] params) {
// Run script if it is dirty. This makes sure the script is run
// on the same thread as the caller (suppose the caller is always
// calling from the same thread).
checkDirty();
// Skip bad functions
if (isBadFunction(funcName)) {
return false;
}
String statement = getInvokeStatementCached(funcName, params);
Bindings localBindings = null;
synchronized (mEngineLock) {
localBindings = mLocalEngine.getBindings(ScriptContext.ENGINE_SCOPE);
if (localBindings == null) {
localBindings = mLocalEngine.createBindings();
mLocalEngine.setBindings(localBindings, ScriptContext.ENGINE_SCOPE);
}
}
fillBindings(localBindings, params);
try {
mLocalEngine.eval(statement);
} catch (ScriptException e) {
// The function is either undefined or throws, avoid invoking it later
addBadFunction(funcName);
mLastError = e.getMessage();
return false;
} finally {
removeBindings(localBindings, params);
}
return true;
} | boolean function(String funcName, Object[] params) { checkDirty(); if (isBadFunction(funcName)) { return false; } String statement = getInvokeStatementCached(funcName, params); Bindings localBindings = null; synchronized (mEngineLock) { localBindings = mLocalEngine.getBindings(ScriptContext.ENGINE_SCOPE); if (localBindings == null) { localBindings = mLocalEngine.createBindings(); mLocalEngine.setBindings(localBindings, ScriptContext.ENGINE_SCOPE); } } fillBindings(localBindings, params); try { mLocalEngine.eval(statement); } catch (ScriptException e) { addBadFunction(funcName); mLastError = e.getMessage(); return false; } finally { removeBindings(localBindings, params); } return true; } | /**
* Invokes a function defined in the script.
*
* @param funcName
* The function name.
* @param params
* The parameter array.
* @return
* A boolean value representing whether the function is
* executed correctly. If the function cannot be found, or
* parameters don't match, {@code false} is returned.
*/ | Invokes a function defined in the script | invokeFunction | {
"repo_name": "rahul27/GearVRf",
"path": "GVRf/Framework/framework/src/main/java/org/gearvrf/script/GVRScriptFile.java",
"license": "apache-2.0",
"size": 9141
} | [
"javax.script.Bindings",
"javax.script.ScriptContext",
"javax.script.ScriptException"
] | import javax.script.Bindings; import javax.script.ScriptContext; import javax.script.ScriptException; | import javax.script.*; | [
"javax.script"
] | javax.script; | 1,600,866 |
public static String[] scanForLocationInImageBoth(byte[] data) {
String[] results = { EmptyString, EmptyString };
try {
BufferedInputStream is = new BufferedInputStream(new ByteArrayInputStream(data, 0, data.length));
Metadata md = ImageMetadataReader.readMetadata(is);
String[] tmp = { EmptyString, EmptyString };
tmp = scanForLocation(md);
results = scanForPrivacy(md);
if (tmp[0].length() > 0) {
// minor formatting if we have both.
results[0] = tmp[0] + "" + results[0];
results[1] = "<ul>" + tmp[1] + results[1] + "</ul>";
// AGAIN: this is for extreme debugging
// results[0] = "DBG: " + t[0] + "\n\n" + results[0];
// results[1] = "DBG: " + t[1] + "\n\n" + results[1];
}
} catch (ImageProcessingException e) {
// bad image, just ignore processing exceptions
// DEBUG: return new String("ImageProcessingException " + e.toString());
} catch (IOException e) {
// bad file or something, just ignore
// DEBUG: return new String("IOException " + e.toString());
}
return results;
} | static String[] function(byte[] data) { String[] results = { EmptyString, EmptyString }; try { BufferedInputStream is = new BufferedInputStream(new ByteArrayInputStream(data, 0, data.length)); Metadata md = ImageMetadataReader.readMetadata(is); String[] tmp = { EmptyString, EmptyString }; tmp = scanForLocation(md); results = scanForPrivacy(md); if (tmp[0].length() > 0) { results[0] = tmp[0] + STR<ul>STR</ul>"; } } catch (ImageProcessingException e) { } catch (IOException e) { } return results; } | /** Tests a data blob for Location or GPS information and returns the image location
* information as a string. If no location is present or there is an error,
* the function will return an empty string of "".
*
* @param data is a byte array that is an image file to test, such as entire jpeg file.
* @return String containing the Location data or an empty String indicating no GPS data found.
*/ | Tests a data blob for Location or GPS information and returns the image location information as a string. If no location is present or there is an error, the function will return an empty string of "" | scanForLocationInImageBoth | {
"repo_name": "thc202/zap-extensions",
"path": "addOns/imagelocationscanner/src/main/java/com/veggiespam/imagelocationscanner/ILS.java",
"license": "apache-2.0",
"size": 26863
} | [
"com.drew.imaging.ImageMetadataReader",
"com.drew.imaging.ImageProcessingException",
"com.drew.metadata.Metadata",
"java.io.BufferedInputStream",
"java.io.ByteArrayInputStream",
"java.io.IOException"
] | import com.drew.imaging.ImageMetadataReader; import com.drew.imaging.ImageProcessingException; import com.drew.metadata.Metadata; import java.io.BufferedInputStream; import java.io.ByteArrayInputStream; import java.io.IOException; | import com.drew.imaging.*; import com.drew.metadata.*; import java.io.*; | [
"com.drew.imaging",
"com.drew.metadata",
"java.io"
] | com.drew.imaging; com.drew.metadata; java.io; | 1,352,611 |
EAttribute getMBrickletLCD20x4_DisplayErrors(); | EAttribute getMBrickletLCD20x4_DisplayErrors(); | /**
* Returns the meta object for the attribute '{@link org.openhab.binding.tinkerforge.internal.model.MBrickletLCD20x4#isDisplayErrors <em>Display Errors</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the attribute '<em>Display Errors</em>'.
* @see org.openhab.binding.tinkerforge.internal.model.MBrickletLCD20x4#isDisplayErrors()
* @see #getMBrickletLCD20x4()
* @generated
*/ | Returns the meta object for the attribute '<code>org.openhab.binding.tinkerforge.internal.model.MBrickletLCD20x4#isDisplayErrors Display Errors</code>'. | getMBrickletLCD20x4_DisplayErrors | {
"repo_name": "noushadali/openhab",
"path": "bundles/binding/org.openhab.binding.tinkerforge/src/main/java/org/openhab/binding/tinkerforge/internal/model/ModelPackage.java",
"license": "gpl-3.0",
"size": 247420
} | [
"org.eclipse.emf.ecore.EAttribute"
] | import org.eclipse.emf.ecore.EAttribute; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 2,609,369 |
public static void close(Closeable closeable) {
close(closeable, null, LOG);
} | static void function(Closeable closeable) { close(closeable, null, LOG); } | /**
* Closes the given resource if it is available.
*
* @param closeable the object to close
*/ | Closes the given resource if it is available | close | {
"repo_name": "MeiSheng/aries",
"path": "blueprint/blueprint-cm/src/test/java/org/apache/aries/blueprint/compendium/cm/Helper.java",
"license": "apache-2.0",
"size": 31088
} | [
"java.io.Closeable"
] | import java.io.Closeable; | import java.io.*; | [
"java.io"
] | java.io; | 2,567,674 |
public AnalysisFileTree readCachedAnalysisFileTree(String projectId, long runId) {
try {
Path path = createPath(projectId, runId);
if (!fileSystem.exists(path)) {
return null;
}
try (InputStream inputStream = fileSystem.open(path);
ObjectInputStream objectInputStream = new ObjectInputStream(inputStream)) {
return (AnalysisFileTree) objectInputStream.readObject();
}
} catch (IOException | ClassNotFoundException | ClassCastException e) {
logger.warn("Could not read already cached file tree with run_uuid '" + runId + "'.", e);
return null;
}
}
| AnalysisFileTree function(String projectId, long runId) { try { Path path = createPath(projectId, runId); if (!fileSystem.exists(path)) { return null; } try (InputStream inputStream = fileSystem.open(path); ObjectInputStream objectInputStream = new ObjectInputStream(inputStream)) { return (AnalysisFileTree) objectInputStream.readObject(); } } catch (IOException ClassNotFoundException ClassCastException e) { logger.warn(STR + runId + "'.", e); return null; } } | /**
* This method reads the cached {@link AnalysisFileTree} object stored with
* {@link #cacheAnalysisFileTree(String, long, AnalysisFileTree)}.
*
* @param projectId
* is the id of the project.
* @param runId
* is the id of the run.
* @return a {@link AnalysisFileTree} is returned.
*/ | This method reads the cached <code>AnalysisFileTree</code> object stored with <code>#cacheAnalysisFileTree(String, long, AnalysisFileTree)</code> | readCachedAnalysisFileTree | {
"repo_name": "PureSolTechnologies/Purifinity",
"path": "analysis/server/server/core.impl/src/main/java/com/puresoltechnologies/purifinity/server/core/impl/analysis/store/AnalysisStoreCacheUtils.java",
"license": "agpl-3.0",
"size": 4046
} | [
"com.puresoltechnologies.purifinity.analysis.domain.AnalysisFileTree",
"java.io.IOException",
"java.io.InputStream",
"java.io.ObjectInputStream",
"org.apache.hadoop.fs.Path"
] | import com.puresoltechnologies.purifinity.analysis.domain.AnalysisFileTree; import java.io.IOException; import java.io.InputStream; import java.io.ObjectInputStream; import org.apache.hadoop.fs.Path; | import com.puresoltechnologies.purifinity.analysis.domain.*; import java.io.*; import org.apache.hadoop.fs.*; | [
"com.puresoltechnologies.purifinity",
"java.io",
"org.apache.hadoop"
] | com.puresoltechnologies.purifinity; java.io; org.apache.hadoop; | 359,902 |
CardRegistration get(String cardRegistrationId) throws Exception; | CardRegistration get(String cardRegistrationId) throws Exception; | /**
* Gets card registration.
* @param cardRegistrationId Card Registration identifier.
* @return Card registration instance returned from API.
* @throws Exception
*/ | Gets card registration | get | {
"repo_name": "Mangopay/mangopay2-java-sdk",
"path": "src/main/java/com/mangopay/core/APIs/CardRegistrationApi.java",
"license": "mit",
"size": 1386
} | [
"com.mangopay.entities.CardRegistration"
] | import com.mangopay.entities.CardRegistration; | import com.mangopay.entities.*; | [
"com.mangopay.entities"
] | com.mangopay.entities; | 1,431,326 |
public static MultiRequest buildMultiRequest(final byte[] regionName,
final RowMutations rowMutations)
throws IOException {
MultiRequest.Builder builder = getMultiRequestBuilderWithRegionAndAtomicSet(regionName, true);
for (Mutation mutation: rowMutations.getMutations()) {
MutationType mutateType = null;
if (mutation instanceof Put) {
mutateType = MutationType.PUT;
} else if (mutation instanceof Delete) {
mutateType = MutationType.DELETE;
} else {
throw new DoNotRetryIOException("RowMutations supports only put and delete, not " +
mutation.getClass().getName());
}
MutationProto mp = ProtobufUtil.toMutation(mutateType, mutation);
builder.addAction(MultiAction.newBuilder().setMutation(mp).build());
}
return builder.build();
} | static MultiRequest function(final byte[] regionName, final RowMutations rowMutations) throws IOException { MultiRequest.Builder builder = getMultiRequestBuilderWithRegionAndAtomicSet(regionName, true); for (Mutation mutation: rowMutations.getMutations()) { MutationType mutateType = null; if (mutation instanceof Put) { mutateType = MutationType.PUT; } else if (mutation instanceof Delete) { mutateType = MutationType.DELETE; } else { throw new DoNotRetryIOException(STR + mutation.getClass().getName()); } MutationProto mp = ProtobufUtil.toMutation(mutateType, mutation); builder.addAction(MultiAction.newBuilder().setMutation(mp).build()); } return builder.build(); } | /**
* Create a protocol buffer MultiRequest for a row mutations
*
* @param regionName
* @param rowMutations
* @return a multi request
* @throws IOException
*/ | Create a protocol buffer MultiRequest for a row mutations | buildMultiRequest | {
"repo_name": "francisliu/hbase_namespace",
"path": "hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/RequestConverter.java",
"license": "apache-2.0",
"size": 49508
} | [
"java.io.IOException",
"org.apache.hadoop.hbase.client.Delete",
"org.apache.hadoop.hbase.client.Mutation",
"org.apache.hadoop.hbase.client.Put",
"org.apache.hadoop.hbase.client.RowMutations",
"org.apache.hadoop.hbase.exceptions.DoNotRetryIOException",
"org.apache.hadoop.hbase.protobuf.generated.ClientProtos"
] | import java.io.IOException; import org.apache.hadoop.hbase.client.Delete; import org.apache.hadoop.hbase.client.Mutation; import org.apache.hadoop.hbase.client.Put; import org.apache.hadoop.hbase.client.RowMutations; import org.apache.hadoop.hbase.exceptions.DoNotRetryIOException; import org.apache.hadoop.hbase.protobuf.generated.ClientProtos; | import java.io.*; import org.apache.hadoop.hbase.client.*; import org.apache.hadoop.hbase.exceptions.*; import org.apache.hadoop.hbase.protobuf.generated.*; | [
"java.io",
"org.apache.hadoop"
] | java.io; org.apache.hadoop; | 2,589,148 |
@GuardedBy("this")
void evictEntries(ReferenceEntry<K, V> newest) {
if (!map.evictsBySize()) {
return;
}
drainRecencyQueue();
// If the newest entry by itself is too heavy for the segment, don't bother evicting
// anything else, just that
if (newest.getValueReference().getWeight() > maxSegmentWeight) {
if (!removeEntry(newest, newest.getHash(), RemovalCause.SIZE)) {
throw new AssertionError();
}
}
while (totalWeight > maxSegmentWeight) {
ReferenceEntry<K, V> e = getNextEvictable();
if (!removeEntry(e, e.getHash(), RemovalCause.SIZE)) {
throw new AssertionError();
}
}
} | @GuardedBy("this") void evictEntries(ReferenceEntry<K, V> newest) { if (!map.evictsBySize()) { return; } drainRecencyQueue(); if (newest.getValueReference().getWeight() > maxSegmentWeight) { if (!removeEntry(newest, newest.getHash(), RemovalCause.SIZE)) { throw new AssertionError(); } } while (totalWeight > maxSegmentWeight) { ReferenceEntry<K, V> e = getNextEvictable(); if (!removeEntry(e, e.getHash(), RemovalCause.SIZE)) { throw new AssertionError(); } } } | /**
* Performs eviction if the segment is over capacity. Avoids flushing the entire cache if the
* newest entry exceeds the maximum weight all on its own.
*
* @param newest the most recently added entry
*/ | Performs eviction if the segment is over capacity. Avoids flushing the entire cache if the newest entry exceeds the maximum weight all on its own | evictEntries | {
"repo_name": "mosoft521/guava",
"path": "android/guava/src/com/google/common/cache/LocalCache.java",
"license": "apache-2.0",
"size": 146176
} | [
"com.google.errorprone.annotations.concurrent.GuardedBy"
] | import com.google.errorprone.annotations.concurrent.GuardedBy; | import com.google.errorprone.annotations.concurrent.*; | [
"com.google.errorprone"
] | com.google.errorprone; | 1,066,689 |
private void alignCloneClass(CloneClass cloneClass) throws ConQATException {
List<List<Clone>> alignedClones = new ArrayList<List<Clone>>();
for (Clone clone : cloneClass.getClones()) {
if (clone.containsGaps()) {
throw new ConQATException(
"This processor can not work with gapped clones!");
}
alignedClones.add(alignClone(clone));
}
if (!checkAlignedClones(alignedClones)) {
unalignedCloneClassesCount += 1;
return;
}
int numAligned = alignedClones.get(0).size();
for (int i = 0; i < numAligned; ++i) {
int length = alignedClones.get(0).get(i).getLengthInUnits();
if (length < minLength) {
continue;
}
CloneClass newCloneClass = new CloneClass(length,
cloneClassIdCounter++);
for (List<Clone> fragments : alignedClones) {
if (length != fragments.get(i).getLengthInUnits()) {
unalignedCloneClassesCount += 1;
return;
}
newCloneClass.add(fragments.get(i));
}
insertCloneClass(newCloneClass);
}
} | void function(CloneClass cloneClass) throws ConQATException { List<List<Clone>> alignedClones = new ArrayList<List<Clone>>(); for (Clone clone : cloneClass.getClones()) { if (clone.containsGaps()) { throw new ConQATException( STR); } alignedClones.add(alignClone(clone)); } if (!checkAlignedClones(alignedClones)) { unalignedCloneClassesCount += 1; return; } int numAligned = alignedClones.get(0).size(); for (int i = 0; i < numAligned; ++i) { int length = alignedClones.get(0).get(i).getLengthInUnits(); if (length < minLength) { continue; } CloneClass newCloneClass = new CloneClass(length, cloneClassIdCounter++); for (List<Clone> fragments : alignedClones) { if (length != fragments.get(i).getLengthInUnits()) { unalignedCloneClassesCount += 1; return; } newCloneClass.add(fragments.get(i)); } insertCloneClass(newCloneClass); } } | /**
* Attempts to align the clone class and stores the result in
* {@link #alignedCloneClasses}. Aligning can result in one or more classes,
* as classes may be split as a result. If the split fragments are too
* small, the clone class is completely omitted.
*/ | Attempts to align the clone class and stores the result in <code>#alignedCloneClasses</code>. Aligning can result in one or more classes, as classes may be split as a result. If the split fragments are too small, the clone class is completely omitted | alignCloneClass | {
"repo_name": "vimaier/conqat",
"path": "org.conqat.engine.code_clones/src/org/conqat/engine/code_clones/result/align/CloneAstAligner.java",
"license": "apache-2.0",
"size": 19027
} | [
"java.util.ArrayList",
"java.util.List",
"org.conqat.engine.code_clones.core.Clone",
"org.conqat.engine.code_clones.core.CloneClass",
"org.conqat.engine.core.core.ConQATException"
] | import java.util.ArrayList; import java.util.List; import org.conqat.engine.code_clones.core.Clone; import org.conqat.engine.code_clones.core.CloneClass; import org.conqat.engine.core.core.ConQATException; | import java.util.*; import org.conqat.engine.code_clones.core.*; import org.conqat.engine.core.core.*; | [
"java.util",
"org.conqat.engine"
] | java.util; org.conqat.engine; | 2,584,807 |
public void testFilter_1_1() throws Exception {
getLogger().debug("testFilter_1_1");
Parameters parameters = new Parameters();
parameters.setParameter( "element-name", "leaf" );
parameters.setParameter( "count", "1" );
parameters.setParameter( "blocknr", "1" );
String input = "resource://org/apache/cocoon/transformation/filter-input.xml";
String result = "resource://org/apache/cocoon/transformation/filter-result-1-1.xml";
String src = null;
assertEqual(load(result), transform("filter", src, parameters, load(input)));
} | void function() throws Exception { getLogger().debug(STR); Parameters parameters = new Parameters(); parameters.setParameter( STR, "leaf" ); parameters.setParameter( "count", "1" ); parameters.setParameter( STR, "1" ); String input = STRresource: String src = null; assertEqual(load(result), transform(STR, src, parameters, load(input))); } | /**
* Testcase for count=1, blocknr=1
*/ | Testcase for count=1, blocknr=1 | testFilter_1_1 | {
"repo_name": "apache/cocoon",
"path": "core/cocoon-core/src/test/java/org/apache/cocoon/transformation/FilterTransformerTestCase.java",
"license": "apache-2.0",
"size": 3492
} | [
"org.apache.avalon.framework.parameters.Parameters"
] | import org.apache.avalon.framework.parameters.Parameters; | import org.apache.avalon.framework.parameters.*; | [
"org.apache.avalon"
] | org.apache.avalon; | 2,168,506 |
private static float[] getHSBArray(int rgb) {
int[] rgbArr = getRGBArray(rgb);
return Color.RGBtoHSB(rgbArr[RED], rgbArr[GREEN], rgbArr[BLUE], null);
}
| static float[] function(int rgb) { int[] rgbArr = getRGBArray(rgb); return Color.RGBtoHSB(rgbArr[RED], rgbArr[GREEN], rgbArr[BLUE], null); } | /**
* Gets the HSB array.
*
* @param rgb
* the rgb
* @return the HSB array
*/ | Gets the HSB array | getHSBArray | {
"repo_name": "synergynet/synergynet2.5",
"path": "synergynet2.5/src/main/java/apps/mtdesktop/tabletop/mouse/ColorChanger.java",
"license": "bsd-3-clause",
"size": 3173
} | [
"java.awt.Color"
] | import java.awt.Color; | import java.awt.*; | [
"java.awt"
] | java.awt; | 282,715 |
@Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
mUiSettings = mMap.getUiSettings();
Intent intent = getIntent();
LatLng start_location = intent.getParcelableExtra("start");
LatLng end_location = intent.getParcelableExtra("end");
//Adding both start and end marker on map, then will draw route on map
currentMarker = mMap.addMarker(new MarkerOptions()
.position(start_location));
currentMarker.setVisible(false);
try {
Geocoder geoCoder = new Geocoder(context);
List<Address> matches = geoCoder.getFromLocation(start_location.latitude, start_location.longitude, 1);
String address = "";
if(!matches.isEmpty()){
address = matches.get(0).getAddressLine(0) + ' ' + matches.get(0).getLocality();
}
currentMarker.setTitle(address);
currentMarker.showInfoWindow();
} catch (IOException e) {
e.printStackTrace();
}
String startaddress = getString(R.string.start_location) + ": " + currentMarker.getTitle();
tripStartMarker = mMap.addMarker(new MarkerOptions()
.position(start_location)
.title(startaddress)
.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_BLUE)));
try {
Geocoder geoCoder = new Geocoder(context);
List<Address> matches = geoCoder.getFromLocation(end_location.latitude, end_location.longitude, 1);
String address = "";
if(!matches.isEmpty()){
address = matches.get(0).getAddressLine(0) + ' ' + matches.get(0).getLocality();
}
currentMarker.setTitle(address);
currentMarker.showInfoWindow();
} catch (IOException e) {
e.printStackTrace();
}
//the marker will showa actual human readble address
String endaddress = getString(R.string.end_location) + ": " + currentMarker.getTitle();
tripEndMarker = mMap.addMarker(new MarkerOptions()
.position(end_location)
.title(endaddress)
.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_RED)));
mMap.animateCamera(CameraUpdateFactory.zoomIn());
mMap.setMapType(GoogleMap.MAP_TYPE_HYBRID);
mUiSettings.setZoomControlsEnabled(true);
mUiSettings.setCompassEnabled(true);
mUiSettings.setTiltGesturesEnabled(true);
mMap.getUiSettings().setMapToolbarEnabled(true);
CameraPosition cameraPosition = new CameraPosition.Builder()
.target(start_location) // Sets the center of the map to location user
.zoom(12)
.bearing(0)
.tilt(0)
.build();
//ensure that gps location of current user is on
ensureLocationPermissions();
mMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
JSONMaps helper = new JSONMaps((MapsActivity) context);
helper.drawPathCoordinates(tripStartMarker, tripEndMarker);
} | void function(GoogleMap googleMap) { mMap = googleMap; mUiSettings = mMap.getUiSettings(); Intent intent = getIntent(); LatLng start_location = intent.getParcelableExtra("start"); LatLng end_location = intent.getParcelableExtra("end"); currentMarker = mMap.addMarker(new MarkerOptions() .position(start_location)); currentMarker.setVisible(false); try { Geocoder geoCoder = new Geocoder(context); List<Address> matches = geoCoder.getFromLocation(start_location.latitude, start_location.longitude, 1); String address = STR: STRSTR: " + currentMarker.getTitle(); tripEndMarker = mMap.addMarker(new MarkerOptions() .position(end_location) .title(endaddress) .icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_RED))); mMap.animateCamera(CameraUpdateFactory.zoomIn()); mMap.setMapType(GoogleMap.MAP_TYPE_HYBRID); mUiSettings.setZoomControlsEnabled(true); mUiSettings.setCompassEnabled(true); mUiSettings.setTiltGesturesEnabled(true); mMap.getUiSettings().setMapToolbarEnabled(true); CameraPosition cameraPosition = new CameraPosition.Builder() .target(start_location) .zoom(12) .bearing(0) .tilt(0) .build(); ensureLocationPermissions(); mMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition)); JSONMaps helper = new JSONMaps((MapsActivity) context); helper.drawPathCoordinates(tripStartMarker, tripEndMarker); } | /**
* initialize map to edmonton by default
* start and end location is passed in from user click on list items
*/ | initialize map to edmonton by default start and end location is passed in from user click on list items | onMapReady | {
"repo_name": "erichsueh/CMPUT301F16T03-D01",
"path": "app/src/main/java/com/example/ehsueh/appygolucky/MapsActivity.java",
"license": "gpl-3.0",
"size": 6661
} | [
"android.content.Intent",
"android.location.Address",
"android.location.Geocoder",
"com.google.android.gms.maps.CameraUpdateFactory",
"com.google.android.gms.maps.GoogleMap",
"com.google.android.gms.maps.model.BitmapDescriptorFactory",
"com.google.android.gms.maps.model.CameraPosition",
"com.google.android.gms.maps.model.LatLng",
"com.google.android.gms.maps.model.MarkerOptions",
"java.util.List"
] | import android.content.Intent; import android.location.Address; import android.location.Geocoder; import com.google.android.gms.maps.CameraUpdateFactory; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.model.BitmapDescriptorFactory; import com.google.android.gms.maps.model.CameraPosition; import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.MarkerOptions; import java.util.List; | import android.content.*; import android.location.*; import com.google.android.gms.maps.*; import com.google.android.gms.maps.model.*; import java.util.*; | [
"android.content",
"android.location",
"com.google.android",
"java.util"
] | android.content; android.location; com.google.android; java.util; | 2,252,009 |
@SuppressWarnings("unchecked")
@Test
public void testAsErrorWithOkButErrorMessageNotNull() {
final List<Document> docs = Collections.singletonList(BuilderFactory
.start().addInteger("ok", 1).add("err", "This is an error")
.build());
final Reply reply = new Reply(0, 0, 0, docs, false, false, false, true);
final Callback<Integer> mockCallback = createMock(Callback.class);
replay(mockCallback);
final ReplyIntegerCallback callback = new ReplyIntegerCallback(
mockCallback);
final ReplyException error = (ReplyException) callback.asError(reply,
true);
assertEquals("This is an error", error.getMessage());
verify(mockCallback);
} | @SuppressWarnings(STR) void function() { final List<Document> docs = Collections.singletonList(BuilderFactory .start().addInteger("ok", 1).add("err", STR) .build()); final Reply reply = new Reply(0, 0, 0, docs, false, false, false, true); final Callback<Integer> mockCallback = createMock(Callback.class); replay(mockCallback); final ReplyIntegerCallback callback = new ReplyIntegerCallback( mockCallback); final ReplyException error = (ReplyException) callback.asError(reply, true); assertEquals(STR, error.getMessage()); verify(mockCallback); } | /**
* Test method for {@link AbstractReplyCallback#asError(Reply)} .
*/ | Test method for <code>AbstractReplyCallback#asError(Reply)</code> | testAsErrorWithOkButErrorMessageNotNull | {
"repo_name": "allanbank/mongodb-async-driver",
"path": "src/test/java/com/allanbank/mongodb/client/callback/AbstractReplyCallbackTest.java",
"license": "apache-2.0",
"size": 23069
} | [
"com.allanbank.mongodb.Callback",
"com.allanbank.mongodb.bson.Document",
"com.allanbank.mongodb.bson.builder.BuilderFactory",
"com.allanbank.mongodb.client.message.Reply",
"com.allanbank.mongodb.error.ReplyException",
"java.util.Collections",
"java.util.List",
"org.easymock.EasyMock",
"org.junit.Assert"
] | import com.allanbank.mongodb.Callback; import com.allanbank.mongodb.bson.Document; import com.allanbank.mongodb.bson.builder.BuilderFactory; import com.allanbank.mongodb.client.message.Reply; import com.allanbank.mongodb.error.ReplyException; import java.util.Collections; import java.util.List; import org.easymock.EasyMock; import org.junit.Assert; | import com.allanbank.mongodb.*; import com.allanbank.mongodb.bson.*; import com.allanbank.mongodb.bson.builder.*; import com.allanbank.mongodb.client.message.*; import com.allanbank.mongodb.error.*; import java.util.*; import org.easymock.*; import org.junit.*; | [
"com.allanbank.mongodb",
"java.util",
"org.easymock",
"org.junit"
] | com.allanbank.mongodb; java.util; org.easymock; org.junit; | 680,497 |
public static ByteBuffer createByteBuffer(ByteBuffer buf, int size) {
if (buf != null && buf.limit() == size) {
buf.rewind();
return buf;
}
buf = createByteBuffer(size);
return buf;
}
| static ByteBuffer function(ByteBuffer buf, int size) { if (buf != null && buf.limit() == size) { buf.rewind(); return buf; } buf = createByteBuffer(size); return buf; } | /**
* Create a new ByteBuffer of an appropriate size to hold the specified
* number of ints only if the given buffer if not already the right size.
*
* @param buf the buffer to first check and rewind
* @param size number of bytes that need to be held by the newly created
* buffer
*
* @return the requested new IntBuffer
*/ | Create a new ByteBuffer of an appropriate size to hold the specified number of ints only if the given buffer if not already the right size | createByteBuffer | {
"repo_name": "nppotdar/touchtable-menu",
"path": "src/org/mt4j/util/math/ToolsBuffers.java",
"license": "gpl-2.0",
"size": 16305
} | [
"java.nio.ByteBuffer"
] | import java.nio.ByteBuffer; | import java.nio.*; | [
"java.nio"
] | java.nio; | 2,004,963 |
public Value callMethod(Env env,
QuercusClass qClass,
Value qThis)
{
return callMethod(env, qClass, qThis, NULL_ARG_VALUES);
} | Value function(Env env, QuercusClass qClass, Value qThis) { return callMethod(env, qClass, qThis, NULL_ARG_VALUES); } | /**
* Evaluates the function as a method call.
*/ | Evaluates the function as a method call | callMethod | {
"repo_name": "christianchristensen/resin",
"path": "modules/quercus/src/com/caucho/quercus/function/AbstractFunction.java",
"license": "gpl-2.0",
"size": 16953
} | [
"com.caucho.quercus.env.Env",
"com.caucho.quercus.env.QuercusClass",
"com.caucho.quercus.env.Value"
] | import com.caucho.quercus.env.Env; import com.caucho.quercus.env.QuercusClass; import com.caucho.quercus.env.Value; | import com.caucho.quercus.env.*; | [
"com.caucho.quercus"
] | com.caucho.quercus; | 2,129,457 |
int deleteDataValueAuditByPeriod( Period period );
| int deleteDataValueAuditByPeriod( Period period ); | /**
* Deletes all DataValueAudits for the given Period.
*
* @param period the Period for which the DataValueAudits should be deleted.
* @return the number of deleted DataValueAudits.
*/ | Deletes all DataValueAudits for the given Period | deleteDataValueAuditByPeriod | {
"repo_name": "steffeli/inf5750-tracker-capture",
"path": "dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValueAuditService.java",
"license": "bsd-3-clause",
"size": 5048
} | [
"org.hisp.dhis.period.Period"
] | import org.hisp.dhis.period.Period; | import org.hisp.dhis.period.*; | [
"org.hisp.dhis"
] | org.hisp.dhis; | 1,338,120 |
protected void addOnErrorPropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_MediatorSequence_onError_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_MediatorSequence_onError_feature", "_UI_MediatorSequence_type"),
EsbPackage.Literals.MEDIATOR_SEQUENCE__ON_ERROR,
true,
false,
true,
null,
null,
null));
} | void function(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString(STR), getString(STR, STR, STR), EsbPackage.Literals.MEDIATOR_SEQUENCE__ON_ERROR, true, false, true, null, null, null)); } | /**
* This adds a property descriptor for the On Error feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | This adds a property descriptor for the On Error feature. | addOnErrorPropertyDescriptor | {
"repo_name": "sohaniwso2/devstudio-tooling-esb",
"path": "plugins/org.wso2.developerstudio.eclipse.gmf.esb.edit/src/org/wso2/developerstudio/eclipse/gmf/esb/provider/MediatorSequenceItemProvider.java",
"license": "apache-2.0",
"size": 7386
} | [
"org.eclipse.emf.edit.provider.ComposeableAdapterFactory",
"org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage"
] | import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; import org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage; | import org.eclipse.emf.edit.provider.*; import org.wso2.developerstudio.eclipse.gmf.esb.*; | [
"org.eclipse.emf",
"org.wso2.developerstudio"
] | org.eclipse.emf; org.wso2.developerstudio; | 662,875 |
@Contribute(SymbolSource.class)
public void contributePropertiesFileAsSymbols(final OrderedConfiguration<SymbolProvider> configuration) {
configuration.add("MitieConfiguration", new ClasspathResourceSymbolProvider("mitie.properties"),
"after:SystemProperties", "before:ApplicationDefaults");
} | @Contribute(SymbolSource.class) void function(final OrderedConfiguration<SymbolProvider> configuration) { configuration.add(STR, new ClasspathResourceSymbolProvider(STR), STR, STR); } | /**
* Tell Tapestry to look for an MITIE properties file in the WEB-INF/classes
* folder of the war.
*
* @param configuration
*/ | Tell Tapestry to look for an MITIE properties file in the WEB-INF/classes folder of the war | contributePropertiesFileAsSymbols | {
"repo_name": "danieljue/graphene",
"path": "graphene-parent/graphene-augment/graphene-augment-mitie/src/main/java/graphene/augment/mitie/web/services/MITIEMod.java",
"license": "apache-2.0",
"size": 3083
} | [
"org.apache.tapestry5.ioc.OrderedConfiguration",
"org.apache.tapestry5.ioc.annotations.Contribute",
"org.apache.tapestry5.ioc.internal.services.ClasspathResourceSymbolProvider",
"org.apache.tapestry5.ioc.services.SymbolProvider",
"org.apache.tapestry5.ioc.services.SymbolSource"
] | import org.apache.tapestry5.ioc.OrderedConfiguration; import org.apache.tapestry5.ioc.annotations.Contribute; import org.apache.tapestry5.ioc.internal.services.ClasspathResourceSymbolProvider; import org.apache.tapestry5.ioc.services.SymbolProvider; import org.apache.tapestry5.ioc.services.SymbolSource; | import org.apache.tapestry5.ioc.*; import org.apache.tapestry5.ioc.annotations.*; import org.apache.tapestry5.ioc.internal.services.*; import org.apache.tapestry5.ioc.services.*; | [
"org.apache.tapestry5"
] | org.apache.tapestry5; | 1,199,071 |
public void initialisePool()
{
Properties loginProperties = createLoginProperties();
if (logger.isDebugEnabled())
{
logger.debug("about to create pool with user-id : " + this.getJdbcUser());
}
ConnectionFactory connectionFactory = createConnectionFactory(loginProperties);
PoolableObjectFactory objectFactoryForConnectionPool = getObjectFactoryForConnectionPool(connectionFactory, connectionPool);
connectionPool = new ObjectPoolWithThreadAffinity(objectFactoryForConnectionPool, this.getPoolSize(),
this.getMaxWait(), this.getPoolSize(), this.getInitialSize(), true, false, this.timeBetweenEvictionRunsMillis,
this.minEvictableIdleTimeMillis, this.softMinEvictableIdleTimeMillis);
dataSource = createPoolingDataSource(connectionPool);
if (this.getInitialSize() > 0)
{
try // test connection
{
this.getConnection().close();
}
catch (Exception e)
{
logger.error("Error initializing pool " + this, e);
}
}
}
| void function() { Properties loginProperties = createLoginProperties(); if (logger.isDebugEnabled()) { logger.debug(STR + this.getJdbcUser()); } ConnectionFactory connectionFactory = createConnectionFactory(loginProperties); PoolableObjectFactory objectFactoryForConnectionPool = getObjectFactoryForConnectionPool(connectionFactory, connectionPool); connectionPool = new ObjectPoolWithThreadAffinity(objectFactoryForConnectionPool, this.getPoolSize(), this.getMaxWait(), this.getPoolSize(), this.getInitialSize(), true, false, this.timeBetweenEvictionRunsMillis, this.minEvictableIdleTimeMillis, this.softMinEvictableIdleTimeMillis); dataSource = createPoolingDataSource(connectionPool); if (this.getInitialSize() > 0) { try { this.getConnection().close(); } catch (Exception e) { logger.error(STR + this, e); } } } | /**
* This method must be called after all the connection pool properties have been set.
*/ | This method must be called after all the connection pool properties have been set | initialisePool | {
"repo_name": "goldmansachs/reladomo",
"path": "reladomo/src/main/java/com/gs/fw/common/mithra/connectionmanager/AbstractConnectionManager.java",
"license": "apache-2.0",
"size": 22570
} | [
"java.util.Properties"
] | import java.util.Properties; | import java.util.*; | [
"java.util"
] | java.util; | 859,335 |
public void mapSamplesToSphere() {
sphereSamples.ensureCapacity(numSets * numSamples);
for (int j = 0; j < numSamples * numSets; j++) {
double r1 = samples.get(j).x;
double r2 = samples.get(j).y;
double z = 1.0 - 2.0 * r1;
double r = Math.sqrt(1.0 - z * z);
double phi = Utility.TWO_PI * r2;
double x = r * Math.cos(phi);
double y = r * Math.sin(phi);
sphereSamples.add(new Point3D(x, y, z));
}
} | void function() { sphereSamples.ensureCapacity(numSets * numSamples); for (int j = 0; j < numSamples * numSets; j++) { double r1 = samples.get(j).x; double r2 = samples.get(j).y; double z = 1.0 - 2.0 * r1; double r = Math.sqrt(1.0 - z * z); double phi = Utility.TWO_PI * r2; double x = r * Math.cos(phi); double y = r * Math.sin(phi); sphereSamples.add(new Point3D(x, y, z)); } } | /**
* turns this sampler into a sampler for sphere. Deletes original points
* after mapping them to a sphere, typically called by a primitive or camera
* to a sampler that has been passed to it
*/ | turns this sampler into a sampler for sphere. Deletes original points after mapping them to a sphere, typically called by a primitive or camera to a sampler that has been passed to it | mapSamplesToSphere | {
"repo_name": "MatrixPeckham/Ray-Tracer-Ground-Up-Java",
"path": "RayTracer-Core/src/com/matrixpeckham/raytracer/samplers/Sampler.java",
"license": "gpl-2.0",
"size": 13997
} | [
"com.matrixpeckham.raytracer.util.Point3D",
"com.matrixpeckham.raytracer.util.Utility"
] | import com.matrixpeckham.raytracer.util.Point3D; import com.matrixpeckham.raytracer.util.Utility; | import com.matrixpeckham.raytracer.util.*; | [
"com.matrixpeckham.raytracer"
] | com.matrixpeckham.raytracer; | 1,147,815 |
EClass getOCL(); | EClass getOCL(); | /**
* Returns the meta object for class '{@link hsh.swa.ocl.oCL.OCL <em>OCL</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for class '<em>OCL</em>'.
* @see hsh.swa.ocl.oCL.OCL
* @generated
*/ | Returns the meta object for class '<code>hsh.swa.ocl.oCL.OCL OCL</code>'. | getOCL | {
"repo_name": "ordinarygithubuser/pre-post",
"path": "src-gen/hsh/swa/ocl/oCL/OCLPackage.java",
"license": "mit",
"size": 19648
} | [
"org.eclipse.emf.ecore.EClass"
] | import org.eclipse.emf.ecore.EClass; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 175,357 |
public void setLatlist(List<Latlist> latlist) {
this.latlist = latlist;
} | void function(List<Latlist> latlist) { this.latlist = latlist; } | /**
* Sets the latlist.
*
* @param latlist
* The latlist
*/ | Sets the latlist | setLatlist | {
"repo_name": "mikokitty/iMed",
"path": "java-wrapper-master/src/main/java/com/ibm/watson/developer_cloud/question_and_answer/v1/model/WatsonAnswer.java",
"license": "apache-2.0",
"size": 8678
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,276,000 |
private void selectFromBigTab() throws SQLException
{
String selectSQL = "select * from bigtab";
PreparedStatement pSt = prepareStatement(selectSQL);
ResultSet rs = pSt.executeQuery();
int i = 0;
while (rs.next())
{
switch(++i) {
case 1:
case 2:
case 3:
assertNull(rs.getObject(500));
assertNull(rs.getObject(1000));
break;
case 4:
assertEquals(rs.getInt(500), 500);
assertNull(rs.getObject(1000));
break;
case 5:
assertEquals(rs.getInt(500), 500);
assertEquals(rs.getInt(1000), 1000);
break;
default:
fail("Too many rows in bigTab");
}
}
assertEquals(i, 5);
rs.close();
pSt.close();
} | void function() throws SQLException { String selectSQL = STR; PreparedStatement pSt = prepareStatement(selectSQL); ResultSet rs = pSt.executeQuery(); int i = 0; while (rs.next()) { switch(++i) { case 1: case 2: case 3: assertNull(rs.getObject(500)); assertNull(rs.getObject(1000)); break; case 4: assertEquals(rs.getInt(500), 500); assertNull(rs.getObject(1000)); break; case 5: assertEquals(rs.getInt(500), 500); assertEquals(rs.getInt(1000), 1000); break; default: fail(STR); } } assertEquals(i, 5); rs.close(); pSt.close(); } | /**
* Test that the table bigtab contains the expected tuples for the test
* case testBigTable.
*/ | Test that the table bigtab contains the expected tuples for the test case testBigTable | selectFromBigTab | {
"repo_name": "apache/derby",
"path": "java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/tests/derbynet/PrepareStatementTest.java",
"license": "apache-2.0",
"size": 57607
} | [
"java.sql.PreparedStatement",
"java.sql.ResultSet",
"java.sql.SQLException"
] | import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; | import java.sql.*; | [
"java.sql"
] | java.sql; | 1,657,879 |
public XObject execute(
XPathContext xctxt, int currentNode, DTM dtm, int expType)
throws javax.xml.transform.TransformerException
{
if (m_whatToShow == NodeTest.SHOW_BYFUNCTION)
{
if (null != m_relativePathPattern)
{
return m_relativePathPattern.execute(xctxt);
}
else
return NodeTest.SCORE_NONE;
}
XObject score;
score = super.execute(xctxt, currentNode, dtm, expType);
if (score == NodeTest.SCORE_NONE)
return NodeTest.SCORE_NONE;
if (getPredicateCount() != 0)
{
if (!executePredicates(xctxt, dtm, currentNode))
return NodeTest.SCORE_NONE;
}
if (null != m_relativePathPattern)
return m_relativePathPattern.executeRelativePathPattern(xctxt, dtm,
currentNode);
return score;
} | XObject function( XPathContext xctxt, int currentNode, DTM dtm, int expType) throws javax.xml.transform.TransformerException { if (m_whatToShow == NodeTest.SHOW_BYFUNCTION) { if (null != m_relativePathPattern) { return m_relativePathPattern.execute(xctxt); } else return NodeTest.SCORE_NONE; } XObject score; score = super.execute(xctxt, currentNode, dtm, expType); if (score == NodeTest.SCORE_NONE) return NodeTest.SCORE_NONE; if (getPredicateCount() != 0) { if (!executePredicates(xctxt, dtm, currentNode)) return NodeTest.SCORE_NONE; } if (null != m_relativePathPattern) return m_relativePathPattern.executeRelativePathPattern(xctxt, dtm, currentNode); return score; } | /**
* Execute an expression in the XPath runtime context, and return the
* result of the expression.
*
*
* @param xctxt The XPath runtime context.
* @param currentNode The currentNode.
* @param dtm The DTM of the current node.
* @param expType The expanded type ID of the current node.
*
* @return The result of the expression in the form of a <code>XObject</code>.
*
* @throws javax.xml.transform.TransformerException if a runtime exception
* occurs.
*/ | Execute an expression in the XPath runtime context, and return the result of the expression | execute | {
"repo_name": "shun634501730/java_source_cn",
"path": "src_en/com/sun/org/apache/xpath/internal/patterns/StepPattern.java",
"license": "apache-2.0",
"size": 27433
} | [
"com.sun.org.apache.xpath.internal.XPathContext",
"com.sun.org.apache.xpath.internal.objects.XObject"
] | import com.sun.org.apache.xpath.internal.XPathContext; import com.sun.org.apache.xpath.internal.objects.XObject; | import com.sun.org.apache.xpath.internal.*; import com.sun.org.apache.xpath.internal.objects.*; | [
"com.sun.org"
] | com.sun.org; | 911,565 |
public char previous() {
if (getIndex() > begin) {
return aci.previous();
} else {
return CharacterIterator.DONE;
}
} | char function() { if (getIndex() > begin) { return aci.previous(); } else { return CharacterIterator.DONE; } } | /**
* Decrements the iterator's index by one and returns
* the character at the new index.
* <br><b>Specified by:</b> java.text.CharacterIterator.
*/ | Decrements the iterator's index by one and returns the character at the new index. Specified by: java.text.CharacterIterator | previous | {
"repo_name": "shyamalschandra/flex-sdk",
"path": "modules/thirdparty/batik/sources/org/apache/flex/forks/batik/gvt/text/AttributedCharacterSpanIterator.java",
"license": "apache-2.0",
"size": 7509
} | [
"java.text.CharacterIterator"
] | import java.text.CharacterIterator; | import java.text.*; | [
"java.text"
] | java.text; | 2,459,234 |
public Color getColor() {
return color;
} | Color function() { return color; } | /**
* Getter method for text color.
*
* @return Text color. May not be null.
*/ | Getter method for text color | getColor | {
"repo_name": "mindrunner/funCKit",
"path": "workspace/funCKit/src/main/java/de/sep2011/funckit/drawer/LayoutText.java",
"license": "gpl-3.0",
"size": 3312
} | [
"java.awt.Color"
] | import java.awt.Color; | import java.awt.*; | [
"java.awt"
] | java.awt; | 1,885,414 |
public static List<Parameter> getParameters(Method m) {
return new MethodInfo(m);
} | static List<Parameter> function(Method m) { return new MethodInfo(m); } | /**
* Returns an object-oriented view of parameters of each type.
*/ | Returns an object-oriented view of parameters of each type | getParameters | {
"repo_name": "andresrc/jenkins",
"path": "core/src/main/java/hudson/util/ReflectionUtils.java",
"license": "mit",
"size": 7414
} | [
"java.lang.reflect.Method",
"java.util.List"
] | import java.lang.reflect.Method; import java.util.List; | import java.lang.reflect.*; import java.util.*; | [
"java.lang",
"java.util"
] | java.lang; java.util; | 2,121,906 |
public void load(Context context){
String filename = getFilenameForStore();
File toLoad = context.getFileStreamPath(filename);
Uri uri = Uri.fromFile(toLoad);
Dictionary loaded = loadFromUri(uri, true, context);
initWithDictionary(loaded);
} | void function(Context context){ String filename = getFilenameForStore(); File toLoad = context.getFileStreamPath(filename); Uri uri = Uri.fromFile(toLoad); Dictionary loaded = loadFromUri(uri, true, context); initWithDictionary(loaded); } | /**
* Load dictionary from file ointo this dictionary.
* @param context
*/ | Load dictionary from file ointo this dictionary | load | {
"repo_name": "CarstenKarbach/VoBox",
"path": "app/src/main/java/de/karbach/superapp/data/Dictionary.java",
"license": "gpl-2.0",
"size": 20695
} | [
"android.content.Context",
"android.net.Uri",
"java.io.File"
] | import android.content.Context; import android.net.Uri; import java.io.File; | import android.content.*; import android.net.*; import java.io.*; | [
"android.content",
"android.net",
"java.io"
] | android.content; android.net; java.io; | 2,627,007 |
public ServiceCall getArrayValidAsync(final ServiceCallback<List<List<String>>> serviceCallback) throws IllegalArgumentException {
if (serviceCallback == null) {
throw new IllegalArgumentException("ServiceCallback is required for async calls.");
}
| ServiceCall function(final ServiceCallback<List<List<String>>> serviceCallback) throws IllegalArgumentException { if (serviceCallback == null) { throw new IllegalArgumentException(STR); } | /**
* Get an array of array of strings [['1', '2', '3'], ['4', '5', '6'], ['7', '8', '9']].
*
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if callback is null
* @return the {@link Call} object
*/ | Get an array of array of strings [['1', '2', '3'], ['4', '5', '6'], ['7', '8', '9']] | getArrayValidAsync | {
"repo_name": "stankovski/AutoRest",
"path": "AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyarray/ArrayOperationsImpl.java",
"license": "mit",
"size": 167174
} | [
"com.microsoft.rest.ServiceCall",
"com.microsoft.rest.ServiceCallback",
"java.util.List"
] | import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import java.util.List; | import com.microsoft.rest.*; import java.util.*; | [
"com.microsoft.rest",
"java.util"
] | com.microsoft.rest; java.util; | 2,042,009 |
void unpauseExecutingFragments(final DrillbitContext drillbitContext) {
final Controller controller = drillbitContext.getController();
for(final FragmentData data : fragmentDataSet) {
final DrillbitEndpoint endpoint = data.getEndpoint();
final FragmentHandle handle = data.getHandle();
controller.getTunnel(endpoint).unpauseFragment(new SignalListener(endpoint, handle,
SignalListener.Signal.UNPAUSE), handle);
}
}
@Override
public void close() throws Exception { } | void unpauseExecutingFragments(final DrillbitContext drillbitContext) { final Controller controller = drillbitContext.getController(); for(final FragmentData data : fragmentDataSet) { final DrillbitEndpoint endpoint = data.getEndpoint(); final FragmentHandle handle = data.getHandle(); controller.getTunnel(endpoint).unpauseFragment(new SignalListener(endpoint, handle, SignalListener.Signal.UNPAUSE), handle); } } public void close() throws Exception { } | /**
* Sends a resume signal to all fragments, regardless of their state, since the fragment might have paused before
* sending any message. Resume all fragments through the control tunnel.
*/ | Sends a resume signal to all fragments, regardless of their state, since the fragment might have paused before sending any message. Resume all fragments through the control tunnel | unpauseExecutingFragments | {
"repo_name": "ebegoli/drill",
"path": "exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/QueryManager.java",
"license": "apache-2.0",
"size": 21490
} | [
"org.apache.drill.exec.proto.CoordinationProtos",
"org.apache.drill.exec.proto.ExecProtos",
"org.apache.drill.exec.rpc.control.Controller",
"org.apache.drill.exec.server.DrillbitContext"
] | import org.apache.drill.exec.proto.CoordinationProtos; import org.apache.drill.exec.proto.ExecProtos; import org.apache.drill.exec.rpc.control.Controller; import org.apache.drill.exec.server.DrillbitContext; | import org.apache.drill.exec.proto.*; import org.apache.drill.exec.rpc.control.*; import org.apache.drill.exec.server.*; | [
"org.apache.drill"
] | org.apache.drill; | 1,716,813 |
private void drawWorld(int viewX, int viewY, float worldX, float worldY, float worldWidth, float worldHeight) {
World world = simulation.getWorld();
final int width = world.getWidth();
final int height = world.getHeight();
Node[] nodes = world.getNodes();
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
int i = x + width * y;
Node node = nodes[i];
float tileX = x * worldScale;
float tileY = y * worldScale;
//Check if tile is out of view and skip it if so
if (tileX + worldScale < viewX
|| tileY + worldScale < viewY
|| tileX > worldWidth
|| tileY > worldHeight) {
continue;
}
//Put the tiles in destination
tileX += worldX;
tileY += worldY;
//Draw tile
Tile tile = node.getTile();
if (tile != null) {
spriteBatch.draw(
tileDrawable.get(tile),
tileX, tileY,
worldScale, worldScale
);
}
//Draw deposit if any
long deposit = node.getDeposit();
TextureRegion region = null;
if (600 < deposit) {
region = depositDrawable[2];
} else if (300 < deposit) {
region = depositDrawable[1];
} else if (0 < deposit) {
region = depositDrawable[0];
}
if (region != null) {
spriteBatch.draw(
region,
tileX, tileY,
worldScale, worldScale
);
}
}
}
} | void function(int viewX, int viewY, float worldX, float worldY, float worldWidth, float worldHeight) { World world = simulation.getWorld(); final int width = world.getWidth(); final int height = world.getHeight(); Node[] nodes = world.getNodes(); for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { int i = x + width * y; Node node = nodes[i]; float tileX = x * worldScale; float tileY = y * worldScale; if (tileX + worldScale < viewX tileY + worldScale < viewY tileX > worldWidth tileY > worldHeight) { continue; } tileX += worldX; tileY += worldY; Tile tile = node.getTile(); if (tile != null) { spriteBatch.draw( tileDrawable.get(tile), tileX, tileY, worldScale, worldScale ); } long deposit = node.getDeposit(); TextureRegion region = null; if (600 < deposit) { region = depositDrawable[2]; } else if (300 < deposit) { region = depositDrawable[1]; } else if (0 < deposit) { region = depositDrawable[0]; } if (region != null) { spriteBatch.draw( region, tileX, tileY, worldScale, worldScale ); } } } } | /**
* draws the world
*/ | draws the world | drawWorld | {
"repo_name": "IonAgorria/Ouroboros",
"path": "src/com/agorria/ouroboros/context/GameContext.java",
"license": "gpl-3.0",
"size": 106125
} | [
"com.agorria.ouroboros.graphics.TextureRegion",
"com.agorria.ouroboros.simulation.enviroment.Node",
"com.agorria.ouroboros.simulation.enviroment.Tile",
"com.agorria.ouroboros.simulation.enviroment.World"
] | import com.agorria.ouroboros.graphics.TextureRegion; import com.agorria.ouroboros.simulation.enviroment.Node; import com.agorria.ouroboros.simulation.enviroment.Tile; import com.agorria.ouroboros.simulation.enviroment.World; | import com.agorria.ouroboros.graphics.*; import com.agorria.ouroboros.simulation.enviroment.*; | [
"com.agorria.ouroboros"
] | com.agorria.ouroboros; | 1,256,901 |
private void initialize() {
this.setOrder(EXTENSION_ORDER);
this.customParsers = new LinkedList<>();
this.customFetchFilters = new LinkedList<>();
this.customParseFilters = new LinkedList<>();
this.scanController = new SpiderScanController(this);
} | void function() { this.setOrder(EXTENSION_ORDER); this.customParsers = new LinkedList<>(); this.customFetchFilters = new LinkedList<>(); this.customParseFilters = new LinkedList<>(); this.scanController = new SpiderScanController(this); } | /**
* This method initializes this extension.
*/ | This method initializes this extension | initialize | {
"repo_name": "UjuE/zaproxy",
"path": "src/org/zaproxy/zap/extension/spider/ExtensionSpider.java",
"license": "apache-2.0",
"size": 21338
} | [
"java.util.LinkedList"
] | import java.util.LinkedList; | import java.util.*; | [
"java.util"
] | java.util; | 986,278 |
public Builder withR(Quorum r)
{
this.r = r;
return this;
} | Builder function(Quorum r) { this.r = r; return this; } | /**
* Set the r value. Individual requests (or buckets in a bucket type)
* can override this.
*
* @param r the r value as a Quorum.
* @return a reference to this object.
*/ | Set the r value. Individual requests (or buckets in a bucket type) can override this | withR | {
"repo_name": "basho/riak-java-client",
"path": "src/main/java/com/basho/riak/client/core/query/BucketProperties.java",
"license": "apache-2.0",
"size": 32623
} | [
"com.basho.riak.client.api.cap.Quorum"
] | import com.basho.riak.client.api.cap.Quorum; | import com.basho.riak.client.api.cap.*; | [
"com.basho.riak"
] | com.basho.riak; | 1,593,426 |
List<? extends DocTree> getDescription(); | List<? extends DocTree> getDescription(); | /**
* Returns the description of the serial field.
* @return the description of the serial field
*/ | Returns the description of the serial field | getDescription | {
"repo_name": "google/error-prone-javac",
"path": "src/jdk.compiler/share/classes/com/sun/source/doctree/SerialFieldTree.java",
"license": "gpl-2.0",
"size": 1906
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 741,845 |
if (node instanceof FilterAndProjectVerticesNode) {
FilterAndProjectVerticesNode vertexNode = (FilterAndProjectVerticesNode) node;
setCardinality(vertexNode.getEmbeddingMetaData().getVertexVariables().get(0), true);
updateSelectivity(vertexNode.getFilterPredicate());
} else if (node instanceof FilterAndProjectEdgesNode) {
FilterAndProjectEdgesNode edgeNode = (FilterAndProjectEdgesNode) node;
setCardinality(edgeNode.getEmbeddingMetaData().getEdgeVariables().get(0), false);
updateSelectivity(edgeNode.getFilterPredicate());
} else if (node instanceof FilterEmbeddingsNode) {
updateSelectivity(((FilterEmbeddingsNode) node).getFilterPredicate());
}
} | if (node instanceof FilterAndProjectVerticesNode) { FilterAndProjectVerticesNode vertexNode = (FilterAndProjectVerticesNode) node; setCardinality(vertexNode.getEmbeddingMetaData().getVertexVariables().get(0), true); updateSelectivity(vertexNode.getFilterPredicate()); } else if (node instanceof FilterAndProjectEdgesNode) { FilterAndProjectEdgesNode edgeNode = (FilterAndProjectEdgesNode) node; setCardinality(edgeNode.getEmbeddingMetaData().getEdgeVariables().get(0), false); updateSelectivity(edgeNode.getFilterPredicate()); } else if (node instanceof FilterEmbeddingsNode) { updateSelectivity(((FilterEmbeddingsNode) node).getFilterPredicate()); } } | /**
* Updates the selectivity factor according to the given node.
*
* @param node leaf node
*/ | Updates the selectivity factor according to the given node | visit | {
"repo_name": "rostam/gradoop",
"path": "gradoop-flink/src/main/java/org/gradoop/flink/model/impl/operators/matching/single/cypher/planning/estimation/FilterEstimator.java",
"license": "apache-2.0",
"size": 3809
} | [
"org.gradoop.flink.model.impl.operators.matching.single.cypher.planning.queryplan.leaf.FilterAndProjectEdgesNode",
"org.gradoop.flink.model.impl.operators.matching.single.cypher.planning.queryplan.leaf.FilterAndProjectVerticesNode",
"org.gradoop.flink.model.impl.operators.matching.single.cypher.planning.queryplan.unary.FilterEmbeddingsNode"
] | import org.gradoop.flink.model.impl.operators.matching.single.cypher.planning.queryplan.leaf.FilterAndProjectEdgesNode; import org.gradoop.flink.model.impl.operators.matching.single.cypher.planning.queryplan.leaf.FilterAndProjectVerticesNode; import org.gradoop.flink.model.impl.operators.matching.single.cypher.planning.queryplan.unary.FilterEmbeddingsNode; | import org.gradoop.flink.model.impl.operators.matching.single.cypher.planning.queryplan.leaf.*; import org.gradoop.flink.model.impl.operators.matching.single.cypher.planning.queryplan.unary.*; | [
"org.gradoop.flink"
] | org.gradoop.flink; | 822,875 |
public void testGetGcc() {
final CompilerDef compilerDef = (CompilerDef) create();
compilerDef.setClassname("com.github.maven_nar.cpptasks.gcc.GccCCompiler");
final Compiler comp = (Compiler) compilerDef.getProcessor();
assertNotNull(comp);
assertSame(GccCCompiler.getInstance(), comp);
} | void function() { final CompilerDef compilerDef = (CompilerDef) create(); compilerDef.setClassname(STR); final Compiler comp = (Compiler) compilerDef.getProcessor(); assertNotNull(comp); assertSame(GccCCompiler.getInstance(), comp); } | /**
* Tests that setting classname to the Gcc compiler is effective.
*/ | Tests that setting classname to the Gcc compiler is effective | testGetGcc | {
"repo_name": "dugilos/nar-maven-plugin",
"path": "src/test/java/com/github/maven_nar/cpptasks/TestCompilerDef.java",
"license": "apache-2.0",
"size": 12631
} | [
"com.github.maven_nar.cpptasks.compiler.Compiler",
"com.github.maven_nar.cpptasks.gcc.GccCCompiler"
] | import com.github.maven_nar.cpptasks.compiler.Compiler; import com.github.maven_nar.cpptasks.gcc.GccCCompiler; | import com.github.maven_nar.cpptasks.compiler.*; import com.github.maven_nar.cpptasks.gcc.*; | [
"com.github.maven_nar"
] | com.github.maven_nar; | 2,656,935 |
protected void onGetUniqueIdentifierData(EchoObject eoj, short tid, byte esv, EchoProperty property, boolean success) {} | protected void onGetUniqueIdentifierData(EchoObject eoj, short tid, byte esv, EchoProperty property, boolean success) {} | /**
* Stipulated in 2 bytes<br>
* <br>
* See (3) below.<br>
* <br>
* Name : Unique identifier data<br>
* EPC : 0xBF<br>
* Data Type : unsigned short<br>
* Data Size(Byte) : 2<br>
* <br>
* AccessRule<br>
* Announce : undefined<br>
* Set : mandatory<br>
* Get : mandatory<br>
*/ | Stipulated in 2 bytes See (3) below. Name : Unique identifier data EPC : 0xBF Data Type : unsigned short Data Size(Byte) : 2 AccessRule Announce : undefined Set : mandatory Get : mandatory | onSetUniqueIdentifierData | {
"repo_name": "SonyCSL/OpenECHO",
"path": "src/com/sonycsl/echo/eoj/profile/NodeProfile.java",
"license": "gpl-3.0",
"size": 42863
} | [
"com.sonycsl.echo.EchoProperty",
"com.sonycsl.echo.eoj.EchoObject"
] | import com.sonycsl.echo.EchoProperty; import com.sonycsl.echo.eoj.EchoObject; | import com.sonycsl.echo.*; import com.sonycsl.echo.eoj.*; | [
"com.sonycsl.echo"
] | com.sonycsl.echo; | 1,236,207 |
private static SqlReturnTypeInference infer(final ScalarFunction function) {
return opBinding -> getRelDataType(function);
} | static SqlReturnTypeInference function(final ScalarFunction function) { return opBinding -> getRelDataType(function); } | /**
* Gets the SqlReturnTypeInference that can infer the return type from a
* function.
*
* @param function ScalarFunction
* @return SqlReturnTypeInference
*/ | Gets the SqlReturnTypeInference that can infer the return type from a function | infer | {
"repo_name": "datametica/calcite",
"path": "piglet/src/main/java/org/apache/calcite/piglet/PigRelSqlUdfs.java",
"license": "apache-2.0",
"size": 14122
} | [
"org.apache.calcite.schema.ScalarFunction",
"org.apache.calcite.sql.type.SqlReturnTypeInference"
] | import org.apache.calcite.schema.ScalarFunction; import org.apache.calcite.sql.type.SqlReturnTypeInference; | import org.apache.calcite.schema.*; import org.apache.calcite.sql.type.*; | [
"org.apache.calcite"
] | org.apache.calcite; | 1,928,260 |
public void removeSecret(Channel chan) {
setMode("-s");
}
| void function(Channel chan) { setMode("-s"); } | /**
* Removes secret (-s) status from the channel. May require operator
* privileges in the channel
* @param chan The channel to preform the mode change on
*/ | Removes secret (-s) status from the channel. May require operator privileges in the channel | removeSecret | {
"repo_name": "AnyBot/AnyBot-Lib",
"path": "src/org/pircbotx/output/OutputChannel.java",
"license": "gpl-3.0",
"size": 19720
} | [
"org.pircbotx.Channel"
] | import org.pircbotx.Channel; | import org.pircbotx.*; | [
"org.pircbotx"
] | org.pircbotx; | 1,677,446 |
public Connection getNativeConnection(Connection con) throws SQLException {
if (con == null) {
return null;
}
Connection targetCon = DataSourceUtils.getTargetConnection(con);
Connection nativeCon = doGetNativeConnection(targetCon);
if (nativeCon == targetCon) {
// We haven't received a different Connection, so we'll assume that there's
// some additional proxying going on. Let's check whether we get something
// different back from the DatabaseMetaData.getConnection() call.
DatabaseMetaData metaData = targetCon.getMetaData();
// The following check is only really there for mock Connections
// which might not carry a DatabaseMetaData instance.
if (metaData != null) {
Connection metaCon = metaData.getConnection();
if (metaCon != null && metaCon != targetCon) {
// We've received a different Connection there:
// Let's retry the native extraction process with it.
nativeCon = doGetNativeConnection(metaCon);
}
}
}
return nativeCon;
}
| Connection function(Connection con) throws SQLException { if (con == null) { return null; } Connection targetCon = DataSourceUtils.getTargetConnection(con); Connection nativeCon = doGetNativeConnection(targetCon); if (nativeCon == targetCon) { DatabaseMetaData metaData = targetCon.getMetaData(); if (metaData != null) { Connection metaCon = metaData.getConnection(); if (metaCon != null && metaCon != targetCon) { nativeCon = doGetNativeConnection(metaCon); } } } return nativeCon; } | /**
* Check for a ConnectionProxy chain, then delegate to doGetNativeConnection.
* <p>ConnectionProxy is used by Spring's TransactionAwareDataSourceProxy
* and LazyConnectionDataSourceProxy. The target connection behind it is
* typically one from a local connection pool, to be unwrapped by the
* doGetNativeConnection implementation of a concrete subclass.
* @see #doGetNativeConnection
* @see org.springframework.jdbc.datasource.ConnectionProxy
* @see org.springframework.jdbc.datasource.DataSourceUtils#getTargetConnection
* @see org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy
* @see org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy
*/ | Check for a ConnectionProxy chain, then delegate to doGetNativeConnection. ConnectionProxy is used by Spring's TransactionAwareDataSourceProxy and LazyConnectionDataSourceProxy. The target connection behind it is typically one from a local connection pool, to be unwrapped by the doGetNativeConnection implementation of a concrete subclass | getNativeConnection | {
"repo_name": "codeApeFromChina/resource",
"path": "frame_packages/java_libs/spring-2.5.6-src/src/org/springframework/jdbc/support/nativejdbc/NativeJdbcExtractorAdapter.java",
"license": "unlicense",
"size": 6118
} | [
"java.sql.Connection",
"java.sql.DatabaseMetaData",
"java.sql.SQLException",
"org.springframework.jdbc.datasource.DataSourceUtils"
] | import java.sql.Connection; import java.sql.DatabaseMetaData; import java.sql.SQLException; import org.springframework.jdbc.datasource.DataSourceUtils; | import java.sql.*; import org.springframework.jdbc.datasource.*; | [
"java.sql",
"org.springframework.jdbc"
] | java.sql; org.springframework.jdbc; | 1,529,606 |
public Orthrus spawnBabyAnimal(EntityAgeable par1EntityAgeable)
{
Orthrus orthrus = new Orthrus(this.worldObj);
String s = this.getOwnerName();
if (s != null && s.trim().length() > 0)
{
orthrus.setOwner(s);
orthrus.setTamed(true);
}
return orthrus;
}
| Orthrus function(EntityAgeable par1EntityAgeable) { Orthrus orthrus = new Orthrus(this.worldObj); String s = this.getOwnerName(); if (s != null && s.trim().length() > 0) { orthrus.setOwner(s); orthrus.setTamed(true); } return orthrus; } | /**
* This function is used when two same-species animals in 'love mode' breed to generate the new baby animal.
*/ | This function is used when two same-species animals in 'love mode' breed to generate the new baby animal | spawnBabyAnimal | {
"repo_name": "TheBasedRebel/ZoneSeek",
"path": "ZoneSeek/common/entities/Orthrus.java",
"license": "gpl-3.0",
"size": 19262
} | [
"net.minecraft.entity.EntityAgeable"
] | import net.minecraft.entity.EntityAgeable; | import net.minecraft.entity.*; | [
"net.minecraft.entity"
] | net.minecraft.entity; | 2,331,947 |
@Transactional
protected void _setServiceEnabled(boolean enabled) {
synchronized (_serviceManagementRecordService) {
ServiceManagementRecord record = _serviceManagementRecordService.findServiceManagementRecord(Service.SCHEDULING);
if (record == null) {
record = new ServiceManagementRecord(_userService.findAdminUser(), Service.SCHEDULING, enabled);
}
record.setEnabled(enabled);
_serviceManagementRecordService.updateServiceManagementRecord(record);
}
}
//~ Enums ****************************************************************************************************************************************
public enum Property {
SCHEDULER_THREADPOOL_COUNT("service.property.scheduling.quartz.threadPool.threadCount", "10"),
JOBS_BLOCK_SIZE("service.property.scheduling.jobsBlockSize", "100000");
private final String _name;
private final String _defaultValue;
private Property(String name, String defaultValue) {
_name = name;
_defaultValue = defaultValue;
} | void function(boolean enabled) { synchronized (_serviceManagementRecordService) { ServiceManagementRecord record = _serviceManagementRecordService.findServiceManagementRecord(Service.SCHEDULING); if (record == null) { record = new ServiceManagementRecord(_userService.findAdminUser(), Service.SCHEDULING, enabled); } record.setEnabled(enabled); _serviceManagementRecordService.updateServiceManagementRecord(record); } } public enum Property { SCHEDULER_THREADPOOL_COUNT(STR, "10"), JOBS_BLOCK_SIZE(STR, STR); private final String _name; private final String _defaultValue; private Property(String name, String defaultValue) { _name = name; _defaultValue = defaultValue; } | /**
* Enables the scheduling service.
*
* @param enabled True to enable, false to disable.
*/ | Enables the scheduling service | _setServiceEnabled | {
"repo_name": "dilipdevaraj-sfdc/Argus-1",
"path": "ArgusCore/src/main/java/com/salesforce/dva/argus/service/schedule/DistributedDatabaseSchedulingService.java",
"license": "bsd-3-clause",
"size": 21682
} | [
"com.salesforce.dva.argus.entity.ServiceManagementRecord"
] | import com.salesforce.dva.argus.entity.ServiceManagementRecord; | import com.salesforce.dva.argus.entity.*; | [
"com.salesforce.dva"
] | com.salesforce.dva; | 2,512,524 |
List<String> getNames(); | List<String> getNames(); | /**
* The names of all the scalars set for this position.
* For instance 'x' and 'y' for a map or 'Temperature'
* <em>Note to implementers:</em> should never return <code>null</code>
*
* @return name of scalars
*/ | The names of all the scalars set for this position. For instance 'x' and 'y' for a map or 'Temperature' Note to implementers: should never return <code>null</code> | getNames | {
"repo_name": "AnthonyHullDiamond/scanning",
"path": "org.eclipse.scanning.api/src/org/eclipse/scanning/api/points/IPosition.java",
"license": "epl-1.0",
"size": 6692
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 622,624 |
protected BufferedReader open(URL url) throws IOException {
// use HTTP content type to find out the charset.
URLConnection con = ProxyConfiguration.open(url);
if (con == null) { // TODO is this even permitted by URL.openConnection?
throw new IOException(url.toExternalForm());
}
return new BufferedReader(
new InputStreamReader(con.getInputStream(),getCharset(con)));
} | BufferedReader function(URL url) throws IOException { URLConnection con = ProxyConfiguration.open(url); if (con == null) { throw new IOException(url.toExternalForm()); } return new BufferedReader( new InputStreamReader(con.getInputStream(),getCharset(con))); } | /**
* Opens the given URL and reads text content from it.
* This method honors Content-type header.
*/ | Opens the given URL and reads text content from it. This method honors Content-type header | open | {
"repo_name": "rlugojr/jenkins",
"path": "core/src/main/java/hudson/util/FormFieldValidator.java",
"license": "mit",
"size": 24093
} | [
"java.io.BufferedReader",
"java.io.IOException",
"java.io.InputStreamReader",
"java.net.URLConnection"
] | import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.URLConnection; | import java.io.*; import java.net.*; | [
"java.io",
"java.net"
] | java.io; java.net; | 2,512,894 |
public Matrix getScaleSqrt()
{
if( this.scaleSqrt == null )
{
this.scaleSqrt = CholeskyDecompositionMTJ.create(
DenseMatrixFactoryMTJ.INSTANCE.copyMatrix( this.inverseScale.inverse() ) ).getR();
}
return this.scaleSqrt;
}
public static class PDF
extends InverseWishartDistribution
implements ProbabilityDensityFunction<Matrix>
{
public static final double LOG_OF_2 = Math.log(2.0);
public PDF()
{
super();
}
public PDF(
final Matrix inverseScale,
final int degreesOfFreedom)
{
super( inverseScale, degreesOfFreedom );
}
public PDF(
final InverseWishartDistribution other )
{
super( other );
} | Matrix function() { if( this.scaleSqrt == null ) { this.scaleSqrt = CholeskyDecompositionMTJ.create( DenseMatrixFactoryMTJ.INSTANCE.copyMatrix( this.inverseScale.inverse() ) ).getR(); } return this.scaleSqrt; } public static class PDF extends InverseWishartDistribution implements ProbabilityDensityFunction<Matrix> { public static final double LOG_OF_2 = Math.log(2.0); public PDF() { super(); } public PDF( final Matrix inverseScale, final int degreesOfFreedom) { super( inverseScale, degreesOfFreedom ); } public PDF( final InverseWishartDistribution other ) { super( other ); } | /**
* Getter for scaleSqrt
* @return
* Cached value of the square root of the inverse of the inverseScale,
* used for sampling.
*/ | Getter for scaleSqrt | getScaleSqrt | {
"repo_name": "codeaudit/Foundry",
"path": "Components/LearningCore/Source/gov/sandia/cognition/statistics/distribution/InverseWishartDistribution.java",
"license": "bsd-3-clause",
"size": 13305
} | [
"gov.sandia.cognition.math.matrix.Matrix",
"gov.sandia.cognition.math.matrix.mtj.DenseMatrixFactoryMTJ",
"gov.sandia.cognition.math.matrix.mtj.decomposition.CholeskyDecompositionMTJ",
"gov.sandia.cognition.statistics.ProbabilityDensityFunction"
] | import gov.sandia.cognition.math.matrix.Matrix; import gov.sandia.cognition.math.matrix.mtj.DenseMatrixFactoryMTJ; import gov.sandia.cognition.math.matrix.mtj.decomposition.CholeskyDecompositionMTJ; import gov.sandia.cognition.statistics.ProbabilityDensityFunction; | import gov.sandia.cognition.math.matrix.*; import gov.sandia.cognition.math.matrix.mtj.*; import gov.sandia.cognition.math.matrix.mtj.decomposition.*; import gov.sandia.cognition.statistics.*; | [
"gov.sandia.cognition"
] | gov.sandia.cognition; | 139,789 |
public void getChangedFilesExceptUnmerged(Collection<String> updated, Collection<String> created, Collection<String> removed, String revisions) throws VcsException
{
if(revisions == null)
{
return;
}
String root = myRoot.getPath();
GitSimpleHandler h = new GitSimpleHandler(myProject, myRoot, GitCommand.DIFF);
h.setSilent(true);
// note that moves are not detected here
h.addParameters("--name-status", "--diff-filter=ADMRUX", "--no-renames", revisions);
for(StringScanner s = new StringScanner(h.run()); s.hasMoreData(); )
{
if(s.isEol())
{
s.nextLine();
continue;
}
char status = s.peek();
s.boundedToken('\t');
final String relative = s.line();
// eliminate conflicts
if(myUnmergedPaths.contains(relative))
{
continue;
}
String path = root + "/" + GitUtil.unescapePath(relative);
switch(status)
{
case 'M':
updated.add(path);
break;
case 'A':
created.add(path);
break;
case 'D':
removed.add(path);
break;
default:
throw new IllegalStateException("Unexpected status: " + status);
}
}
} | void function(Collection<String> updated, Collection<String> created, Collection<String> removed, String revisions) throws VcsException { if(revisions == null) { return; } String root = myRoot.getPath(); GitSimpleHandler h = new GitSimpleHandler(myProject, myRoot, GitCommand.DIFF); h.setSilent(true); h.addParameters(STR, STR, STR, revisions); for(StringScanner s = new StringScanner(h.run()); s.hasMoreData(); ) { if(s.isEol()) { s.nextLine(); continue; } char status = s.peek(); s.boundedToken('\t'); final String relative = s.line(); if(myUnmergedPaths.contains(relative)) { continue; } String path = root + "/" + GitUtil.unescapePath(relative); switch(status) { case 'M': updated.add(path); break; case 'A': created.add(path); break; case 'D': removed.add(path); break; default: throw new IllegalStateException(STR + status); } } } | /**
* Populates the supplied collections of modified, created and removed files returned by 'git diff #revisions' command,
* where revisions is the range of revisions to check.
*/ | Populates the supplied collections of modified, created and removed files returned by 'git diff #revisions' command, where revisions is the range of revisions to check | getChangedFilesExceptUnmerged | {
"repo_name": "consulo/consulo-git",
"path": "plugin/src/main/java/git4idea/merge/MergeChangeCollector.java",
"license": "apache-2.0",
"size": 7477
} | [
"com.intellij.openapi.vcs.VcsException",
"java.util.Collection"
] | import com.intellij.openapi.vcs.VcsException; import java.util.Collection; | import com.intellij.openapi.vcs.*; import java.util.*; | [
"com.intellij.openapi",
"java.util"
] | com.intellij.openapi; java.util; | 1,250,804 |
String format(Calendar calendar); | String format(Calendar calendar); | /**
* <p>Formats a {@code Calendar} object.</p>
*
* @param calendar the calendar to format
* @return the formatted string
*/ | Formats a Calendar object | format | {
"repo_name": "Puja-Mishra/Android_FreeChat",
"path": "Telegram-master/TMessagesProj/src/main/java/org/telegram/messenger/time/DatePrinter.java",
"license": "gpl-2.0",
"size": 3829
} | [
"java.util.Calendar"
] | import java.util.Calendar; | import java.util.*; | [
"java.util"
] | java.util; | 1,118,942 |
protected void startBridgeServer(int port, boolean notifyBySubscription) throws IOException {
Cache cache = getCache();
CacheServer server = cache.addCacheServer();
server.setPort(port);
server.start();
bridgeServerPort = server.getPort();
} | void function(int port, boolean notifyBySubscription) throws IOException { Cache cache = getCache(); CacheServer server = cache.addCacheServer(); server.setPort(port); server.start(); bridgeServerPort = server.getPort(); } | /**
* Starts a cache server on the given port, using the given deserializeValues and
* notifyBySubscription to serve up the given region.
*/ | Starts a cache server on the given port, using the given deserializeValues and notifyBySubscription to serve up the given region | startBridgeServer | {
"repo_name": "davinash/geode",
"path": "geode-core/src/distributedTest/java/org/apache/geode/cache/query/dunit/PdxStringQueryDUnitTest.java",
"license": "apache-2.0",
"size": 92819
} | [
"java.io.IOException",
"org.apache.geode.cache.Cache",
"org.apache.geode.cache.server.CacheServer"
] | import java.io.IOException; import org.apache.geode.cache.Cache; import org.apache.geode.cache.server.CacheServer; | import java.io.*; import org.apache.geode.cache.*; import org.apache.geode.cache.server.*; | [
"java.io",
"org.apache.geode"
] | java.io; org.apache.geode; | 2,710,713 |
public static java.util.List extractMskExamJointBonesList(ims.domain.ILightweightDomainFactory domainFactory, ims.generalmedical.vo.MskBoneJointShortVoCollection voCollection)
{
return extractMskExamJointBonesList(domainFactory, voCollection, null, new HashMap());
}
| static java.util.List function(ims.domain.ILightweightDomainFactory domainFactory, ims.generalmedical.vo.MskBoneJointShortVoCollection voCollection) { return extractMskExamJointBonesList(domainFactory, voCollection, null, new HashMap()); } | /**
* Create the ims.medical.domain.objects.MskExamJointBones list from the value object collection.
* @param domainFactory - used to create existing (persistent) domain objects.
* @param voCollection - the collection of value objects
*/ | Create the ims.medical.domain.objects.MskExamJointBones list from the value object collection | extractMskExamJointBonesList | {
"repo_name": "IMS-MAXIMS/openMAXIMS",
"path": "Source Library/openmaxims_workspace/ValueObjects/src/ims/generalmedical/vo/domain/MskBoneJointShortVoAssembler.java",
"license": "agpl-3.0",
"size": 19097
} | [
"java.util.HashMap"
] | import java.util.HashMap; | import java.util.*; | [
"java.util"
] | java.util; | 611,759 |
protected void addCurrent_12PropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_Triplex_meter_current_12_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_Triplex_meter_current_12_feature", "_UI_Triplex_meter_type"),
VisGridPackage.eINSTANCE.getTriplex_meter_Current_12(),
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), VisGridPackage.eINSTANCE.getTriplex_meter_Current_12(), true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } | /**
* This adds a property descriptor for the Current 12 feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | This adds a property descriptor for the Current 12 feature. | addCurrent_12PropertyDescriptor | {
"repo_name": "mikesligo/visGrid",
"path": "ie.tcd.gmf.visGrid.edit/src/visGrid/provider/Triplex_meterItemProvider.java",
"license": "gpl-3.0",
"size": 76922
} | [
"org.eclipse.emf.edit.provider.ComposeableAdapterFactory",
"org.eclipse.emf.edit.provider.ItemPropertyDescriptor"
] | import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; | import org.eclipse.emf.edit.provider.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 2,071,544 |
public synchronized boolean abolish(Struct pi) {
if (!(pi instanceof Struct) || !pi.isGround() || !(pi.getArity() == 2))
throw new IllegalArgumentException(pi + " is not a valid Struct");
if(!pi.getName().equals("/"))
throw new IllegalArgumentException(pi + " has not the valid predicate name. Espected '/' but was " + pi.getName());
String arg0 = Tools.removeApices(pi.getArg(0).toString());
String arg1 = Tools.removeApices(pi.getArg(1).toString());
String key = arg0 + "/" + arg1;
List<ClauseInfo> abolished = dynamicDBase.abolish(key);
if (abolished != null)
engine.spy("ABOLISHED: " + key + " number of clauses=" + abolished.size() + "\n");
return true;
} | synchronized boolean function(Struct pi) { if (!(pi instanceof Struct) !pi.isGround() !(pi.getArity() == 2)) throw new IllegalArgumentException(pi + STR); if(!pi.getName().equals("/")) throw new IllegalArgumentException(pi + STR + pi.getName()); String arg0 = Tools.removeApices(pi.getArg(0).toString()); String arg1 = Tools.removeApices(pi.getArg(1).toString()); String key = arg0 + "/" + arg1; List<ClauseInfo> abolished = dynamicDBase.abolish(key); if (abolished != null) engine.spy(STR + key + STR + abolished.size() + "\n"); return true; } | /**
* removing from dbase all the clauses corresponding to the
* predicate indicator passed as a parameter
*/ | removing from dbase all the clauses corresponding to the predicate indicator passed as a parameter | abolish | {
"repo_name": "zakski/project-soisceal",
"path": "2p-mvn/tuProlog-3.2.1-mvn/src/alice/tuprolog/TheoryManager.java",
"license": "lgpl-3.0",
"size": 11681
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,280,496 |
public Collection<Rule> getRules() {
return getRulesByTag((String) null);
} | Collection<Rule> function() { return getRulesByTag((String) null); } | /**
* Gets all rules available in the rule engine.
*
* @return collection of all added rules.
*/ | Gets all rules available in the rule engine | getRules | {
"repo_name": "kdavis-mozilla/smarthome",
"path": "bundles/automation/org.eclipse.smarthome.automation.core/src/main/java/org/eclipse/smarthome/automation/core/internal/RuleEngine.java",
"license": "epl-1.0",
"size": 63742
} | [
"java.util.Collection",
"org.eclipse.smarthome.automation.Rule"
] | import java.util.Collection; import org.eclipse.smarthome.automation.Rule; | import java.util.*; import org.eclipse.smarthome.automation.*; | [
"java.util",
"org.eclipse.smarthome"
] | java.util; org.eclipse.smarthome; | 935,275 |
public void setUp(int fragmentId, DrawerLayout drawerLayout) {
mFragmentContainerView = getActivity().findViewById(fragmentId);
mDrawerLayout = drawerLayout;
// set a custom shadow that overlays the main content when the drawer opens
mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);
// set up the drawer's list view with items and click listener
ActionBar actionBar = getActionBar();
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setHomeButtonEnabled(true); | void function(int fragmentId, DrawerLayout drawerLayout) { mFragmentContainerView = getActivity().findViewById(fragmentId); mDrawerLayout = drawerLayout; mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START); ActionBar actionBar = getActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setHomeButtonEnabled(true); | /**
* Users of this fragment must call this method to set up the navigation drawer interactions.
*
* @param fragmentId The android:id of this fragment in its activity's layout.
* @param drawerLayout The DrawerLayout containing this fragment's UI.
*/ | Users of this fragment must call this method to set up the navigation drawer interactions | setUp | {
"repo_name": "darcusfenix/test-app-ae",
"path": "app/src/main/java/com/example/juan/testappae/NavigationDrawerFragment.java",
"license": "mit",
"size": 10622
} | [
"android.app.ActionBar",
"android.support.v4.view.GravityCompat",
"android.support.v4.widget.DrawerLayout"
] | import android.app.ActionBar; import android.support.v4.view.GravityCompat; import android.support.v4.widget.DrawerLayout; | import android.app.*; import android.support.v4.view.*; import android.support.v4.widget.*; | [
"android.app",
"android.support"
] | android.app; android.support; | 1,186,344 |
EClass getGetAppliedStereotypesBody(); | EClass getGetAppliedStereotypesBody(); | /**
* Returns the meta object for class '{@link anatlyzer.atlext.OCL.GetAppliedStereotypesBody <em>Get Applied Stereotypes Body</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for class '<em>Get Applied Stereotypes Body</em>'.
* @see anatlyzer.atlext.OCL.GetAppliedStereotypesBody
* @generated
*/ | Returns the meta object for class '<code>anatlyzer.atlext.OCL.GetAppliedStereotypesBody Get Applied Stereotypes Body</code>'. | getGetAppliedStereotypesBody | {
"repo_name": "jesusc/anatlyzer",
"path": "plugins/anatlyzer.atl.typing/src-gen/anatlyzer/atlext/OCL/OCLPackage.java",
"license": "epl-1.0",
"size": 484377
} | [
"org.eclipse.emf.ecore.EClass"
] | import org.eclipse.emf.ecore.EClass; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 1,621,673 |
protected static String getSubstitutedTemplateContent(String templateContent, NamesValuesList<String, String> namesValues) {
String templateContentSubst = templateContent;
// substitute the name/values
for (NameValue<String, String> nameValue : namesValues) {
templateContentSubst = templateContentSubst.replace(nameValue.name, nameValue.value);
}
return templateContentSubst;
} | static String function(String templateContent, NamesValuesList<String, String> namesValues) { String templateContentSubst = templateContent; for (NameValue<String, String> nameValue : namesValues) { templateContentSubst = templateContentSubst.replace(nameValue.name, nameValue.value); } return templateContentSubst; } | /**
* Substitutes names by values in template and return result.
* @param templateContent content of the template to substitute
* @param namesValues list of names/values to substitute
* @return result of substitution
*/ | Substitutes names by values in template and return result | getSubstitutedTemplateContent | {
"repo_name": "remybaranx/qtaste",
"path": "kernel/src/main/java/com/qspin/qtaste/reporter/ReportFormatter.java",
"license": "gpl-3.0",
"size": 7211
} | [
"com.qspin.qtaste.util.NameValue",
"com.qspin.qtaste.util.NamesValuesList"
] | import com.qspin.qtaste.util.NameValue; import com.qspin.qtaste.util.NamesValuesList; | import com.qspin.qtaste.util.*; | [
"com.qspin.qtaste"
] | com.qspin.qtaste; | 407,636 |
public void testZeroAssociatedObjectCQL2() throws ApplicationException
{
CQLQuery cqlQuery = new CQLQuery();
CQLObject target = new CQLObject();
CQLAssociation association = new CQLAssociation();
association.setName("gov.nih.nci.cacoresdk.domain.onetoone.multipleassociation.Child");
association.setAttribute(new CQLAttribute("id",CQLPredicate.EQUAL_TO,"3"));
association.setSourceRoleName("mother");
target.setName("gov.nih.nci.cacoresdk.domain.onetoone.multipleassociation.Parent");
target.setAssociation(association);
cqlQuery.setTarget(target);
Collection results = getApplicationService().query(cqlQuery,"gov.nih.nci.cacoresdk.domain.onetoone.multipleassociation.Parent");
assertNotNull(results);
assertEquals(0,results.size());
}
| void function() throws ApplicationException { CQLQuery cqlQuery = new CQLQuery(); CQLObject target = new CQLObject(); CQLAssociation association = new CQLAssociation(); association.setName(STR); association.setAttribute(new CQLAttribute("id",CQLPredicate.EQUAL_TO,"3")); association.setSourceRoleName(STR); target.setName(STR); target.setAssociation(association); cqlQuery.setTarget(target); Collection results = getApplicationService().query(cqlQuery,STR); assertNotNull(results); assertEquals(0,results.size()); } | /**
* Uses CQL Criteria for search
* Verifies that the results are returned
* Verifies size of the result set
* Verifies that none of the attribute is null
* Verifies that the associated object has required Id
*
* @throws ApplicationException
*/ | Uses CQL Criteria for search Verifies that the results are returned Verifies size of the result set Verifies that none of the attribute is null Verifies that the associated object has required Id | testZeroAssociatedObjectCQL2 | {
"repo_name": "NCIP/stats-analysis",
"path": "cacoresdk 3.2.1/junit/src/test/gov/nih/nci/cacoresdk/domain/onetoone/multipleassociation/O2OMultipleAssociationTest.java",
"license": "bsd-3-clause",
"size": 10186
} | [
"gov.nih.nci.system.applicationservice.ApplicationException",
"gov.nih.nci.system.query.cql.CQLAssociation",
"gov.nih.nci.system.query.cql.CQLAttribute",
"gov.nih.nci.system.query.cql.CQLObject",
"gov.nih.nci.system.query.cql.CQLPredicate",
"gov.nih.nci.system.query.cql.CQLQuery",
"java.util.Collection"
] | import gov.nih.nci.system.applicationservice.ApplicationException; import gov.nih.nci.system.query.cql.CQLAssociation; import gov.nih.nci.system.query.cql.CQLAttribute; import gov.nih.nci.system.query.cql.CQLObject; import gov.nih.nci.system.query.cql.CQLPredicate; import gov.nih.nci.system.query.cql.CQLQuery; import java.util.Collection; | import gov.nih.nci.system.applicationservice.*; import gov.nih.nci.system.query.cql.*; import java.util.*; | [
"gov.nih.nci",
"java.util"
] | gov.nih.nci; java.util; | 2,058,040 |
public String getObjectProperty(int groupID, int objectID, String propertyName, String def) {
if (groupID >= 0 && groupID < objectGroups.size()) {
ObjectGroup grp = (ObjectGroup) objectGroups.get(groupID);
if (objectID >= 0 && objectID < grp.objects.size()) {
GroupObject object = (GroupObject) grp.objects.get(objectID);
if (object == null) {
return def;
}
if (object.props == null) {
return def;
}
return object.props.getProperty(propertyName, def);
}
}
return def;
}
protected class ObjectGroup {
public int index;
public String name;
public ArrayList objects;
public int width;
public int height;
public Properties props;
public ObjectGroup(Element element) throws SlickException {
name = element.getAttribute("name");
width = Integer.parseInt(element.getAttribute("width"));
height = Integer.parseInt(element.getAttribute("height"));
objects = new ArrayList();
// now read the layer properties
Element propsElement = (Element) element.getElementsByTagName("properties").item(0);
if (propsElement != null) {
NodeList properties = propsElement.getElementsByTagName("property");
if (properties != null) {
props = new Properties();
for (int p = 0; p < properties.getLength(); p++) {
Element propElement = (Element) properties.item(p);
String name = propElement.getAttribute("name");
String value = propElement.getAttribute("value");
props.setProperty(name, value);
}
}
}
NodeList objectNodes = element.getElementsByTagName("object");
for (int i = 0; i < objectNodes.getLength(); i++) {
Element objElement = (Element) objectNodes.item(i);
GroupObject object = new GroupObject(objElement);
object.index = i;
objects.add(object);
}
}
}
protected class GroupObject {
public int index;
public String name;
public String type;
public int x;
public int y;
public int width;
public int height;
private String image;
public Properties props;
public GroupObject(Element element) throws SlickException {
name = element.getAttribute("name");
type = element.getAttribute("type");
x = Integer.parseInt(element.getAttribute("x"));
y = Integer.parseInt(element.getAttribute("y"));
width = Integer.parseInt(element.getAttribute("width"));
height = Integer.parseInt(element.getAttribute("height"));
Element imageElement = (Element) element.getElementsByTagName("image").item(0);
if (imageElement != null) {
image = imageElement.getAttribute("source");
}
// now read the layer properties
Element propsElement = (Element) element.getElementsByTagName("properties").item(0);
if (propsElement != null) {
NodeList properties = propsElement.getElementsByTagName("property");
if (properties != null) {
props = new Properties();
for (int p = 0; p < properties.getLength(); p++) {
Element propElement = (Element) properties.item(p);
String name = propElement.getAttribute("name");
String value = propElement.getAttribute("value");
props.setProperty(name, value);
}
}
}
}
} | String function(int groupID, int objectID, String propertyName, String def) { if (groupID >= 0 && groupID < objectGroups.size()) { ObjectGroup grp = (ObjectGroup) objectGroups.get(groupID); if (objectID >= 0 && objectID < grp.objects.size()) { GroupObject object = (GroupObject) grp.objects.get(objectID); if (object == null) { return def; } if (object.props == null) { return def; } return object.props.getProperty(propertyName, def); } } return def; } protected class ObjectGroup { public int index; public String name; public ArrayList objects; public int width; public int height; public Properties props; public ObjectGroup(Element element) throws SlickException { name = element.getAttribute("name"); width = Integer.parseInt(element.getAttribute("width")); height = Integer.parseInt(element.getAttribute(STR)); objects = new ArrayList(); Element propsElement = (Element) element.getElementsByTagName(STR).item(0); if (propsElement != null) { NodeList properties = propsElement.getElementsByTagName(STR); if (properties != null) { props = new Properties(); for (int p = 0; p < properties.getLength(); p++) { Element propElement = (Element) properties.item(p); String name = propElement.getAttribute("name"); String value = propElement.getAttribute("value"); props.setProperty(name, value); } } } NodeList objectNodes = element.getElementsByTagName(STR); for (int i = 0; i < objectNodes.getLength(); i++) { Element objElement = (Element) objectNodes.item(i); GroupObject object = new GroupObject(objElement); object.index = i; objects.add(object); } } } protected class GroupObject { public int index; public String name; public String type; public int x; public int y; public int width; public int height; private String image; public Properties props; public GroupObject(Element element) throws SlickException { name = element.getAttribute("name"); type = element.getAttribute("type"); x = Integer.parseInt(element.getAttribute("x")); y = Integer.parseInt(element.getAttribute("y")); width = Integer.parseInt(element.getAttribute("width")); height = Integer.parseInt(element.getAttribute(STR)); Element imageElement = (Element) element.getElementsByTagName("image").item(0); if (imageElement != null) { image = imageElement.getAttribute(STR); } Element propsElement = (Element) element.getElementsByTagName(STR).item(0); if (propsElement != null) { NodeList properties = propsElement.getElementsByTagName(STR); if (properties != null) { props = new Properties(); for (int p = 0; p < properties.getLength(); p++) { Element propElement = (Element) properties.item(p); String name = propElement.getAttribute("name"); String value = propElement.getAttribute("value"); props.setProperty(name, value); } } } } } | /**
* Looks for a property with the given name and returns it's value. If no property is found, def is returned.
* <p/>
*
* @param groupID Index of a group
* @param objectID Index of an object
* @param propertyName Name of a property
* @param def default value to return, if no property is found
* <p/>
*
* @return The value of the property with the given name or def, if there is no property with that name.
*/ | Looks for a property with the given name and returns it's value. If no property is found, def is returned. | getObjectProperty | {
"repo_name": "emabrey/SleekSlick2D",
"path": "slick/src/main/java/org/newdawn/slick/tiled/TiledMap.java",
"license": "bsd-3-clause",
"size": 36589
} | [
"java.util.ArrayList",
"java.util.Properties",
"org.newdawn.slick.SlickException",
"org.w3c.dom.Element",
"org.w3c.dom.NodeList"
] | import java.util.ArrayList; import java.util.Properties; import org.newdawn.slick.SlickException; import org.w3c.dom.Element; import org.w3c.dom.NodeList; | import java.util.*; import org.newdawn.slick.*; import org.w3c.dom.*; | [
"java.util",
"org.newdawn.slick",
"org.w3c.dom"
] | java.util; org.newdawn.slick; org.w3c.dom; | 310,120 |
private Response<Output> executeOneRequest(ExecOneRequestParams execOneParams)
throws IOException, InterruptedException {
if (execOneParams.isRetry()) {
resetRequestInputStream(request, execOneParams.retriedException);
}
checkInterrupted();
if (requestLog.isDebugEnabled()) {
requestLog.debug((execOneParams.isRetry() ? "Retrying " : "Sending ") + "Request: " + request);
}
final AWSCredentials credentials = getCredentialsFromContext();
final ProgressListener listener = requestConfig.getProgressListener();
if (execOneParams.isRetry()) {
pauseBeforeRetry(execOneParams, listener);
}
updateRetryHeaderInfo(request, execOneParams);
// Sign the request if a signer was provided
execOneParams.newSigner(request, executionContext);
if (execOneParams.signer != null &&
(credentials != null || execOneParams.signer instanceof CanHandleNullCredentials)) {
awsRequestMetrics.startEvent(Field.RequestSigningTime);
try {
if (timeOffset != 0) {
// Always use the client level timeOffset if it was
// non-zero; Otherwise, we respect the timeOffset in the
// request, which could have been externally configured (at
// least for the 1st non-retry request).
//
// For retry due to clock skew, the timeOffset in the
// request used for the retry is assumed to have been
// adjusted when execution reaches here.
request.setTimeOffset(timeOffset);
}
execOneParams.signer.sign(request, credentials);
} finally {
awsRequestMetrics.endEvent(Field.RequestSigningTime);
}
}
checkInterrupted();
execOneParams.newApacheRequest(httpRequestFactory, request, httpClientSettings);
captureConnectionPoolMetrics();
final HttpClientContext localRequestContext =
ApacheUtils.newClientContext(httpClientSettings, ImmutableMapParameter.of
(AWSRequestMetrics.SIMPLE_NAME, awsRequestMetrics));
execOneParams.resetBeforeHttpRequest();
publishProgress(listener, ProgressEventType.HTTP_REQUEST_STARTED_EVENT);
awsRequestMetrics.startEvent(Field.HttpRequestTime);
awsRequestMetrics.setCounter(Field.RetryCapacityConsumed, retryCapacity.consumedCapacity());
/////////// Send HTTP request ////////////
executionContext.getClientExecutionTrackerTask().setCurrentHttpRequest(execOneParams.apacheRequest);
final HttpRequestAbortTaskTracker requestAbortTaskTracker = httpRequestTimer
.startTimer(execOneParams.apacheRequest, getRequestTimeout(requestConfig));
try {
execOneParams.apacheResponse = httpClient.execute(execOneParams.apacheRequest, localRequestContext);
if (shouldBufferHttpEntity(responseHandler.needsConnectionLeftOpen(),
executionContext,
execOneParams,
requestAbortTaskTracker)) {
execOneParams.apacheResponse
.setEntity(new BufferedHttpEntity(
execOneParams.apacheResponse.getEntity()));
}
} catch (IOException ioe) {
// Client execution timeouts take precedence as it's not retryable
if (executionContext.getClientExecutionTrackerTask().hasTimeoutExpired()) {
throw new InterruptedException();
} else if (requestAbortTaskTracker.httpRequestAborted()) {
// Interrupt flag can leak from apache when aborting the request
// https://issues.apache.org/jira/browse/HTTPCLIENT-1958, TT0174038332
if (ioe instanceof RequestAbortedException) {
Thread.interrupted();
}
throw new HttpRequestTimeoutException(ioe);
} else {
throw ioe;
}
} finally {
requestAbortTaskTracker.cancelTask();
awsRequestMetrics.endEvent(Field.HttpRequestTime);
}
publishProgress(listener, ProgressEventType.HTTP_REQUEST_COMPLETED_EVENT);
final StatusLine statusLine = execOneParams.apacheResponse.getStatusLine();
final int statusCode = statusLine == null ? -1 : statusLine.getStatusCode();
if (ApacheUtils.isRequestSuccessful(execOneParams.apacheResponse)) {
awsRequestMetrics.addProperty(Field.StatusCode, statusCode);
execOneParams.leaveHttpConnectionOpen = responseHandler.needsConnectionLeftOpen();
HttpResponse httpResponse = ApacheUtils.createResponse(request, execOneParams.apacheRequest, execOneParams.apacheResponse, localRequestContext);
Output response = handleResponse(httpResponse);
if (execOneParams.isRetry() && executionContext.retryCapacityConsumed()) {
retryCapacity.release(THROTTLED_RETRY_COST);
} else {
retryCapacity.release();
}
return new Response<Output>(response, httpResponse);
}
if (isTemporaryRedirect(execOneParams.apacheResponse)) {
Header[] locationHeaders = execOneParams.apacheResponse.getHeaders("location");
String redirectedLocation = locationHeaders[0].getValue();
if (log.isDebugEnabled()) {
log.debug("Redirecting to: " + redirectedLocation);
}
execOneParams.redirectedURI = URI.create(redirectedLocation);
awsRequestMetrics.addPropertyWith(Field.StatusCode, statusCode)
.addPropertyWith(Field.AWSRequestID, null);
return null; // => retry
}
execOneParams.leaveHttpConnectionOpen = errorResponseHandler.needsConnectionLeftOpen();
final SdkBaseException exception = handleErrorResponse(execOneParams.apacheRequest,
execOneParams.apacheResponse,
localRequestContext);
ClockSkewAdjustment clockSkewAdjustment =
clockSkewAdjuster.getAdjustment(new AdjustmentRequest().exception(exception)
.clientRequest(request)
.serviceResponse(execOneParams.apacheResponse));
if (clockSkewAdjustment.shouldAdjustForSkew()) {
timeOffset = clockSkewAdjustment.inSeconds();
request.setTimeOffset(timeOffset); // adjust time offset for the retry
SDKGlobalTime.setGlobalTimeOffset(timeOffset);
}
// Check whether we should internally retry the auth error
execOneParams.authRetryParam = null;
AuthErrorRetryStrategy authRetry = executionContext.getAuthErrorRetryStrategy();
if (authRetry != null && exception instanceof AmazonServiceException) {
HttpResponse httpResponse = ApacheUtils.createResponse(request, execOneParams.apacheRequest, execOneParams.apacheResponse, localRequestContext);
execOneParams.authRetryParam = authRetry
.shouldRetryWithAuthParam(request, httpResponse, (AmazonServiceException) exception);
}
if (execOneParams.authRetryParam == null && !shouldRetry(execOneParams, exception)) {
throw exception;
}
// Comment out for now. Ref: CR2662349
// Preserve the cause of retry before retrying
// awsRequestMetrics.addProperty(RetryCause, ase);
if (RetryUtils.isThrottlingException(exception)) {
awsRequestMetrics.incrementCounterWith(Field.ThrottleException)
.addProperty(Field.ThrottleException, exception);
}
// Cache the retryable exception
execOneParams.retriedException = exception;
return null; // => retry
} | Response<Output> function(ExecOneRequestParams execOneParams) throws IOException, InterruptedException { if (execOneParams.isRetry()) { resetRequestInputStream(request, execOneParams.retriedException); } checkInterrupted(); if (requestLog.isDebugEnabled()) { requestLog.debug((execOneParams.isRetry() ? STR : STR) + STR + request); } final AWSCredentials credentials = getCredentialsFromContext(); final ProgressListener listener = requestConfig.getProgressListener(); if (execOneParams.isRetry()) { pauseBeforeRetry(execOneParams, listener); } updateRetryHeaderInfo(request, execOneParams); execOneParams.newSigner(request, executionContext); if (execOneParams.signer != null && (credentials != null execOneParams.signer instanceof CanHandleNullCredentials)) { awsRequestMetrics.startEvent(Field.RequestSigningTime); try { if (timeOffset != 0) { request.setTimeOffset(timeOffset); } execOneParams.signer.sign(request, credentials); } finally { awsRequestMetrics.endEvent(Field.RequestSigningTime); } } checkInterrupted(); execOneParams.newApacheRequest(httpRequestFactory, request, httpClientSettings); captureConnectionPoolMetrics(); final HttpClientContext localRequestContext = ApacheUtils.newClientContext(httpClientSettings, ImmutableMapParameter.of (AWSRequestMetrics.SIMPLE_NAME, awsRequestMetrics)); execOneParams.resetBeforeHttpRequest(); publishProgress(listener, ProgressEventType.HTTP_REQUEST_STARTED_EVENT); awsRequestMetrics.startEvent(Field.HttpRequestTime); awsRequestMetrics.setCounter(Field.RetryCapacityConsumed, retryCapacity.consumedCapacity()); executionContext.getClientExecutionTrackerTask().setCurrentHttpRequest(execOneParams.apacheRequest); final HttpRequestAbortTaskTracker requestAbortTaskTracker = httpRequestTimer .startTimer(execOneParams.apacheRequest, getRequestTimeout(requestConfig)); try { execOneParams.apacheResponse = httpClient.execute(execOneParams.apacheRequest, localRequestContext); if (shouldBufferHttpEntity(responseHandler.needsConnectionLeftOpen(), executionContext, execOneParams, requestAbortTaskTracker)) { execOneParams.apacheResponse .setEntity(new BufferedHttpEntity( execOneParams.apacheResponse.getEntity())); } } catch (IOException ioe) { if (executionContext.getClientExecutionTrackerTask().hasTimeoutExpired()) { throw new InterruptedException(); } else if (requestAbortTaskTracker.httpRequestAborted()) { if (ioe instanceof RequestAbortedException) { Thread.interrupted(); } throw new HttpRequestTimeoutException(ioe); } else { throw ioe; } } finally { requestAbortTaskTracker.cancelTask(); awsRequestMetrics.endEvent(Field.HttpRequestTime); } publishProgress(listener, ProgressEventType.HTTP_REQUEST_COMPLETED_EVENT); final StatusLine statusLine = execOneParams.apacheResponse.getStatusLine(); final int statusCode = statusLine == null ? -1 : statusLine.getStatusCode(); if (ApacheUtils.isRequestSuccessful(execOneParams.apacheResponse)) { awsRequestMetrics.addProperty(Field.StatusCode, statusCode); execOneParams.leaveHttpConnectionOpen = responseHandler.needsConnectionLeftOpen(); HttpResponse httpResponse = ApacheUtils.createResponse(request, execOneParams.apacheRequest, execOneParams.apacheResponse, localRequestContext); Output response = handleResponse(httpResponse); if (execOneParams.isRetry() && executionContext.retryCapacityConsumed()) { retryCapacity.release(THROTTLED_RETRY_COST); } else { retryCapacity.release(); } return new Response<Output>(response, httpResponse); } if (isTemporaryRedirect(execOneParams.apacheResponse)) { Header[] locationHeaders = execOneParams.apacheResponse.getHeaders(STR); String redirectedLocation = locationHeaders[0].getValue(); if (log.isDebugEnabled()) { log.debug(STR + redirectedLocation); } execOneParams.redirectedURI = URI.create(redirectedLocation); awsRequestMetrics.addPropertyWith(Field.StatusCode, statusCode) .addPropertyWith(Field.AWSRequestID, null); return null; } execOneParams.leaveHttpConnectionOpen = errorResponseHandler.needsConnectionLeftOpen(); final SdkBaseException exception = handleErrorResponse(execOneParams.apacheRequest, execOneParams.apacheResponse, localRequestContext); ClockSkewAdjustment clockSkewAdjustment = clockSkewAdjuster.getAdjustment(new AdjustmentRequest().exception(exception) .clientRequest(request) .serviceResponse(execOneParams.apacheResponse)); if (clockSkewAdjustment.shouldAdjustForSkew()) { timeOffset = clockSkewAdjustment.inSeconds(); request.setTimeOffset(timeOffset); SDKGlobalTime.setGlobalTimeOffset(timeOffset); } execOneParams.authRetryParam = null; AuthErrorRetryStrategy authRetry = executionContext.getAuthErrorRetryStrategy(); if (authRetry != null && exception instanceof AmazonServiceException) { HttpResponse httpResponse = ApacheUtils.createResponse(request, execOneParams.apacheRequest, execOneParams.apacheResponse, localRequestContext); execOneParams.authRetryParam = authRetry .shouldRetryWithAuthParam(request, httpResponse, (AmazonServiceException) exception); } if (execOneParams.authRetryParam == null && !shouldRetry(execOneParams, exception)) { throw exception; } if (RetryUtils.isThrottlingException(exception)) { awsRequestMetrics.incrementCounterWith(Field.ThrottleException) .addProperty(Field.ThrottleException, exception); } execOneParams.retriedException = exception; return null; } | /**
* Returns the response from executing one httpClientSettings request; or null for retry.
*/ | Returns the response from executing one httpClientSettings request; or null for retry | executeOneRequest | {
"repo_name": "jentfoo/aws-sdk-java",
"path": "aws-java-sdk-core/src/main/java/com/amazonaws/http/AmazonHttpClient.java",
"license": "apache-2.0",
"size": 87825
} | [
"com.amazonaws.AmazonServiceException",
"com.amazonaws.Response",
"com.amazonaws.SDKGlobalTime",
"com.amazonaws.SdkBaseException",
"com.amazonaws.auth.AWSCredentials",
"com.amazonaws.auth.CanHandleNullCredentials",
"com.amazonaws.event.ProgressEventType",
"com.amazonaws.event.ProgressListener",
"com.amazonaws.event.SDKProgressPublisher",
"com.amazonaws.http.apache.utils.ApacheUtils",
"com.amazonaws.http.exception.HttpRequestTimeoutException",
"com.amazonaws.http.timers.request.HttpRequestAbortTaskTracker",
"com.amazonaws.retry.ClockSkewAdjuster",
"com.amazonaws.retry.RetryUtils",
"com.amazonaws.retry.internal.AuthErrorRetryStrategy",
"com.amazonaws.util.AWSRequestMetrics",
"com.amazonaws.util.ImmutableMapParameter",
"java.io.IOException",
"java.net.URI",
"org.apache.http.Header",
"org.apache.http.StatusLine",
"org.apache.http.client.protocol.HttpClientContext",
"org.apache.http.entity.BufferedHttpEntity",
"org.apache.http.impl.execchain.RequestAbortedException"
] | import com.amazonaws.AmazonServiceException; import com.amazonaws.Response; import com.amazonaws.SDKGlobalTime; import com.amazonaws.SdkBaseException; import com.amazonaws.auth.AWSCredentials; import com.amazonaws.auth.CanHandleNullCredentials; import com.amazonaws.event.ProgressEventType; import com.amazonaws.event.ProgressListener; import com.amazonaws.event.SDKProgressPublisher; import com.amazonaws.http.apache.utils.ApacheUtils; import com.amazonaws.http.exception.HttpRequestTimeoutException; import com.amazonaws.http.timers.request.HttpRequestAbortTaskTracker; import com.amazonaws.retry.ClockSkewAdjuster; import com.amazonaws.retry.RetryUtils; import com.amazonaws.retry.internal.AuthErrorRetryStrategy; import com.amazonaws.util.AWSRequestMetrics; import com.amazonaws.util.ImmutableMapParameter; import java.io.IOException; import java.net.URI; import org.apache.http.Header; import org.apache.http.StatusLine; import org.apache.http.client.protocol.HttpClientContext; import org.apache.http.entity.BufferedHttpEntity; import org.apache.http.impl.execchain.RequestAbortedException; | import com.amazonaws.*; import com.amazonaws.auth.*; import com.amazonaws.event.*; import com.amazonaws.http.apache.utils.*; import com.amazonaws.http.exception.*; import com.amazonaws.http.timers.request.*; import com.amazonaws.retry.*; import com.amazonaws.retry.internal.*; import com.amazonaws.util.*; import java.io.*; import java.net.*; import org.apache.http.*; import org.apache.http.client.protocol.*; import org.apache.http.entity.*; import org.apache.http.impl.execchain.*; | [
"com.amazonaws",
"com.amazonaws.auth",
"com.amazonaws.event",
"com.amazonaws.http",
"com.amazonaws.retry",
"com.amazonaws.util",
"java.io",
"java.net",
"org.apache.http"
] | com.amazonaws; com.amazonaws.auth; com.amazonaws.event; com.amazonaws.http; com.amazonaws.retry; com.amazonaws.util; java.io; java.net; org.apache.http; | 337,092 |
public int getCameraZoomHeight() {
try {
return settings.getInt("area");
} catch (JSONException e) {
return 1;
}
} | int function() { try { return settings.getInt("area"); } catch (JSONException e) { return 1; } } | /**
* This method has the task of returning the height of the camera in the map chart.
* @return height of the camera in the map chart
*/ | This method has the task of returning the height of the camera in the map chart | getCameraZoomHeight | {
"repo_name": "kaizenteamSWE/NorrisApp",
"path": "main/java/it/kaizenteam/app/model/NorrisChart/MapChartSettingsImpl.java",
"license": "mit",
"size": 3691
} | [
"org.json.JSONException"
] | import org.json.JSONException; | import org.json.*; | [
"org.json"
] | org.json; | 2,091,964 |
public static void add (Options options, boolean doFireEvent) {
long triggerTime = options.getDate();
Log.d("NotifyZone", "Reached 02....");
try {
// http://androidarabia.net/quran4android/phpserver/connecttoserver.php
// Log.i(getClass().getSimpleName(), "send task - start");
HttpParams httpParams = new BasicHttpParams();
HttpConnectionParams.setConnectionTimeout(httpParams, 10000);
HttpConnectionParams.setSoTimeout(httpParams, 10000);
//
HttpParams p = new BasicHttpParams();
p.setParameter("devid", "E178524");
// Instantiate an HttpClient
//HttpClient httpclient = new DefaultHttpClient(p);
String url = "http://projects.vrisini.com/pradict/" +
"index.php?eID=pushMessage" +
"&staid=E178524&synid=" + Schedule.uuid;
//HttpPost httppost = new HttpPost(url);
HttpClient client = new DefaultHttpClient();
HttpPost post = new HttpPost(url);
// add header
//post.setHeader("User-Agent", USER_AGENT);
List<NameValuePair> urlParameters = new ArrayList<NameValuePair>();
urlParameters.add(new BasicNameValuePair("devid", "E178524"));
post.setEntity(new UrlEncodedFormEntity(urlParameters));
HttpResponse response = client.execute(post);
// Log.i(getClass().getSimpleName(), "send task - end");
} catch (Throwable t) {
//Toast.makeText(this, "Request failed: " + t.toString(),
// Toast.LENGTH_LONG).show();
}
} | static void function (Options options, boolean doFireEvent) { long triggerTime = options.getDate(); Log.d(STR, STR); try { HttpParams httpParams = new BasicHttpParams(); HttpConnectionParams.setConnectionTimeout(httpParams, 10000); HttpConnectionParams.setSoTimeout(httpParams, 10000); p.setParameter("devid", STR); String url = STRindex.php?eID=pushMessageSTR&staid=E178524&synid=STRdevid", STR)); post.setEntity(new UrlEncodedFormEntity(urlParameters)); HttpResponse response = client.execute(post); } catch (Throwable t) { } } | /**
* Set an alarm.
*
* @param options
* The options that can be specified per alarm.
* @param doFireEvent
* If the onadd callback shall be called.
*/ | Set an alarm | add | {
"repo_name": "shreetam-vrisini/Cordova-Schedule-Plugin",
"path": "src/android/Schedule.java",
"license": "apache-2.0",
"size": 14546
} | [
"android.util.Log",
"org.apache.http.HttpResponse",
"org.apache.http.client.entity.UrlEncodedFormEntity",
"org.apache.http.params.BasicHttpParams",
"org.apache.http.params.HttpConnectionParams",
"org.apache.http.params.HttpParams"
] | import android.util.Log; import org.apache.http.HttpResponse; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.params.BasicHttpParams; import org.apache.http.params.HttpConnectionParams; import org.apache.http.params.HttpParams; | import android.util.*; import org.apache.http.*; import org.apache.http.client.entity.*; import org.apache.http.params.*; | [
"android.util",
"org.apache.http"
] | android.util; org.apache.http; | 1,988,249 |
public void completeScope(Scope scope) {
for (Iterator<Var> it = scope.getVars(); it.hasNext();) {
Var var = it.next();
if (var.isTypeInferred()) {
JSType type = var.getType();
if (type == null || type.isUnknownType()) {
JSType flowType = getSlot(var.getName()).getType();
var.setType(flowType);
}
}
}
} | void function(Scope scope) { for (Iterator<Var> it = scope.getVars(); it.hasNext();) { Var var = it.next(); if (var.isTypeInferred()) { JSType type = var.getType(); if (type == null type.isUnknownType()) { JSType flowType = getSlot(var.getName()).getType(); var.setType(flowType); } } } } | /**
* Look through the given scope, and try to find slots where it doesn't
* have enough type information. Then fill in that type information
* with stuff that we've inferred in the local flow.
*/ | Look through the given scope, and try to find slots where it doesn't have enough type information. Then fill in that type information with stuff that we've inferred in the local flow | completeScope | {
"repo_name": "007slm/kissy",
"path": "tools/module-compiler/src/com/google/javascript/jscomp/LinkedFlowScope.java",
"license": "mit",
"size": 16054
} | [
"com.google.javascript.jscomp.Scope",
"com.google.javascript.rhino.jstype.JSType",
"java.util.Iterator"
] | import com.google.javascript.jscomp.Scope; import com.google.javascript.rhino.jstype.JSType; import java.util.Iterator; | import com.google.javascript.jscomp.*; import com.google.javascript.rhino.jstype.*; import java.util.*; | [
"com.google.javascript",
"java.util"
] | com.google.javascript; java.util; | 1,828,827 |
public File process(final String[] args) {
this.isError = false;
final CommandLineParser parser = new GnuParser();
try {
final CommandLine cli = parser.parse(this.options, args);
final File gameConfig = new File(cli.getOptionValue(this.game.getOpt()));
if (!gameConfig.exists() || !gameConfig.canRead()) {
this.setError("Provided game config file cannot be read!");
return null;
} else {
return gameConfig;
}
} catch (final ParseException e) {
this.setError(e.getMessage());
return null;
}
} | File function(final String[] args) { this.isError = false; final CommandLineParser parser = new GnuParser(); try { final CommandLine cli = parser.parse(this.options, args); final File gameConfig = new File(cli.getOptionValue(this.game.getOpt())); if (!gameConfig.exists() !gameConfig.canRead()) { this.setError(STR); return null; } else { return gameConfig; } } catch (final ParseException e) { this.setError(e.getMessage()); return null; } } | /**
* Process the command-line arguments.
*
* @param args
* The arguments.
* @return The tournament config to read.
*/ | Process the command-line arguments | process | {
"repo_name": "triceo/drooms",
"path": "drooms-launcher-tournament/src/main/java/org/drooms/launcher/tournament/CLI.java",
"license": "apache-2.0",
"size": 2905
} | [
"java.io.File",
"org.apache.commons.cli.CommandLine",
"org.apache.commons.cli.CommandLineParser",
"org.apache.commons.cli.GnuParser",
"org.apache.commons.cli.ParseException"
] | import java.io.File; import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.CommandLineParser; import org.apache.commons.cli.GnuParser; import org.apache.commons.cli.ParseException; | import java.io.*; import org.apache.commons.cli.*; | [
"java.io",
"org.apache.commons"
] | java.io; org.apache.commons; | 470,021 |
@Override
default Optional<V> toOptional() throws ViewableAsOptional.TooManyElements {
return Optional.ofNullable(get());
}
}
class TooManyElements extends RuntimeException {
private static final long serialVersionUID = 1L;
public TooManyElements(List<? extends Object> objects) {
this(objects, (Throwable) null);
}
public TooManyElements(List<? extends Object> objects, Throwable cause) {
this(objects, Object::toString, cause);
}
public <T extends Object> TooManyElements(List<T> objects, Function<? super T, ? extends CharSequence> toString) {
this(objects, toString, null);
}
public <T extends Object> TooManyElements(List<T> objects, Function<? super T, ? extends CharSequence> toString, Throwable cause) {
this("Expected at most one element, but there were excess ones. All elements: [" + objects.stream().map(toString).collect(joining(", ")) + "]", cause);
}
public TooManyElements(Object allowed, Object firstExcess) {
this(allowed, firstExcess, null);
}
public TooManyElements(Object allowed, Object firstExcess, Throwable cause) {
this("Expected only the element '" + allowed + "', but there were at least one excess one: '" + firstExcess + "'", cause);
}
public TooManyElements() {
this("Expected at most one element, but there were excess ones", null);
}
public TooManyElements(String message, Throwable cause) {
super(message, cause);
}
} | default Optional<V> toOptional() throws ViewableAsOptional.TooManyElements { return Optional.ofNullable(get()); } } class TooManyElements extends RuntimeException { private static final long serialVersionUID = 1L; public TooManyElements(List<? extends Object> objects) { this(objects, (Throwable) null); } public TooManyElements(List<? extends Object> objects, Throwable cause) { this(objects, Object::toString, cause); } public <T extends Object> TooManyElements(List<T> objects, Function<? super T, ? extends CharSequence> toString) { this(objects, toString, null); } public <T extends Object> TooManyElements(List<T> objects, Function<? super T, ? extends CharSequence> toString, Throwable cause) { this(STR + objects.stream().map(toString).collect(joining(STR)) + "]", cause); } public TooManyElements(Object allowed, Object firstExcess) { this(allowed, firstExcess, null); } public TooManyElements(Object allowed, Object firstExcess, Throwable cause) { this(STR + allowed + STR + firstExcess + "'", cause); } public TooManyElements() { this(STR, null); } public TooManyElements(String message, Throwable cause) { super(message, cause); } } | /**
* Convert this object to an {@link java.util.Optional} by wrapping the
* value returned from {@link #get()}.
*
* @return the value returned from {@link #get()}, wrapped in an {@link Optional}.
* If {@code get()} returns {@code null}, {@link Optional#empty()} is returned.
*/ | Convert this object to an <code>java.util.Optional</code> by wrapping the value returned from <code>#get()</code> | toOptional | {
"repo_name": "digipost/digg",
"path": "src/main/java/no/digipost/util/ViewableAsOptional.java",
"license": "apache-2.0",
"size": 3887
} | [
"java.util.List",
"java.util.Optional",
"java.util.function.Function"
] | import java.util.List; import java.util.Optional; import java.util.function.Function; | import java.util.*; import java.util.function.*; | [
"java.util"
] | java.util; | 329,996 |
public Builder applyToAllUnaryMethods(
ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) {
super.applyToAllUnaryMethods(
getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater);
return this;
} | Builder function( ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) { super.applyToAllUnaryMethods( getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); return this; } | /**
* Applies the given settings updater function to all of the unary API methods in this service.
*
* <p>Note: This method does not support applying settings to streaming methods.
*/ | Applies the given settings updater function to all of the unary API methods in this service. Note: This method does not support applying settings to streaming methods | applyToAllUnaryMethods | {
"repo_name": "googleapis/java-dialogflow",
"path": "google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/FulfillmentsSettings.java",
"license": "apache-2.0",
"size": 7423
} | [
"com.google.api.core.ApiFunction",
"com.google.api.gax.rpc.UnaryCallSettings"
] | import com.google.api.core.ApiFunction; import com.google.api.gax.rpc.UnaryCallSettings; | import com.google.api.core.*; import com.google.api.gax.rpc.*; | [
"com.google.api"
] | com.google.api; | 1,872,102 |
public void testModifyAgencyMinValues() throws XmlRpcException,
MalformedURLException {
Map<String, Object> struct = new HashMap<String, Object>();
struct.put(AGENCY_ID, agencyId);
struct.put(AGENCY_NAME, "");
struct.put(CONTACT_NAME, "");
struct.put(EMAIL_ADDRESS, TextUtils.MIN_ALLOWED_EMAIL);
Object[] params = new Object[] { sessionId, struct };
final Boolean result = (Boolean) client.execute(MODIFY_AGENCY_METHOD,
params);
assertTrue(result);
} | void function() throws XmlRpcException, MalformedURLException { Map<String, Object> struct = new HashMap<String, Object>(); struct.put(AGENCY_ID, agencyId); struct.put(AGENCY_NAME, STR"); struct.put(EMAIL_ADDRESS, TextUtils.MIN_ALLOWED_EMAIL); Object[] params = new Object[] { sessionId, struct }; final Boolean result = (Boolean) client.execute(MODIFY_AGENCY_METHOD, params); assertTrue(result); } | /**
* Test method with fields that has min. allowed values.
*
* @throws XmlRpcException
* @throws MalformedURLException
*/ | Test method with fields that has min. allowed values | testModifyAgencyMinValues | {
"repo_name": "adqio/revive-adserver",
"path": "www/api/v2/xmlrpc/tests/unit/src/test/java/org/openx/agency/TestModifyAgency.java",
"license": "gpl-2.0",
"size": 7265
} | [
"java.net.MalformedURLException",
"java.util.HashMap",
"java.util.Map",
"org.apache.xmlrpc.XmlRpcException",
"org.openx.utils.TextUtils"
] | import java.net.MalformedURLException; import java.util.HashMap; import java.util.Map; import org.apache.xmlrpc.XmlRpcException; import org.openx.utils.TextUtils; | 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,014,687 |
public ITypeParameterBuilder addTypeParameter(String name) {
return this.builder.addTypeParameter(name);
} | ITypeParameterBuilder function(String name) { return this.builder.addTypeParameter(name); } | /** Add a type parameter.
* @param name - the simple name of the type parameter.
* @return the builder of type parameter.
*/ | Add a type parameter | addTypeParameter | {
"repo_name": "jgfoster/sarl",
"path": "main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/appenders/SarlActionSourceAppender.java",
"license": "apache-2.0",
"size": 5129
} | [
"io.sarl.lang.codebuilder.builders.ITypeParameterBuilder"
] | import io.sarl.lang.codebuilder.builders.ITypeParameterBuilder; | import io.sarl.lang.codebuilder.builders.*; | [
"io.sarl.lang"
] | io.sarl.lang; | 2,400,799 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.