method stringlengths 13 441k | clean_method stringlengths 7 313k | doc stringlengths 17 17.3k | comment stringlengths 3 1.42k | method_name stringlengths 1 273 | extra dict | imports list | imports_info stringlengths 19 34.8k | cluster_imports_info stringlengths 15 3.66k | libraries list | libraries_info stringlengths 6 661 | id int64 0 2.92M |
|---|---|---|---|---|---|---|---|---|---|---|---|
private synchronized AssessmentGradingData submitToGradingService(
ActionEvent ae, PublishedAssessmentFacade publishedAssessment, DeliveryBean delivery, HashMap invalidFINMap, ArrayList invalidSALengthList) throws FinFormatException {
log.debug("****1a. inside submitToGradingService ");
String submissionId = "";
HashSet<ItemGradingData> itemGradingHash = new HashSet<ItemGradingData>();
// daisyf decoding: get page contents contains SectionContentsBean, a
// wrapper for SectionDataIfc
Iterator<SectionContentsBean> iter = delivery.getPageContents().getPartsContents()
.iterator();
log.debug("****1b. inside submitToGradingService, iter= " + iter);
HashSet<ItemGradingData> adds = new HashSet<ItemGradingData>();
HashSet<ItemGradingData> removes = new HashSet<ItemGradingData>();
// we go through all the answer collected from JSF form per each
// publsihedItem and
// work out which answer is an new addition and in cases like
// MC/MCMR/Survey, we will
// discard any existing one and just save the new one. For other
// question type, we
// simply modify the publishedText or publishedAnswer of the existing
// ones.
while (iter.hasNext()) {
SectionContentsBean part = iter.next();
log.debug("****1c. inside submitToGradingService, part " + part);
Iterator<ItemContentsBean> iter2 = part.getItemContents().iterator();
while (iter2.hasNext()) { // go through each item from form
ItemContentsBean item = iter2.next();
log.debug("****** before prepareItemGradingPerItem");
prepareItemGradingPerItem(ae, delivery, item, adds, removes);
log.debug("****** after prepareItemGradingPerItem");
}
}
AssessmentGradingData adata = persistAssessmentGrading(ae, delivery,
itemGradingHash, publishedAssessment, adds, removes, invalidFINMap, invalidSALengthList);
StringBuffer redrawAnchorName = new StringBuffer("p");
String tmpAnchorName = "";
Iterator<SectionContentsBean> iterPart = delivery.getPageContents().getPartsContents().iterator();
while (iterPart.hasNext()) {
SectionContentsBean part = iterPart.next();
String partSeq = part.getNumber();
Iterator<ItemContentsBean> iterItem = part.getItemContents().iterator();
while (iterItem.hasNext()) { // go through each item from form
ItemContentsBean item = iterItem.next();
String itemSeq = item.getSequence();
Long itemId = item.getItemData().getItemId();
if (item.getItemData().getTypeId() == 5) {
if (invalidSALengthList.contains(itemId)) {
item.setIsInvalidSALengthInput(true);
redrawAnchorName.append(partSeq);
redrawAnchorName.append("q");
redrawAnchorName.append(itemSeq);
if (tmpAnchorName.equals("") || tmpAnchorName.compareToIgnoreCase(redrawAnchorName.toString()) > 0) {
tmpAnchorName = redrawAnchorName.toString();
}
}
else {
item.setIsInvalidSALengthInput(false);
}
}
else if (item.getItemData().getTypeId() == 11) {
if (invalidFINMap.containsKey(itemId)) {
item.setIsInvalidFinInput(true);
redrawAnchorName.append(partSeq);
redrawAnchorName.append("q");
redrawAnchorName.append(itemSeq);
if (tmpAnchorName.equals("") || tmpAnchorName.compareToIgnoreCase(redrawAnchorName.toString()) > 0) {
tmpAnchorName = redrawAnchorName.toString();
}
ArrayList list = (ArrayList) invalidFINMap.get(itemId);
List<FinBean> finArray = item.getFinArray();
Iterator<FinBean> iterFin = finArray.iterator();
while (iterFin.hasNext()) {
FinBean finBean = iterFin.next();
if (finBean.getItemGradingData() != null) {
Long itemGradingId = finBean.getItemGradingData().getItemGradingId();
if (list.contains(itemGradingId)) {
finBean.setIsCorrect(false);
}
}
}
}
else {
item.setIsInvalidFinInput(false);
}
}
}
}
if (tmpAnchorName != null && !tmpAnchorName.equals("")) {
delivery.setRedrawAnchorName(tmpAnchorName.toString());
}
else {
delivery.setRedrawAnchorName("");
}
delivery.setSubmissionId(submissionId);
delivery.setSubmissionTicket(submissionId);// is this the same thing?
// hmmmm
delivery.setSubmissionDate(new Date());
delivery.setSubmitted(true);
return adata;
} | synchronized AssessmentGradingData function( ActionEvent ae, PublishedAssessmentFacade publishedAssessment, DeliveryBean delivery, HashMap invalidFINMap, ArrayList invalidSALengthList) throws FinFormatException { log.debug(STR); String submissionId = STR****1b. inside submitToGradingService, iter= STR****1c. inside submitToGradingService, part STR****** before prepareItemGradingPerItemSTR****** after prepareItemGradingPerItemSTRpSTRSTRqSTRSTRqSTRSTRSTR"); } delivery.setSubmissionId(submissionId); delivery.setSubmissionTicket(submissionId); delivery.setSubmissionDate(new Date()); delivery.setSubmitted(true); return adata; } | /**
* Invoke submission and return the grading data
*
* @param publishedAssessment
* @param delivery
* @return
*/ | Invoke submission and return the grading data | submitToGradingService | {
"repo_name": "pushyamig/sakai",
"path": "samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/delivery/SubmitToGradingActionListener.java",
"license": "apache-2.0",
"size": 40629
} | [
"java.util.ArrayList",
"java.util.Date",
"java.util.HashMap",
"javax.faces.event.ActionEvent",
"org.sakaiproject.tool.assessment.data.dao.grading.AssessmentGradingData",
"org.sakaiproject.tool.assessment.facade.PublishedAssessmentFacade",
"org.sakaiproject.tool.assessment.services.FinFormatException",
"org.sakaiproject.tool.assessment.ui.bean.delivery.DeliveryBean"
] | import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import javax.faces.event.ActionEvent; import org.sakaiproject.tool.assessment.data.dao.grading.AssessmentGradingData; import org.sakaiproject.tool.assessment.facade.PublishedAssessmentFacade; import org.sakaiproject.tool.assessment.services.FinFormatException; import org.sakaiproject.tool.assessment.ui.bean.delivery.DeliveryBean; | import java.util.*; import javax.faces.event.*; import org.sakaiproject.tool.assessment.data.dao.grading.*; import org.sakaiproject.tool.assessment.facade.*; import org.sakaiproject.tool.assessment.services.*; import org.sakaiproject.tool.assessment.ui.bean.delivery.*; | [
"java.util",
"javax.faces",
"org.sakaiproject.tool"
] | java.util; javax.faces; org.sakaiproject.tool; | 577,871 |
public ImmutableMap<String, String> alternateNames() {
return alternateNames;
} | ImmutableMap<String, String> function() { return alternateNames; } | /**
* Returns the complete map of alternate name to standard name.
* <p>
* The map is keyed by the alternate name.
*
* @return the map of alternate names
*/ | Returns the complete map of alternate name to standard name. The map is keyed by the alternate name | alternateNames | {
"repo_name": "ChinaQuants/Strata",
"path": "modules/collect/src/main/java/com/opengamma/strata/collect/named/ExtendedEnum.java",
"license": "apache-2.0",
"size": 22291
} | [
"com.google.common.collect.ImmutableMap"
] | import com.google.common.collect.ImmutableMap; | import com.google.common.collect.*; | [
"com.google.common"
] | com.google.common; | 2,859,130 |
@Test
public void checkConstruction() {
Inlet inlet = new Inlet();
assertNotNull(inlet.getInputs());
assertNotNull(inlet.getOutputs());
assertTrue(inlet.getInputs().isEmpty());
assertTrue(inlet.getOutputs().isEmpty());
} | void function() { Inlet inlet = new Inlet(); assertNotNull(inlet.getInputs()); assertNotNull(inlet.getOutputs()); assertTrue(inlet.getInputs().isEmpty()); assertTrue(inlet.getOutputs().isEmpty()); } | /**
* <p>
* Checks the construction of the component.
* </p>
*
*/ | Checks the construction of the component. | checkConstruction | {
"repo_name": "eclipse/ice",
"path": "org.eclipse.ice.tests.reactor.plant/src/org/eclipse/ice/tests/reactor/plant/InletTester.java",
"license": "epl-1.0",
"size": 8420
} | [
"org.eclipse.ice.reactor.plant.Inlet",
"org.junit.Assert"
] | import org.eclipse.ice.reactor.plant.Inlet; import org.junit.Assert; | import org.eclipse.ice.reactor.plant.*; import org.junit.*; | [
"org.eclipse.ice",
"org.junit"
] | org.eclipse.ice; org.junit; | 797,921 |
public boolean isExpired() {
return expiration != null && expiration.before(new Date());
} | boolean function() { return expiration != null && expiration.before(new Date()); } | /**
* Convenience method for checking expiration
*
* @return true if the expiration is befor ethe current time
*/ | Convenience method for checking expiration | isExpired | {
"repo_name": "ssxxue/spring-security-oauth",
"path": "spring-security-oauth2/src/main/java/org/springframework/security/oauth2/common/DefaultOAuth2AccessToken.java",
"license": "apache-2.0",
"size": 6128
} | [
"java.util.Date"
] | import java.util.Date; | import java.util.*; | [
"java.util"
] | java.util; | 1,751,837 |
@Override
public void assertEquals(String message, Object expectedObj, Object actualObj) {
ExampleSet expected = (ExampleSet) expectedObj;
ExampleSet actual = (ExampleSet) actualObj;
message = message + " - ExampleSets are not equal";
boolean compareAttributeDefaultValues = true;
if (expected.getExampleTable().size() > 0) {
compareAttributeDefaultValues = expected.getExampleTable().getDataRow(0) instanceof SparseDataRow;
}
// compare attributes
RapidAssert.assertEquals(message, expected.getAttributes(), actual.getAttributes(),
compareAttributeDefaultValues);
// compare number of examples
Assert.assertEquals(message + " (number of examples)", expected.size(), actual.size());
// compare example values
Iterator<Example> i1 = expected.iterator();
Iterator<Example> i2 = actual.iterator();
int row = 1;
while (i1.hasNext() && i2.hasNext()) {
RapidAssert.assertEquals(message + "(example number " + row + ", {0} value of {1})", i1.next(),
i2.next());
row++;
}
}
| void function(String message, Object expectedObj, Object actualObj) { ExampleSet expected = (ExampleSet) expectedObj; ExampleSet actual = (ExampleSet) actualObj; message = message + STR; boolean compareAttributeDefaultValues = true; if (expected.getExampleTable().size() > 0) { compareAttributeDefaultValues = expected.getExampleTable().getDataRow(0) instanceof SparseDataRow; } RapidAssert.assertEquals(message, expected.getAttributes(), actual.getAttributes(), compareAttributeDefaultValues); Assert.assertEquals(message + STR, expected.size(), actual.size()); Iterator<Example> i1 = expected.iterator(); Iterator<Example> i2 = actual.iterator(); int row = 1; while (i1.hasNext() && i2.hasNext()) { RapidAssert.assertEquals(message + STR + row + STR, i1.next(), i2.next()); row++; } } | /**
* Tests two example sets by iterating over all examples.
*
* @param message
* message to display if an error occurs
* @param expected
* expected value
* @param actual
* actual value
*/ | Tests two example sets by iterating over all examples | assertEquals | {
"repo_name": "brtonnies/rapidminer-studio",
"path": "src/main/java/com/rapidminer/test/asserter/AsserterFactoryRapidMiner.java",
"license": "agpl-3.0",
"size": 17983
} | [
"com.rapidminer.example.Example",
"com.rapidminer.example.ExampleSet",
"com.rapidminer.example.table.SparseDataRow",
"com.rapidminer.test_utils.RapidAssert",
"java.util.Iterator",
"org.junit.Assert"
] | import com.rapidminer.example.Example; import com.rapidminer.example.ExampleSet; import com.rapidminer.example.table.SparseDataRow; import com.rapidminer.test_utils.RapidAssert; import java.util.Iterator; import org.junit.Assert; | import com.rapidminer.example.*; import com.rapidminer.example.table.*; import com.rapidminer.test_utils.*; import java.util.*; import org.junit.*; | [
"com.rapidminer.example",
"com.rapidminer.test_utils",
"java.util",
"org.junit"
] | com.rapidminer.example; com.rapidminer.test_utils; java.util; org.junit; | 2,089,480 |
private static boolean equals(final Type[] t1, final Type[] t2) {
if (t1.length == t2.length) {
for (int i = 0; i < t1.length; i++) {
if (!equals(t1[i], t2[i])) {
return false;
}
}
return true;
}
return false;
}
/**
* Present a given type as a Java-esque String.
*
* @param type the type to create a String representation for, not {@code null} | static boolean function(final Type[] t1, final Type[] t2) { if (t1.length == t2.length) { for (int i = 0; i < t1.length; i++) { if (!equals(t1[i], t2[i])) { return false; } } return true; } return false; } /** * Present a given type as a Java-esque String. * * @param type the type to create a String representation for, not {@code null} | /**
* Learn whether {@code t1} equals {@code t2}.
*
* @param t1 LHS
* @param t2 RHS
* @return boolean
* @since 3.2
*/ | Learn whether t1 equals t2 | equals | {
"repo_name": "canoo/dolphin-platform",
"path": "platform/dolphin-platform-core/src/main/java/com/canoo/dp/impl/platform/core/commons/lang/TypeUtils.java",
"license": "apache-2.0",
"size": 52157
} | [
"java.lang.reflect.Type"
] | import java.lang.reflect.Type; | import java.lang.reflect.*; | [
"java.lang"
] | java.lang; | 2,123,069 |
public void onlineZooKeeperServers() {
Integer taskId = zkServerPortMap.get(myHostname);
if ((taskId != null) && (taskId.intValue() == taskPartition)) {
File zkDirFile = new File(this.zkDir);
try {
if (LOG.isInfoEnabled()) {
LOG.info("onlineZooKeeperServers: Trying to delete old " +
"directory " + this.zkDir);
}
FileUtils.deleteDirectory(zkDirFile);
} catch (IOException e) {
LOG.warn("onlineZooKeeperServers: Failed to delete " +
"directory " + this.zkDir, e);
}
generateZooKeeperConfigFile(
new ArrayList<String>(zkServerPortMap.keySet()));
ProcessBuilder processBuilder = new ProcessBuilder();
List<String> commandList = Lists.newArrayList();
String javaHome = System.getProperty("java.home");
if (javaHome == null) {
throw new IllegalArgumentException(
"onlineZooKeeperServers: java.home is not set!");
}
commandList.add(javaHome + "/bin/java");
String zkJavaOptsString =
conf.get(GiraphConfiguration.ZOOKEEPER_JAVA_OPTS,
GiraphConfiguration.ZOOKEEPER_JAVA_OPTS_DEFAULT);
String[] zkJavaOptsArray = zkJavaOptsString.split(" ");
if (zkJavaOptsArray != null) {
commandList.addAll(Arrays.asList(zkJavaOptsArray));
}
commandList.add("-cp");
Path fullJarPath = new Path(conf.get(GiraphConfiguration.ZOOKEEPER_JAR));
commandList.add(fullJarPath.toString());
commandList.add(QuorumPeerMain.class.getName());
commandList.add(configFilePath);
processBuilder.command(commandList);
File execDirectory = new File(zkDir);
processBuilder.directory(execDirectory);
processBuilder.redirectErrorStream(true);
if (LOG.isInfoEnabled()) {
LOG.info("onlineZooKeeperServers: Attempting to " +
"start ZooKeeper server with command " + commandList +
" in directory " + execDirectory.toString());
}
try {
synchronized (this) {
zkProcess = processBuilder.start();
zkProcessCollector =
new StreamCollector(zkProcess.getInputStream());
zkProcessCollector.start();
} | void function() { Integer taskId = zkServerPortMap.get(myHostname); if ((taskId != null) && (taskId.intValue() == taskPartition)) { File zkDirFile = new File(this.zkDir); try { if (LOG.isInfoEnabled()) { LOG.info(STR + STR + this.zkDir); } FileUtils.deleteDirectory(zkDirFile); } catch (IOException e) { LOG.warn(STR + STR + this.zkDir, e); } generateZooKeeperConfigFile( new ArrayList<String>(zkServerPortMap.keySet())); ProcessBuilder processBuilder = new ProcessBuilder(); List<String> commandList = Lists.newArrayList(); String javaHome = System.getProperty(STR); if (javaHome == null) { throw new IllegalArgumentException( STR); } commandList.add(javaHome + STR); String zkJavaOptsString = conf.get(GiraphConfiguration.ZOOKEEPER_JAVA_OPTS, GiraphConfiguration.ZOOKEEPER_JAVA_OPTS_DEFAULT); String[] zkJavaOptsArray = zkJavaOptsString.split(" "); if (zkJavaOptsArray != null) { commandList.addAll(Arrays.asList(zkJavaOptsArray)); } commandList.add("-cp"); Path fullJarPath = new Path(conf.get(GiraphConfiguration.ZOOKEEPER_JAR)); commandList.add(fullJarPath.toString()); commandList.add(QuorumPeerMain.class.getName()); commandList.add(configFilePath); processBuilder.command(commandList); File execDirectory = new File(zkDir); processBuilder.directory(execDirectory); processBuilder.redirectErrorStream(true); if (LOG.isInfoEnabled()) { LOG.info(STR + STR + commandList + STR + execDirectory.toString()); } try { synchronized (this) { zkProcess = processBuilder.start(); zkProcessCollector = new StreamCollector(zkProcess.getInputStream()); zkProcessCollector.start(); } | /**
* If this task has been selected, online a ZooKeeper server. Otherwise,
* wait until this task knows that the ZooKeeper servers have been onlined.
*/ | If this task has been selected, online a ZooKeeper server. Otherwise, wait until this task knows that the ZooKeeper servers have been onlined | onlineZooKeeperServers | {
"repo_name": "aljoscha/giraph",
"path": "src/main/java/org/apache/giraph/zk/ZooKeeperManager.java",
"license": "apache-2.0",
"size": 32143
} | [
"com.google.common.collect.Lists",
"java.io.File",
"java.io.IOException",
"java.util.ArrayList",
"java.util.Arrays",
"java.util.List",
"org.apache.commons.io.FileUtils",
"org.apache.giraph.GiraphConfiguration",
"org.apache.hadoop.fs.Path",
"org.apache.zookeeper.server.quorum.QuorumPeerMain"
] | import com.google.common.collect.Lists; import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import org.apache.commons.io.FileUtils; import org.apache.giraph.GiraphConfiguration; import org.apache.hadoop.fs.Path; import org.apache.zookeeper.server.quorum.QuorumPeerMain; | import com.google.common.collect.*; import java.io.*; import java.util.*; import org.apache.commons.io.*; import org.apache.giraph.*; import org.apache.hadoop.fs.*; import org.apache.zookeeper.server.quorum.*; | [
"com.google.common",
"java.io",
"java.util",
"org.apache.commons",
"org.apache.giraph",
"org.apache.hadoop",
"org.apache.zookeeper"
] | com.google.common; java.io; java.util; org.apache.commons; org.apache.giraph; org.apache.hadoop; org.apache.zookeeper; | 2,086,358 |
public synchronized DataTypeLong querySize(SQLiteDatabase db) {
long totalst = System.currentTimeMillis();
insertDB(db, TABLE_NAME);
String sql = "select count(_id)as c from data";
Cursor mCursor = db.rawQuery(sql, null);
DataTypeLong count = new DataTypeLong(0L, 0L);
if (mCursor.moveToFirst()) {
do {
count = new DataTypeLong(0L, mCursor.getLong(mCursor.getColumnIndex(C_COUNT)));
} while (mCursor.moveToNext());
}
mCursor.close();
return count;
} | synchronized DataTypeLong function(SQLiteDatabase db) { long totalst = System.currentTimeMillis(); insertDB(db, TABLE_NAME); String sql = STR; Cursor mCursor = db.rawQuery(sql, null); DataTypeLong count = new DataTypeLong(0L, 0L); if (mCursor.moveToFirst()) { do { count = new DataTypeLong(0L, mCursor.getLong(mCursor.getColumnIndex(C_COUNT))); } while (mCursor.moveToNext()); } mCursor.close(); return count; } | /**
* Returns the number of rows in the query.
*
* @param db Database
* @return The number of rows in the query.
*/ | Returns the number of rows in the query | querySize | {
"repo_name": "MD2Korg/mCerebrum-DataKit",
"path": "datakit/src/main/java/org/md2k/datakit/logger/DatabaseTable_Data.java",
"license": "bsd-2-clause",
"size": 29267
} | [
"android.database.Cursor",
"android.database.sqlite.SQLiteDatabase",
"org.md2k.datakitapi.datatype.DataTypeLong"
] | import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import org.md2k.datakitapi.datatype.DataTypeLong; | import android.database.*; import android.database.sqlite.*; import org.md2k.datakitapi.datatype.*; | [
"android.database",
"org.md2k.datakitapi"
] | android.database; org.md2k.datakitapi; | 464,495 |
@JsonProperty("rows")
public List<Object[]> getRowsAsList()
{
return rows instanceof List ? ((List<Object[]>) rows) : Lists.newArrayList(rows);
} | @JsonProperty("rows") List<Object[]> function() { return rows instanceof List ? ((List<Object[]>) rows) : Lists.newArrayList(rows); } | /**
* Returns rows as a list. If the original Iterable behind this datasource was a List, this method will return it
* as-is, without copying it. Otherwise, this method will walk the iterable and copy it into a List before returning.
*/ | Returns rows as a list. If the original Iterable behind this datasource was a List, this method will return it as-is, without copying it. Otherwise, this method will walk the iterable and copy it into a List before returning | getRowsAsList | {
"repo_name": "nishantmonu51/druid",
"path": "processing/src/main/java/org/apache/druid/query/InlineDataSource.java",
"license": "apache-2.0",
"size": 8206
} | [
"com.fasterxml.jackson.annotation.JsonProperty",
"com.google.common.collect.Lists",
"java.util.List"
] | import com.fasterxml.jackson.annotation.JsonProperty; import com.google.common.collect.Lists; import java.util.List; | import com.fasterxml.jackson.annotation.*; import com.google.common.collect.*; import java.util.*; | [
"com.fasterxml.jackson",
"com.google.common",
"java.util"
] | com.fasterxml.jackson; com.google.common; java.util; | 577,655 |
private boolean shouldCreateCompactIndex(FunctionalIndexCreationHelper helper) {
if (RANGEINDEX_ONLY || TEST_RANGEINDEX_ONLY){
return false;
}
// compact range index is not supported on asynchronous index maintenance.
// since compact range index maintains reference to region entry, in case of
// asynchronous updates the window between cache operation updating the
// index increases causing query thread to return new value before doing
// index evaluation (resulting in wrong value. There is still a small window
// which can be addressed by the sys property:
// gemfire.index.acquireCompactIndexLocksWithRegionEntryLocks
if (!getRegion().getAttributes().getIndexMaintenanceSynchronous()) {
return false;
}
// indexedExpression requirement
CompiledValue cv = helper.getCompiledIndexedExpression();
int nodeType;
do {
nodeType = cv.getType();
if (nodeType == CompiledValue.PATH) {
cv = ((CompiledPath)cv).getReceiver();
}
} while (nodeType == CompiledValue.PATH);
// end of path, nodeType at this point should be an Identifier
if (nodeType != OQLLexerTokenTypes.Identifier && nodeType != OQLLexerTokenTypes.METHOD_INV) {
return false;
}
// fromClause requirement
List iterators = helper.getIterators();
if (iterators.size() != 1) {
return false;
}
// "missing link" must be "value". Later to support key, entry, etc.
CompiledValue missingLink = helper.missingLink;
if (helper.isFirstIteratorRegionEntry) {
return true;
} else if (!(missingLink instanceof CompiledPath)) {
return false;
}
String tailId = ((CompiledPath)missingLink).getTailID();
if (!(tailId.equals("value") || tailId.equals("key"))) {
return false;
}
return true;
} | boolean function(FunctionalIndexCreationHelper helper) { if (RANGEINDEX_ONLY TEST_RANGEINDEX_ONLY){ return false; } if (!getRegion().getAttributes().getIndexMaintenanceSynchronous()) { return false; } CompiledValue cv = helper.getCompiledIndexedExpression(); int nodeType; do { nodeType = cv.getType(); if (nodeType == CompiledValue.PATH) { cv = ((CompiledPath)cv).getReceiver(); } } while (nodeType == CompiledValue.PATH); if (nodeType != OQLLexerTokenTypes.Identifier && nodeType != OQLLexerTokenTypes.METHOD_INV) { return false; } List iterators = helper.getIterators(); if (iterators.size() != 1) { return false; } CompiledValue missingLink = helper.missingLink; if (helper.isFirstIteratorRegionEntry) { return true; } else if (!(missingLink instanceof CompiledPath)) { return false; } String tailId = ((CompiledPath)missingLink).getTailID(); if (!(tailId.equals("value") tailId.equals("key"))) { return false; } return true; } | /**
* Return true if we should create CompactRangeIndex
* Required conditions: indexedExpression is a path expression,
* fromClause has only one iterator and it is directly on the
* region values.
* Currently we have to use the "fat" implementation when asynchronous
* index updates are on.
*/ | Return true if we should create CompactRangeIndex Required conditions: indexedExpression is a path expression, fromClause has only one iterator and it is directly on the region values. Currently we have to use the "fat" implementation when asynchronous index updates are on | shouldCreateCompactIndex | {
"repo_name": "SnappyDataInc/snappy-store",
"path": "gemfire-core/src/main/java/com/gemstone/gemfire/cache/query/internal/index/IndexManager.java",
"license": "apache-2.0",
"size": 59015
} | [
"com.gemstone.gemfire.cache.query.internal.CompiledPath",
"com.gemstone.gemfire.cache.query.internal.CompiledValue",
"com.gemstone.gemfire.cache.query.internal.parse.OQLLexerTokenTypes",
"java.util.List"
] | import com.gemstone.gemfire.cache.query.internal.CompiledPath; import com.gemstone.gemfire.cache.query.internal.CompiledValue; import com.gemstone.gemfire.cache.query.internal.parse.OQLLexerTokenTypes; import java.util.List; | import com.gemstone.gemfire.cache.query.internal.*; import com.gemstone.gemfire.cache.query.internal.parse.*; import java.util.*; | [
"com.gemstone.gemfire",
"java.util"
] | com.gemstone.gemfire; java.util; | 2,750,937 |
public SqlParserPos plusAll(SqlNode[] nodes) {
return plusAll(Arrays.asList(nodes));
} | SqlParserPos function(SqlNode[] nodes) { return plusAll(Arrays.asList(nodes)); } | /**
* Combines this parser position with an array of positions to create a
* position that spans from the first point in the first to the last point
* in the other.
*/ | Combines this parser position with an array of positions to create a position that spans from the first point in the first to the last point in the other | plusAll | {
"repo_name": "arina-ielchiieva/calcite",
"path": "core/src/main/java/org/apache/calcite/sql/parser/SqlParserPos.java",
"license": "apache-2.0",
"size": 8973
} | [
"java.util.Arrays",
"org.apache.calcite.sql.SqlNode"
] | import java.util.Arrays; import org.apache.calcite.sql.SqlNode; | import java.util.*; import org.apache.calcite.sql.*; | [
"java.util",
"org.apache.calcite"
] | java.util; org.apache.calcite; | 2,262,725 |
final Metrics metrics = new Metrics(plugin); | final Metrics metrics = new Metrics(plugin); | /**
* Sends bstats metrics.
*
* @param plugin the plugin instance
* @param settings the settings
*/ | Sends bstats metrics | sendMetrics | {
"repo_name": "Krokit/AuthMeReloaded",
"path": "src/main/java/fr/xephi/authme/initialization/OnStartupTasks.java",
"license": "gpl-3.0",
"size": 5168
} | [
"org.bstats.Metrics"
] | import org.bstats.Metrics; | import org.bstats.*; | [
"org.bstats"
] | org.bstats; | 377,216 |
private boolean connect(String address, int port) {
LOG.info("Trying to connect to HWg-STE device on address " + address + ':' + port);
try {
//TimedSocket is a non-blocking socket with timeout on exception
socket = TimedSocket.getSocket(address, port, SOCKET_TIMEOUT);
socket.setSoTimeout(SOCKET_TIMEOUT); //SOCKET_TIMEOUT ms of waiting on socket read/write
BufferedOutputStream buffOut = new BufferedOutputStream(socket.getOutputStream());
outputStream = new DataOutputStream(buffOut);
return true;
} catch (IOException e) {
LOG.error("Unable to connect to host " + address + " on port " + port);
return false;
}
} | boolean function(String address, int port) { LOG.info(STR + address + ':' + port); try { socket = TimedSocket.getSocket(address, port, SOCKET_TIMEOUT); socket.setSoTimeout(SOCKET_TIMEOUT); BufferedOutputStream buffOut = new BufferedOutputStream(socket.getOutputStream()); outputStream = new DataOutputStream(buffOut); return true; } catch (IOException e) { LOG.error(STR + address + STR + port); return false; } } | /**
* Connection to boards
*/ | Connection to boards | connect | {
"repo_name": "abollaert/freedomotic",
"path": "plugins/devices/hwg-ste/src/main/java/com/freedomotic/plugins/devices/hwgste/HwgSte.java",
"license": "gpl-2.0",
"size": 10122
} | [
"java.io.BufferedOutputStream",
"java.io.DataOutputStream",
"java.io.IOException"
] | import java.io.BufferedOutputStream; import java.io.DataOutputStream; import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 143,283 |
List<UiElement> list = new ArrayList<>(elements);
Collections.sort(list, ELEMENT_COMPARATOR);
return list;
} | List<UiElement> list = new ArrayList<>(elements); Collections.sort(list, ELEMENT_COMPARATOR); return list; } | /**
* Returns the given elements in a list, sorted by string representation
* of the identifiers.
*
* @param elements the elements to sort
* @return the sorted elements
*/ | Returns the given elements in a list, sorted by string representation of the identifiers | sorted | {
"repo_name": "LorenzReinhart/ONOSnew",
"path": "web/gui/src/main/java/org/onosproject/ui/impl/topo/cli/AbstractUiCacheElementCommand.java",
"license": "apache-2.0",
"size": 1635
} | [
"java.util.ArrayList",
"java.util.Collections",
"java.util.List",
"org.onosproject.ui.model.topo.UiElement"
] | import java.util.ArrayList; import java.util.Collections; import java.util.List; import org.onosproject.ui.model.topo.UiElement; | import java.util.*; import org.onosproject.ui.model.topo.*; | [
"java.util",
"org.onosproject.ui"
] | java.util; org.onosproject.ui; | 2,398,098 |
@Override
public void nextTerm(long term) throws IOException {
if (hasCurrentTerm && term <= currentTerm) throw new IllegalArgumentException("terms must be in sorted order: "+term+" is not greater than "+currentTerm);
internalNextTerm();
hasCurrentTerm = true;
currentTerm = term;
} | void function(long term) throws IOException { if (hasCurrentTerm && term <= currentTerm) throw new IllegalArgumentException(STR+term+STR+currentTerm); internalNextTerm(); hasCurrentTerm = true; currentTerm = term; } | /**
* switch terms
*
* @param term the term to switch to
* @throws IOException if there is a file write error
* @throws IllegalArgumentException if term is negative or if term is less than or equal to the previous term added
*/ | switch terms | nextTerm | {
"repo_name": "indeedeng/imhotep",
"path": "imhotep-server/src/main/java/com/indeed/flamdex/simple/SimpleIntFieldWriter.java",
"license": "apache-2.0",
"size": 3523
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 401,281 |
public void purgePcjTable(final Connector accumuloConn, final String pcjTableName) throws PCJStorageException {
checkNotNull(accumuloConn);
checkNotNull(pcjTableName);
// Fetch the metadaata from the PCJ table.
final PcjMetadata oldMetadata = getPcjMetadata(accumuloConn, pcjTableName);
// Delete all of the rows
try {
accumuloConn.tableOperations().deleteRows(pcjTableName, null, null);
} catch (AccumuloException | AccumuloSecurityException | TableNotFoundException e) {
throw new PCJStorageException("Could not delete the rows of data from PCJ table named: " + pcjTableName, e);
}
// Store the new metadata.
final PcjMetadata newMetadata = new PcjMetadata(oldMetadata.getSparql(), 0L, oldMetadata.getVarOrders());
final List<Mutation> mutations = makeWriteMetadataMutations(newMetadata);
BatchWriter writer = null;
try {
writer = accumuloConn.createBatchWriter(pcjTableName, new BatchWriterConfig());
writer.addMutations(mutations);
writer.flush();
} catch (final TableNotFoundException | MutationsRejectedException e) {
throw new PCJStorageException("Could not rewrite the PCJ cardinality for table named '"
+ pcjTableName + "'. This table will not work anymore.", e);
} finally {
if(writer != null) {
try {
writer.close();
} catch (final MutationsRejectedException e) {
throw new PCJStorageException("Could not close the batch writer.", e);
}
}
}
} | void function(final Connector accumuloConn, final String pcjTableName) throws PCJStorageException { checkNotNull(accumuloConn); checkNotNull(pcjTableName); final PcjMetadata oldMetadata = getPcjMetadata(accumuloConn, pcjTableName); try { accumuloConn.tableOperations().deleteRows(pcjTableName, null, null); } catch (AccumuloException AccumuloSecurityException TableNotFoundException e) { throw new PCJStorageException(STR + pcjTableName, e); } final PcjMetadata newMetadata = new PcjMetadata(oldMetadata.getSparql(), 0L, oldMetadata.getVarOrders()); final List<Mutation> mutations = makeWriteMetadataMutations(newMetadata); BatchWriter writer = null; try { writer = accumuloConn.createBatchWriter(pcjTableName, new BatchWriterConfig()); writer.addMutations(mutations); writer.flush(); } catch (final TableNotFoundException MutationsRejectedException e) { throw new PCJStorageException(STR + pcjTableName + STR, e); } finally { if(writer != null) { try { writer.close(); } catch (final MutationsRejectedException e) { throw new PCJStorageException(STR, e); } } } } | /**
* Deletes all of the rows that are in a PCJ index and sets its cardinality back to 0.
*
* @param accumuloConn - Connects to the Accumulo that hosts the PCJ indices. (not null)
* @param pcjTableName - The name of the PCJ table that will be purged. (not null)
* @throws PCJStorageException Either the rows could not be dropped from the
* PCJ table or the metadata could not be written back to the table.
*/ | Deletes all of the rows that are in a PCJ index and sets its cardinality back to 0 | purgePcjTable | {
"repo_name": "meiercaleb/incubator-rya",
"path": "extras/rya.indexing.pcj/src/main/java/org/apache/rya/indexing/pcj/storage/accumulo/PcjTables.java",
"license": "apache-2.0",
"size": 34866
} | [
"com.google.common.base.Preconditions",
"java.util.List",
"org.apache.accumulo.core.client.AccumuloException",
"org.apache.accumulo.core.client.AccumuloSecurityException",
"org.apache.accumulo.core.client.BatchWriter",
"org.apache.accumulo.core.client.BatchWriterConfig",
"org.apache.accumulo.core.client.Connector",
"org.apache.accumulo.core.client.MutationsRejectedException",
"org.apache.accumulo.core.client.TableNotFoundException",
"org.apache.accumulo.core.data.Mutation",
"org.apache.rya.indexing.pcj.storage.PcjMetadata",
"org.apache.rya.indexing.pcj.storage.PrecomputedJoinStorage"
] | import com.google.common.base.Preconditions; import java.util.List; import org.apache.accumulo.core.client.AccumuloException; import org.apache.accumulo.core.client.AccumuloSecurityException; import org.apache.accumulo.core.client.BatchWriter; import org.apache.accumulo.core.client.BatchWriterConfig; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.MutationsRejectedException; import org.apache.accumulo.core.client.TableNotFoundException; import org.apache.accumulo.core.data.Mutation; import org.apache.rya.indexing.pcj.storage.PcjMetadata; import org.apache.rya.indexing.pcj.storage.PrecomputedJoinStorage; | import com.google.common.base.*; import java.util.*; import org.apache.accumulo.core.client.*; import org.apache.accumulo.core.data.*; import org.apache.rya.indexing.pcj.storage.*; | [
"com.google.common",
"java.util",
"org.apache.accumulo",
"org.apache.rya"
] | com.google.common; java.util; org.apache.accumulo; org.apache.rya; | 1,716,693 |
@Override
public Iterator<Field> iterator() {
return this.fields.iterator();
} | Iterator<Field> function() { return this.fields.iterator(); } | /**
* <p>Allows the {@link Field}s enveloped by this instance of {@link Fields} to be traversed
* sequentially using the returned {@link Iterator}.</p>
*
* <p><b>Note</b> this {@link Iterator} does not allow the underlying {@link Field}s to be modified,
* for example using {@link Iterator#remove()}. Doing so will result in an
* {@link UnsupportedOperationException}.</p>
*
* @return the iterator which allows the enclosed {@link Field}s to traversed sequentially
* <br><br>
* @since 0.1.0
*/ | Allows the <code>Field</code>s enveloped by this instance of <code>Fields</code> to be traversed sequentially using the returned <code>Iterator</code>. Note this <code>Iterator</code> does not allow the underlying <code>Field</code>s to be modified, for example using <code>Iterator#remove()</code>. Doing so will result in an <code>UnsupportedOperationException</code> | iterator | {
"repo_name": "sahan/Sneeze",
"path": "src/main/java/com/lonepulse/sneeze/reflection/Fields.java",
"license": "apache-2.0",
"size": 13796
} | [
"java.lang.reflect.Field",
"java.util.Iterator"
] | import java.lang.reflect.Field; import java.util.Iterator; | import java.lang.reflect.*; import java.util.*; | [
"java.lang",
"java.util"
] | java.lang; java.util; | 1,837,252 |
protected void update(float interpolation) {
// update the time to get the framerate
timer.update();
interpolation = timer.getTimePerFrame();
//update the keyboard input (move the player around)
input.update(interpolation);
//update the chase camera to handle the player moving around.
chaser.update(interpolation);
fence.update(interpolation);
//we want to keep the skybox around our eyes, so move it with
//the camera
skybox.setLocalTranslation(cam.getLocation());
// if escape was pressed, we exit
if (KeyBindingManager.getKeyBindingManager().isValidCommand("exit")) {
finished = true;
}
//We don't want the chase camera to go below the world, so always keep
//it 2 units above the level.
if(cam.getLocation().y < (tb.getHeight(cam.getLocation())+2)) {
cam.getLocation().y = tb.getHeight(cam.getLocation()) + 2;
cam.update();
}
//make sure that if the player left the level we don't crash. When we add collisions,
//the fence will do its job and keep the player inside.
float characterMinHeight = tb.getHeight(player
.getLocalTranslation())+((BoundingBox)player.getWorldBound()).yExtent;
if (!Float.isInfinite(characterMinHeight) && !Float.isNaN(characterMinHeight)) {
player.getLocalTranslation().y = characterMinHeight;
}
//get the normal of the terrain at our current location. We then apply it to the up vector
//of the player.
tb.getSurfaceNormal(player.getLocalTranslation(), normal);
if(normal != null) {
player.rotateUpTo(normal);
}
//Because we are changing the scene (moving the skybox and player) we need to update
//the graph.
scene.updateGeometricState(interpolation, true);
} | void function(float interpolation) { timer.update(); interpolation = timer.getTimePerFrame(); input.update(interpolation); chaser.update(interpolation); fence.update(interpolation); skybox.setLocalTranslation(cam.getLocation()); if (KeyBindingManager.getKeyBindingManager().isValidCommand("exit")) { finished = true; } if(cam.getLocation().y < (tb.getHeight(cam.getLocation())+2)) { cam.getLocation().y = tb.getHeight(cam.getLocation()) + 2; cam.update(); } float characterMinHeight = tb.getHeight(player .getLocalTranslation())+((BoundingBox)player.getWorldBound()).yExtent; if (!Float.isInfinite(characterMinHeight) && !Float.isNaN(characterMinHeight)) { player.getLocalTranslation().y = characterMinHeight; } tb.getSurfaceNormal(player.getLocalTranslation(), normal); if(normal != null) { player.rotateUpTo(normal); } scene.updateGeometricState(interpolation, true); } | /**
* During an update we look for the escape button and update the timer
* to get the framerate. Things are now starting to happen, so we will
* update
*
* @see com.jme.app.BaseGame#update(float)
*/ | During an update we look for the escape button and update the timer to get the framerate. Things are now starting to happen, so we will update | update | {
"repo_name": "tectronics/xenogeddon",
"path": "src/jmetest/flagrushtut/lesson7/Lesson7.java",
"license": "gpl-2.0",
"size": 20582
} | [
"com.jme.bounding.BoundingBox",
"com.jme.input.KeyBindingManager"
] | import com.jme.bounding.BoundingBox; import com.jme.input.KeyBindingManager; | import com.jme.bounding.*; import com.jme.input.*; | [
"com.jme.bounding",
"com.jme.input"
] | com.jme.bounding; com.jme.input; | 137,958 |
public void onDrop() {
// check if the list wad in drag & drop mode
if (null != mDraggedView) {
// remove the overlay child view
ViewGroup viewParent = (ViewGroup) mDraggedView.getParent();
viewParent.removeView(mDraggedView);
mDraggedView = null;
// hide the overlay layout
mSelectedCellLayout.setVisibility(View.GONE);
// same place, nothing to do
if ((mOriginGroupPosition == mDestGroupPosition) && (mOriginChildPosition == mDestChildPosition)) {
stopDragAndDropMode();
}
// move in no tag sections
else if (mAdapter.isNoTagRoomPosition(mOriginGroupPosition) && mAdapter.isNoTagRoomPosition(mDestGroupPosition)) {
// nothing to do, there is no other
stopDragAndDropMode();
} else if (!groupIsMovable(mDestGroupPosition)) {
// cannot move in the expected group
stopDragAndDropMode();
} else {
// retrieve the moved summary
RoomSummary roomSummary = mAdapter.getRoomSummaryAt(mDestGroupPosition, mDestChildPosition);
// its tag
String dstRoomTag = roomTagAt(mDestGroupPosition);
// compute the new tag order
int oldPos = (mOriginGroupPosition == mDestGroupPosition) ? mOriginChildPosition : Integer.MAX_VALUE;
Double tagOrder = mSession.tagOrderToBeAtIndex(mDestChildPosition, oldPos, dstRoomTag);
updateRoomTag(mSession, roomSummary.getRoomId(), tagOrder, dstRoomTag);
}
}
} | void function() { if (null != mDraggedView) { ViewGroup viewParent = (ViewGroup) mDraggedView.getParent(); viewParent.removeView(mDraggedView); mDraggedView = null; mSelectedCellLayout.setVisibility(View.GONE); if ((mOriginGroupPosition == mDestGroupPosition) && (mOriginChildPosition == mDestChildPosition)) { stopDragAndDropMode(); } else if (mAdapter.isNoTagRoomPosition(mOriginGroupPosition) && mAdapter.isNoTagRoomPosition(mDestGroupPosition)) { stopDragAndDropMode(); } else if (!groupIsMovable(mDestGroupPosition)) { stopDragAndDropMode(); } else { RoomSummary roomSummary = mAdapter.getRoomSummaryAt(mDestGroupPosition, mDestChildPosition); String dstRoomTag = roomTagAt(mDestGroupPosition); int oldPos = (mOriginGroupPosition == mDestGroupPosition) ? mOriginChildPosition : Integer.MAX_VALUE; Double tagOrder = mSession.tagOrderToBeAtIndex(mDestChildPosition, oldPos, dstRoomTag); updateRoomTag(mSession, roomSummary.getRoomId(), tagOrder, dstRoomTag); } } } | /**
* The drag ends.
*/ | The drag ends | onDrop | {
"repo_name": "noepitome/neon-android",
"path": "neon/src/main/java/im/neon/fragments/VectorRecentsListFragment.java",
"license": "apache-2.0",
"size": 46487
} | [
"android.view.View",
"android.view.ViewGroup",
"org.matrix.androidsdk.data.RoomSummary"
] | import android.view.View; import android.view.ViewGroup; import org.matrix.androidsdk.data.RoomSummary; | import android.view.*; import org.matrix.androidsdk.data.*; | [
"android.view",
"org.matrix.androidsdk"
] | android.view; org.matrix.androidsdk; | 1,468,371 |
public GeoDistanceAggregatorBuilder addUnboundedTo(String key, double to) {
ranges.add(new Range(key, null, to));
return this;
} | GeoDistanceAggregatorBuilder function(String key, double to) { ranges.add(new Range(key, null, to)); return this; } | /**
* Add a new range with no lower bound.
*
* @param key
* the key to use for this range in the response
* @param to
* the upper bound on the distances, exclusive
*/ | Add a new range with no lower bound | addUnboundedTo | {
"repo_name": "mmaracic/elasticsearch",
"path": "core/src/main/java/org/elasticsearch/search/aggregations/bucket/range/geodistance/GeoDistanceAggregatorBuilder.java",
"license": "apache-2.0",
"size": 9228
} | [
"org.elasticsearch.search.aggregations.bucket.range.geodistance.GeoDistanceParser"
] | import org.elasticsearch.search.aggregations.bucket.range.geodistance.GeoDistanceParser; | import org.elasticsearch.search.aggregations.bucket.range.geodistance.*; | [
"org.elasticsearch.search"
] | org.elasticsearch.search; | 119,923 |
public static List<JVMOption> getOptionsWithRange(String... additionalArgs) throws Exception {
return getOptionsWithRange(origin -> true, additionalArgs);
} | static List<JVMOption> function(String... additionalArgs) throws Exception { return getOptionsWithRange(origin -> true, additionalArgs); } | /**
* Get JVM options with ranges as list.
*
* @param additionalArgs additional arguments to the Java process which ran
* with "-XX:+PrintFlagsRanges"
* @return list of options
* @throws Exception if a new process can not be created or an error
* occurred while reading the data
*/ | Get JVM options with ranges as list | getOptionsWithRange | {
"repo_name": "gaoxiaojun/dync",
"path": "test/runtime/CommandLine/OptionsValidation/common/optionsvalidation/JVMOptionsUtils.java",
"license": "gpl-2.0",
"size": 18971
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,074,257 |
public static Resource CASGEN() {
return ResourceFactory.createResource("http://research.calacademy.org/research/ichthyology/catalog/getname.asp?rank=Genus&id=");
} | static Resource function() { return ResourceFactory.createResource("http: } | /**
* Returns the link-out URI for objects of "Catalog of Fishes genus database".
*/ | Returns the link-out URI for objects of "Catalog of Fishes genus database" | CASGEN | {
"repo_name": "BioInterchange/BioInterchange",
"path": "supplemental/java/biointerchange/src/main/java/org/biointerchange/vocabulary/GOXRef.java",
"license": "mit",
"size": 41277
} | [
"com.hp.hpl.jena.rdf.model.Resource",
"com.hp.hpl.jena.rdf.model.ResourceFactory"
] | import com.hp.hpl.jena.rdf.model.Resource; import com.hp.hpl.jena.rdf.model.ResourceFactory; | import com.hp.hpl.jena.rdf.model.*; | [
"com.hp.hpl"
] | com.hp.hpl; | 2,193,328 |
public JLabel getIconLabel() {
return label;
} | JLabel function() { return label; } | /**
* Obtain a JLabel instance set with this file type's icon. The same JLabel
* is returned from each call of this method.
*
* @return the label.
*/ | Obtain a JLabel instance set with this file type's icon. The same JLabel is returned from each call of this method | getIconLabel | {
"repo_name": "motokito/jabref",
"path": "src/main/java/net/sf/jabref/external/ExternalFileType.java",
"license": "mit",
"size": 7063
} | [
"javax.swing.JLabel"
] | import javax.swing.JLabel; | import javax.swing.*; | [
"javax.swing"
] | javax.swing; | 1,784,666 |
final List<ItemInformationMap> result = new ArrayList<ItemInformationMap>();
for (final MusicData inMusic : MusicData.SIGNATURES) {
result.add(new ItemInformationMap(inParam.getCaller(), inMusic));
}
return result;
} | final List<ItemInformationMap> result = new ArrayList<ItemInformationMap>(); for (final MusicData inMusic : MusicData.SIGNATURES) { result.add(new ItemInformationMap(inParam.getCaller(), inMusic)); } return result; } | /**
* Returns all signatures
*
* @see
*/ | Returns all signatures | doProcessRequest | {
"repo_name": "sebastienhouzet/nabaztag-source-code",
"path": "server/OS/net/violet/platform/api/actions/libraries/GetForSignature.java",
"license": "mit",
"size": 1434
} | [
"java.util.ArrayList",
"java.util.List",
"net.violet.platform.api.maps.ItemInformationMap",
"net.violet.platform.dataobjects.MusicData"
] | import java.util.ArrayList; import java.util.List; import net.violet.platform.api.maps.ItemInformationMap; import net.violet.platform.dataobjects.MusicData; | import java.util.*; import net.violet.platform.api.maps.*; import net.violet.platform.dataobjects.*; | [
"java.util",
"net.violet.platform"
] | java.util; net.violet.platform; | 2,214,619 |
public static HashMap<String, ServiceAttributeTypeStatistics> resolveStatistics(HashMap<String, ServiceAttributeType> typeMap,
List<ServiceManifestation> serviceManifestations) {
if (typeMap == null) {
System.out.println(AttributeTypeStatisticsResolver.class.getName() + " - Type map is null.");
return null;
}
if (typeMap.keySet().size() <= 0) {
System.out.println(AttributeTypeStatisticsResolver.class.getName() + " - Type map is empty.");
return null;
}
if (serviceManifestations == null) {
System.out.println(AttributeTypeStatisticsResolver.class.getName() + " - List of service manifestations is null.");
return null;
}
if (serviceManifestations.size() <= 0) {
System.out.println(AttributeTypeStatisticsResolver.class.getName() + " - List of service manifestations is empty.");
return null;
}
HashMap<String, ServiceAttributeTypeStatistics> typeStatsMap = new HashMap<String, ServiceAttributeTypeStatistics>();
for (String typeUri : typeMap.keySet()) {
ServiceAttributeTypeStatistics stats = new ServiceAttributeTypeStatistics();
stats.setUri(typeUri);
typeStatsMap.put(typeUri, stats);
}
for (ServiceManifestation serviceManifestation : serviceManifestations) {
getStatisticsFromAttributeList(serviceManifestation.getAttributes(), typeStatsMap, typeMap);
}
normalizeProbabilities(typeStatsMap);
return typeStatsMap;
} | static HashMap<String, ServiceAttributeTypeStatistics> function(HashMap<String, ServiceAttributeType> typeMap, List<ServiceManifestation> serviceManifestations) { if (typeMap == null) { System.out.println(AttributeTypeStatisticsResolver.class.getName() + STR); return null; } if (typeMap.keySet().size() <= 0) { System.out.println(AttributeTypeStatisticsResolver.class.getName() + STR); return null; } if (serviceManifestations == null) { System.out.println(AttributeTypeStatisticsResolver.class.getName() + STR); return null; } if (serviceManifestations.size() <= 0) { System.out.println(AttributeTypeStatisticsResolver.class.getName() + STR); return null; } HashMap<String, ServiceAttributeTypeStatistics> typeStatsMap = new HashMap<String, ServiceAttributeTypeStatistics>(); for (String typeUri : typeMap.keySet()) { ServiceAttributeTypeStatistics stats = new ServiceAttributeTypeStatistics(); stats.setUri(typeUri); typeStatsMap.put(typeUri, stats); } for (ServiceManifestation serviceManifestation : serviceManifestations) { getStatisticsFromAttributeList(serviceManifestation.getAttributes(), typeStatsMap, typeMap); } normalizeProbabilities(typeStatsMap); return typeStatsMap; } | /**
* Creates a HashMap of statistics as resolved from the given types and service manifestations. This method includes the also increases
* the probabilities of broader types when a narrower type was found.
*
* @param typeMap
* @param serviceManifestations
* @return Returns a HashMap with type uris as keys. Returns null if typMap or serviceManifestations are null or empty.
*/ | Creates a HashMap of statistics as resolved from the given types and service manifestations. This method includes the also increases the probabilities of broader types when a narrower type was found | resolveStatistics | {
"repo_name": "Fiware/apps.WMarket",
"path": "src/main/java/org/fiware/apps/marketplace/helpers/AttributeTypeStatisticsResolver.java",
"license": "bsd-3-clause",
"size": 8594
} | [
"java.util.HashMap",
"java.util.List",
"org.fiware.apps.marketplace.model.ServiceAttributeType",
"org.fiware.apps.marketplace.model.ServiceAttributeTypeStatistics",
"org.fiware.apps.marketplace.model.ServiceManifestation"
] | import java.util.HashMap; import java.util.List; import org.fiware.apps.marketplace.model.ServiceAttributeType; import org.fiware.apps.marketplace.model.ServiceAttributeTypeStatistics; import org.fiware.apps.marketplace.model.ServiceManifestation; | import java.util.*; import org.fiware.apps.marketplace.model.*; | [
"java.util",
"org.fiware.apps"
] | java.util; org.fiware.apps; | 1,521,748 |
protected void createSetterMethod(ClassNode declaringClass, PropertyNode propertyNode, String setterName, Statement setterBlock) {
ClassNode[] exceptions = {ClassHelper.make(PropertyVetoException.class)};
MethodNode setter = new MethodNode(
setterName,
PropertyNodeUtils.adjustPropertyModifiersForMethod(propertyNode),
ClassHelper.VOID_TYPE,
params(param(propertyNode.getType(), "value")),
exceptions,
setterBlock);
setter.setSynthetic(true);
// add it to the class
declaringClass.addMethod(setter);
}
| void function(ClassNode declaringClass, PropertyNode propertyNode, String setterName, Statement setterBlock) { ClassNode[] exceptions = {ClassHelper.make(PropertyVetoException.class)}; MethodNode setter = new MethodNode( setterName, PropertyNodeUtils.adjustPropertyModifiersForMethod(propertyNode), ClassHelper.VOID_TYPE, params(param(propertyNode.getType(), "value")), exceptions, setterBlock); setter.setSynthetic(true); declaringClass.addMethod(setter); } | /**
* Creates a setter method with the given body.
* <p>
* This differs from normal setters in that we need to add a declared
* exception java.beans.PropertyVetoException
*
* @param declaringClass the class to which we will add the setter
* @param propertyNode the field to back the setter
* @param setterName the name of the setter
* @param setterBlock the statement representing the setter block
*/ | Creates a setter method with the given body. This differs from normal setters in that we need to add a declared exception java.beans.PropertyVetoException | createSetterMethod | {
"repo_name": "alien11689/incubator-groovy",
"path": "src/main/groovy/beans/VetoableASTTransformation.java",
"license": "apache-2.0",
"size": 21607
} | [
"java.beans.PropertyVetoException",
"org.codehaus.groovy.ast.ClassHelper",
"org.codehaus.groovy.ast.ClassNode",
"org.codehaus.groovy.ast.MethodNode",
"org.codehaus.groovy.ast.PropertyNode",
"org.codehaus.groovy.ast.stmt.Statement",
"org.codehaus.groovy.ast.tools.GeneralUtils",
"org.codehaus.groovy.ast.tools.PropertyNodeUtils"
] | import java.beans.PropertyVetoException; import org.codehaus.groovy.ast.ClassHelper; import org.codehaus.groovy.ast.ClassNode; import org.codehaus.groovy.ast.MethodNode; import org.codehaus.groovy.ast.PropertyNode; import org.codehaus.groovy.ast.stmt.Statement; import org.codehaus.groovy.ast.tools.GeneralUtils; import org.codehaus.groovy.ast.tools.PropertyNodeUtils; | import java.beans.*; import org.codehaus.groovy.ast.*; import org.codehaus.groovy.ast.stmt.*; import org.codehaus.groovy.ast.tools.*; | [
"java.beans",
"org.codehaus.groovy"
] | java.beans; org.codehaus.groovy; | 851,115 |
public void setRefEntityTypeValue(YangString refEntityTypeValue)
throws JNCException {
setLeafValue(Epc.NAMESPACE,
"ref-entity-type",
refEntityTypeValue,
childrenNames());
} | void function(YangString refEntityTypeValue) throws JNCException { setLeafValue(Epc.NAMESPACE, STR, refEntityTypeValue, childrenNames()); } | /**
* Sets the value for child leaf "ref-entity-type",
* using instance of generated typedef class.
* @param refEntityTypeValue The value to set.
* @param refEntityTypeValue used during instantiation.
*/ | Sets the value for child leaf "ref-entity-type", using instance of generated typedef class | setRefEntityTypeValue | {
"repo_name": "jnpr-shinma/yangfile",
"path": "hitel/src/hctaEpc/mmeSgsn/statistics/sgsnAcct/Scdr.java",
"license": "apache-2.0",
"size": 11310
} | [
"com.tailf.jnc.YangString"
] | import com.tailf.jnc.YangString; | import com.tailf.jnc.*; | [
"com.tailf.jnc"
] | com.tailf.jnc; | 633,649 |
private void saveGoodVersionOfTypePriorities() {
TypePriorities tp = getAeDescription().getAnalysisEngineMetaData().getTypePriorities();
m_typePrioritiesBackup = (null == tp) ? null : (TypePriorities) tp.clone();
} | void function() { TypePriorities tp = getAeDescription().getAnalysisEngineMetaData().getTypePriorities(); m_typePrioritiesBackup = (null == tp) ? null : (TypePriorities) tp.clone(); } | /**
* Save good version of type priorities.
*/ | Save good version of type priorities | saveGoodVersionOfTypePriorities | {
"repo_name": "apache/uima-uimaj",
"path": "uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/editors/MultiPageEditor.java",
"license": "apache-2.0",
"size": 143007
} | [
"org.apache.uima.resource.metadata.TypePriorities"
] | import org.apache.uima.resource.metadata.TypePriorities; | import org.apache.uima.resource.metadata.*; | [
"org.apache.uima"
] | org.apache.uima; | 459,832 |
@Test(expected = JdbcException.class)
public void testIrisQueryEntityMissing() throws Exception {
// Create the producer
JdbcProducer producer = null;
try {
producer = new JdbcProducer(dataSource);
} catch (Exception e) {
fail();
}
// Build up an InteractionContext
MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl<String>();
MultivaluedMap<String, String> pathParams = new MultivaluedMapImpl<String>();
InteractionContext ctx = new InteractionContext(mock(UriInfo.class), mock(HttpHeaders.class), pathParams,
queryParams, mock(ResourceState.class), mock(Metadata.class));
// Run a query. Should throw.
String expectedType = "returnEntityType";
String key = "badEntityKey";
producer.queryEntity(TEST_TABLE_NAME, key, ctx, expectedType);
} | @Test(expected = JdbcException.class) void function() throws Exception { JdbcProducer producer = null; try { producer = new JdbcProducer(dataSource); } catch (Exception e) { fail(); } MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl<String>(); MultivaluedMap<String, String> pathParams = new MultivaluedMapImpl<String>(); InteractionContext ctx = new InteractionContext(mock(UriInfo.class), mock(HttpHeaders.class), pathParams, queryParams, mock(ResourceState.class), mock(Metadata.class)); String expectedType = STR; String key = STR; producer.queryEntity(TEST_TABLE_NAME, key, ctx, expectedType); } | /**
* Test access to database using Iris parameter passing and returning a
* single entity. When the entry is not present in the database.
*/ | Test access to database using Iris parameter passing and returning a single entity. When the entry is not present in the database | testIrisQueryEntityMissing | {
"repo_name": "ssethupathi/IRIS",
"path": "interaction-jdbc-producer/src/test/java/com/temenos/interaction/jdbc/producer/TestLocalJdbcProducer.java",
"license": "agpl-3.0",
"size": 14288
} | [
"com.temenos.interaction.core.MultivaluedMapImpl",
"com.temenos.interaction.core.command.InteractionContext",
"com.temenos.interaction.core.entity.Metadata",
"com.temenos.interaction.core.hypermedia.ResourceState",
"com.temenos.interaction.jdbc.exceptions.JdbcException",
"javax.ws.rs.core.HttpHeaders",
"javax.ws.rs.core.MultivaluedMap",
"javax.ws.rs.core.UriInfo",
"org.junit.Assert",
"org.junit.Test",
"org.mockito.Mockito"
] | import com.temenos.interaction.core.MultivaluedMapImpl; import com.temenos.interaction.core.command.InteractionContext; import com.temenos.interaction.core.entity.Metadata; import com.temenos.interaction.core.hypermedia.ResourceState; import com.temenos.interaction.jdbc.exceptions.JdbcException; import javax.ws.rs.core.HttpHeaders; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.core.UriInfo; import org.junit.Assert; import org.junit.Test; import org.mockito.Mockito; | import com.temenos.interaction.core.*; import com.temenos.interaction.core.command.*; import com.temenos.interaction.core.entity.*; import com.temenos.interaction.core.hypermedia.*; import com.temenos.interaction.jdbc.exceptions.*; import javax.ws.rs.core.*; import org.junit.*; import org.mockito.*; | [
"com.temenos.interaction",
"javax.ws",
"org.junit",
"org.mockito"
] | com.temenos.interaction; javax.ws; org.junit; org.mockito; | 2,660,961 |
EReference getproductionschema2petrinetDisjunctiveNodeIn_r7_ConflictCheckMappingActivity(); | EReference getproductionschema2petrinetDisjunctiveNodeIn_r7_ConflictCheckMappingActivity(); | /**
* Returns the meta object for the reference '{@link de.mdelab.mltgg.productionschema2petrinet.generated.productionschema2petrinetDisjunctiveNodeIn_r7#getConflictCheckMappingActivity <em>Conflict Check Mapping Activity</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the reference '<em>Conflict Check Mapping Activity</em>'.
* @see de.mdelab.mltgg.productionschema2petrinet.generated.productionschema2petrinetDisjunctiveNodeIn_r7#getConflictCheckMappingActivity()
* @see #getproductionschema2petrinetDisjunctiveNodeIn_r7()
* @generated
*/ | Returns the meta object for the reference '<code>de.mdelab.mltgg.productionschema2petrinet.generated.productionschema2petrinetDisjunctiveNodeIn_r7#getConflictCheckMappingActivity Conflict Check Mapping Activity</code>'. | getproductionschema2petrinetDisjunctiveNodeIn_r7_ConflictCheckMappingActivity | {
"repo_name": "Somae/mdsd-factory-project",
"path": "transformation/de.mdelab.languages.productionschema2petrinet/src-gen/de/mdelab/mltgg/productionschema2petrinet/generated/GeneratedPackage.java",
"license": "gpl-3.0",
"size": 283384
} | [
"org.eclipse.emf.ecore.EReference"
] | import org.eclipse.emf.ecore.EReference; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 1,551,789 |
public synchronized long startOperation() {
if (logger.isTraceEnabled(LogMarker.DISTRIBUTION_STATE_FLUSH_OP)) {
logger.trace(LogMarker.DISTRIBUTION_STATE_FLUSH_OP,
"startOperation() op count is now {} in view version {}", currentVersionOpCount + 1,
membershipVersion);
}
synchronized (this.opCountLock) {
currentVersionOpCount++;
if (logger.isTraceEnabled(LogMarker.STATE_FLUSH_OP)) {
logger.trace(LogMarker.STATE_FLUSH_OP, "StateFlush current opcount incremented: {}",
currentVersionOpCount);
}
}
return membershipVersion;
} | synchronized long function() { if (logger.isTraceEnabled(LogMarker.DISTRIBUTION_STATE_FLUSH_OP)) { logger.trace(LogMarker.DISTRIBUTION_STATE_FLUSH_OP, STR, currentVersionOpCount + 1, membershipVersion); } synchronized (this.opCountLock) { currentVersionOpCount++; if (logger.isTraceEnabled(LogMarker.STATE_FLUSH_OP)) { logger.trace(LogMarker.STATE_FLUSH_OP, STR, currentVersionOpCount); } } return membershipVersion; } | /**
* this method must be invoked at the start of every operation that can modify the state of
* resource. The return value must be recorded and sent to the advisor in an endOperation message
* when messages for the operation have been put in the DistributionManager's outgoing "queue".
*
* @return the current membership version for this advisor
* @since GemFire 5.1
*/ | this method must be invoked at the start of every operation that can modify the state of resource. The return value must be recorded and sent to the advisor in an endOperation message when messages for the operation have been put in the DistributionManager's outgoing "queue" | startOperation | {
"repo_name": "pivotal-amurmann/geode",
"path": "geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionAdvisor.java",
"license": "apache-2.0",
"size": 59199
} | [
"org.apache.geode.internal.logging.log4j.LogMarker"
] | import org.apache.geode.internal.logging.log4j.LogMarker; | import org.apache.geode.internal.logging.log4j.*; | [
"org.apache.geode"
] | org.apache.geode; | 2,700,635 |
@TargetApi(VERSION_CODES.P)
private void showStopUserPrompt() {
showChooseUserPrompt(R.string.stop_user, userHandle -> {
mDevicePolicyManagerGateway.startUserInBackground(userHandle,
(v) -> onSuccessShowToast("stopUser", R.string.user_stopped),
(e) -> onErrorShowToast("stopUser", e, R.string.failed_to_stop_user));
});
} | @TargetApi(VERSION_CODES.P) void function() { showChooseUserPrompt(R.string.stop_user, userHandle -> { mDevicePolicyManagerGateway.startUserInBackground(userHandle, (v) -> onSuccessShowToast(STR, R.string.user_stopped), (e) -> onErrorShowToast(STR, e, R.string.failed_to_stop_user)); }); } | /**
* For user stop:
* Shows a prompt for choosing a user to be stopped.
*/ | For user stop: Shows a prompt for choosing a user to be stopped | showStopUserPrompt | {
"repo_name": "googlesamples/android-testdpc",
"path": "app/src/main/java/com/afwsamples/testdpc/policy/PolicyManagementFragment.java",
"license": "apache-2.0",
"size": 213498
} | [
"android.annotation.TargetApi"
] | import android.annotation.TargetApi; | import android.annotation.*; | [
"android.annotation"
] | android.annotation; | 2,201,533 |
public Artifact getInputManifest() {
return runfilesInputManifest;
} | Artifact function() { return runfilesInputManifest; } | /**
* Returns the input runfiles manifest for this test.
*
* <p>This always returns the input manifest outside of the runfiles tree.
*
* @see com.google.devtools.build.lib.analysis.RunfilesSupport#getRunfilesInputManifest()
*/ | Returns the input runfiles manifest for this test. This always returns the input manifest outside of the runfiles tree | getInputManifest | {
"repo_name": "ulfjack/bazel",
"path": "src/main/java/com/google/devtools/build/lib/analysis/test/TestTargetExecutionSettings.java",
"license": "apache-2.0",
"size": 7574
} | [
"com.google.devtools.build.lib.actions.Artifact"
] | import com.google.devtools.build.lib.actions.Artifact; | import com.google.devtools.build.lib.actions.*; | [
"com.google.devtools"
] | com.google.devtools; | 1,609,976 |
@Override
public CommitResponse commitLastReInitialization(ContainerId containerId)
throws YarnException {
Container container = preReInitializeOrLocalizeCheck(containerId,
ReInitOp.COMMIT);
if (container.canRollback()) {
container.commitUpgrade();
} else {
throw new YarnException("Nothing to Commit !!");
}
return CommitResponse.newInstance();
} | CommitResponse function(ContainerId containerId) throws YarnException { Container container = preReInitializeOrLocalizeCheck(containerId, ReInitOp.COMMIT); if (container.canRollback()) { container.commitUpgrade(); } else { throw new YarnException(STR); } return CommitResponse.newInstance(); } | /**
* Commit last reInitialization after which no rollback will be possible.
* @param containerId Container ID.
* @return Commit Response.
* @throws YarnException YARN Exception.
*/ | Commit last reInitialization after which no rollback will be possible | commitLastReInitialization | {
"repo_name": "apurtell/hadoop",
"path": "hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/ContainerManagerImpl.java",
"license": "apache-2.0",
"size": 85911
} | [
"org.apache.hadoop.yarn.api.protocolrecords.CommitResponse",
"org.apache.hadoop.yarn.api.records.ContainerId",
"org.apache.hadoop.yarn.exceptions.YarnException",
"org.apache.hadoop.yarn.server.nodemanager.containermanager.container.Container"
] | import org.apache.hadoop.yarn.api.protocolrecords.CommitResponse; import org.apache.hadoop.yarn.api.records.ContainerId; import org.apache.hadoop.yarn.exceptions.YarnException; import org.apache.hadoop.yarn.server.nodemanager.containermanager.container.Container; | import org.apache.hadoop.yarn.api.protocolrecords.*; import org.apache.hadoop.yarn.api.records.*; import org.apache.hadoop.yarn.exceptions.*; import org.apache.hadoop.yarn.server.nodemanager.containermanager.container.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 1,432,876 |
@Nullable
private static View getBottomView(ViewGroup viewGroup) {
if (viewGroup == null || viewGroup.getChildCount() == 0)
return null;
View bottomView = null;
for (int i = viewGroup.getChildCount() - 1; i >= 0; i--) {
View child = viewGroup.getChildAt(i);
if (child.getVisibility() == View.VISIBLE && child.getBottom() == viewGroup.getMeasuredHeight()) {
bottomView = child;
break;
}
}
return bottomView;
} | static View function(ViewGroup viewGroup) { if (viewGroup == null viewGroup.getChildCount() == 0) return null; View bottomView = null; for (int i = viewGroup.getChildCount() - 1; i >= 0; i--) { View child = viewGroup.getChildAt(i); if (child.getVisibility() == View.VISIBLE && child.getBottom() == viewGroup.getMeasuredHeight()) { bottomView = child; break; } } return bottomView; } | /**
* Find the view touching the bottom of this ViewGroup. Non visible children are ignored,
* however getChildDrawingOrder is not taking into account for simplicity and because it behaves
* inconsistently across platform versions.
*
* @return View touching the bottom of this ViewGroup or null
*/ | Find the view touching the bottom of this ViewGroup. Non visible children are ignored, however getChildDrawingOrder is not taking into account for simplicity and because it behaves inconsistently across platform versions | getBottomView | {
"repo_name": "AChep/material-dialogs",
"path": "library/src/main/java/com/afollestad/materialdialogs/internal/MDRootLayout.java",
"license": "mit",
"size": 21072
} | [
"android.view.View",
"android.view.ViewGroup"
] | import android.view.View; import android.view.ViewGroup; | import android.view.*; | [
"android.view"
] | android.view; | 1,771,192 |
public List<PercentileMetricInner> listMetrics(String resourceGroupName, String accountName, String filter) {
return listMetricsWithServiceResponseAsync(resourceGroupName, accountName, filter).toBlocking().single().body();
} | List<PercentileMetricInner> function(String resourceGroupName, String accountName, String filter) { return listMetricsWithServiceResponseAsync(resourceGroupName, accountName, filter).toBlocking().single().body(); } | /**
* Retrieves the metrics determined by the given filter for the given database account. This url is only for PBS and Replication Latency data.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param accountName Cosmos DB database account name.
* @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws CloudException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @return the List<PercentileMetricInner> object if successful.
*/ | Retrieves the metrics determined by the given filter for the given database account. This url is only for PBS and Replication Latency data | listMetrics | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/cosmos/mgmt-v2020_04_01/src/main/java/com/microsoft/azure/management/cosmosdb/v2020_04_01/implementation/PercentilesInner.java",
"license": "mit",
"size": 9383
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,475,174 |
public Paint getBackgroundPaint() {
return this.backgroundPaint;
}
| Paint function() { return this.backgroundPaint; } | /**
* Returns the background paint.
*
* @return The background paint.
*
* @see #setBackgroundPaint(Paint)
*/ | Returns the background paint | getBackgroundPaint | {
"repo_name": "Mr-Steve/LTSpice_Library_Manager",
"path": "libs/jfreechart-1.0.16/source/org/jfree/chart/plot/dial/DialValueIndicator.java",
"license": "gpl-2.0",
"size": 23626
} | [
"java.awt.Paint"
] | import java.awt.Paint; | import java.awt.*; | [
"java.awt"
] | java.awt; | 2,285,834 |
public ServiceProperties createServiceProperties() {
return new ServiceProperties();
} | ServiceProperties function() { return new ServiceProperties(); } | /**
* Create a ServiceProperties object describing the CAS service.
* @return ServiceProperties
*/ | Create a ServiceProperties object describing the CAS service | createServiceProperties | {
"repo_name": "fcrespel/jenkins-cas-plugin",
"path": "src/main/java/org/jenkinsci/plugins/cas/CasProtocol.java",
"license": "mit",
"size": 4388
} | [
"org.springframework.security.cas.ServiceProperties"
] | import org.springframework.security.cas.ServiceProperties; | import org.springframework.security.cas.*; | [
"org.springframework.security"
] | org.springframework.security; | 2,213,620 |
demo9 fragment = new demo9();
Bundle args = new Bundle();
args.putString(ARG_PARAM1, param1);
args.putString(ARG_PARAM2, param2);
fragment.setArguments(args);
return fragment;
} | demo9 fragment = new demo9(); Bundle args = new Bundle(); args.putString(ARG_PARAM1, param1); args.putString(ARG_PARAM2, param2); fragment.setArguments(args); return fragment; } | /**
* Use this factory method to create a new instance of
* this fragment using the provided parameters.
*
* @param param1 Parameter 1.
* @param param2 Parameter 2.
* @return A new instance of fragment demo9.
*/ | Use this factory method to create a new instance of this fragment using the provided parameters | newInstance | {
"repo_name": "nathanialf/RIT",
"path": "app/src/main/java/com/example/nate/survey/demo9.java",
"license": "agpl-3.0",
"size": 3559
} | [
"android.os.Bundle"
] | import android.os.Bundle; | import android.os.*; | [
"android.os"
] | android.os; | 183,876 |
public HookResult doRefUpdateHook(final Project project, final String refname,
final Account uploader, final ObjectId oldId, final ObjectId newId) {
final List<String> args = new ArrayList<String>();
addArg(args, "--project", project.getName());
addArg(args, "--refname", refname);
addArg(args, "--uploader", getDisplayName(uploader));
addArg(args, "--oldrev", oldId.getName());
addArg(args, "--newrev", newId.getName());
HookResult hookResult;
try {
hookResult = runSyncHook(project.getNameKey(), refUpdateHook, args);
} catch (TimeoutException e) {
hookResult = new HookResult(-1, "Synchronous hook timed out");
}
return hookResult;
} | HookResult function(final Project project, final String refname, final Account uploader, final ObjectId oldId, final ObjectId newId) { final List<String> args = new ArrayList<String>(); addArg(args, STR, project.getName()); addArg(args, STR, refname); addArg(args, STR, getDisplayName(uploader)); addArg(args, STR, oldId.getName()); addArg(args, STR, newId.getName()); HookResult hookResult; try { hookResult = runSyncHook(project.getNameKey(), refUpdateHook, args); } catch (TimeoutException e) { hookResult = new HookResult(-1, STR); } return hookResult; } | /**
* Fire the update hook
*
*/ | Fire the update hook | doRefUpdateHook | {
"repo_name": "teamblueridge/gerrit",
"path": "gerrit-server/src/main/java/com/google/gerrit/common/ChangeHookRunner.java",
"license": "apache-2.0",
"size": 31612
} | [
"com.google.gerrit.reviewdb.client.Account",
"com.google.gerrit.reviewdb.client.Project",
"java.util.ArrayList",
"java.util.List",
"java.util.concurrent.TimeoutException",
"org.eclipse.jgit.lib.ObjectId"
] | import com.google.gerrit.reviewdb.client.Account; import com.google.gerrit.reviewdb.client.Project; import java.util.ArrayList; import java.util.List; import java.util.concurrent.TimeoutException; import org.eclipse.jgit.lib.ObjectId; | import com.google.gerrit.reviewdb.client.*; import java.util.*; import java.util.concurrent.*; import org.eclipse.jgit.lib.*; | [
"com.google.gerrit",
"java.util",
"org.eclipse.jgit"
] | com.google.gerrit; java.util; org.eclipse.jgit; | 519,127 |
default CompletableFuture<AggregatedHttpMessage> aggregate(Executor executor) {
final CompletableFuture<AggregatedHttpMessage> future = new CompletableFuture<>();
final HttpResponseAggregator aggregator = new HttpResponseAggregator(future);
closeFuture().whenCompleteAsync(aggregator, executor);
subscribe(aggregator, executor);
return future;
} | default CompletableFuture<AggregatedHttpMessage> aggregate(Executor executor) { final CompletableFuture<AggregatedHttpMessage> future = new CompletableFuture<>(); final HttpResponseAggregator aggregator = new HttpResponseAggregator(future); closeFuture().whenCompleteAsync(aggregator, executor); subscribe(aggregator, executor); return future; } | /**
* Aggregates this response. The returned {@link CompletableFuture} will be notified when the content and
* the trailing headers of the response are received fully.
*/ | Aggregates this response. The returned <code>CompletableFuture</code> will be notified when the content and the trailing headers of the response are received fully | aggregate | {
"repo_name": "jonefeewang/armeria",
"path": "core/src/main/java/com/linecorp/armeria/common/http/HttpResponse.java",
"license": "apache-2.0",
"size": 8159
} | [
"java.util.concurrent.CompletableFuture",
"java.util.concurrent.Executor"
] | import java.util.concurrent.CompletableFuture; import java.util.concurrent.Executor; | import java.util.concurrent.*; | [
"java.util"
] | java.util; | 206,850 |
public Map<String, Property> getComponentPropertyDataType(
Credentials credentials, Component component, String flowUri)
throws MeandreServerException {
Model model = getEmptyModel();
ExecutableComponentDescription ecd = getComponentDescription(model
.createResource(component.getUri()));
Map<String, Property> dataTypeMap = new HashMap<String, Property>();
FlowDescription flowDescription = null;
flowDescription = getFlowDescription(credentials,flowUri);
if (ecd == null) {
logger.severe("component: " + component.getUri()
+ " could not be found.");
throw new MeandreServerException("component: "
+ component.getUri() + " could not be found.");
}
Model m = this.getEmptyModel();
ExecutableComponentInstanceDescription ecid = flowDescription
.getExecutableComponentInstanceDescription(m
.createResource(component.getInstanceUri()));
if (ecid == null) {
logger.severe("component instance: "
+ component.getInstanceUri() + " could not be found.");
throw new MeandreServerException("component instance : "
+ component.getInstanceUri() + " could not be found.");
}
PropertiesDescriptionDefinition propertiesDefn = ecd
.getProperties();
Set<String> propertiesSet = propertiesDefn.getKeys();
Iterator<String> it = propertiesSet.iterator();
boolean foundDataType = Boolean.FALSE;
while (it.hasNext()) {
String propertyName = it.next();
Property property = new Property();
property.setName(propertyName);
Map<String, String> otherPropertyMap = propertiesDefn
.getOtherProperties(propertyName);
String description = propertiesDefn
.getDescription(propertyName);
String defaultValue = propertiesDefn.getValue(propertyName);
String value = ecid.getProperties().getValue(propertyName);
if (value != null) {
property.setValue(value);
} else {
property.setValue(defaultValue);
}
property.setDefaultValue(defaultValue);
property.setDescription(description);
List<DataTypeBean> dataTypes = null;
if (!otherPropertyMap.isEmpty()) {
Iterator<Entry<String, String>> it1 = otherPropertyMap
.entrySet().iterator();
while (it1.hasNext()) {
Entry<String, String> tmp = it1.next();
String key = tmp.getKey();
String value1 = tmp.getValue();
if (key.endsWith(propertyName + DATATYPE_KEY)) {
dataTypes = getDataTypeBeanFromJson(value1);
updatePropertyWithTaskMetadata(property, dataTypes);
property.setDataTypeBeanList(dataTypes);
foundDataType = true;
}
}
// add the default data type
if (!foundDataType) {
dataTypes = getDefaultDataTypeBean();
property.setDataTypeBeanList(dataTypes);
}
} else {
if (!foundDataType) {
dataTypes = getDefaultDataTypeBean();
property.setDataTypeBeanList(dataTypes);
}
}
dataTypeMap.put(propertyName, property);
// reset to false for the next property
foundDataType = Boolean.FALSE;
}
return dataTypeMap;
}
| Map<String, Property> function( Credentials credentials, Component component, String flowUri) throws MeandreServerException { Model model = getEmptyModel(); ExecutableComponentDescription ecd = getComponentDescription(model .createResource(component.getUri())); Map<String, Property> dataTypeMap = new HashMap<String, Property>(); FlowDescription flowDescription = null; flowDescription = getFlowDescription(credentials,flowUri); if (ecd == null) { logger.severe(STR + component.getUri() + STR); throw new MeandreServerException(STR + component.getUri() + STR); } Model m = this.getEmptyModel(); ExecutableComponentInstanceDescription ecid = flowDescription .getExecutableComponentInstanceDescription(m .createResource(component.getInstanceUri())); if (ecid == null) { logger.severe(STR + component.getInstanceUri() + STR); throw new MeandreServerException(STR + component.getInstanceUri() + STR); } PropertiesDescriptionDefinition propertiesDefn = ecd .getProperties(); Set<String> propertiesSet = propertiesDefn.getKeys(); Iterator<String> it = propertiesSet.iterator(); boolean foundDataType = Boolean.FALSE; while (it.hasNext()) { String propertyName = it.next(); Property property = new Property(); property.setName(propertyName); Map<String, String> otherPropertyMap = propertiesDefn .getOtherProperties(propertyName); String description = propertiesDefn .getDescription(propertyName); String defaultValue = propertiesDefn.getValue(propertyName); String value = ecid.getProperties().getValue(propertyName); if (value != null) { property.setValue(value); } else { property.setValue(defaultValue); } property.setDefaultValue(defaultValue); property.setDescription(description); List<DataTypeBean> dataTypes = null; if (!otherPropertyMap.isEmpty()) { Iterator<Entry<String, String>> it1 = otherPropertyMap .entrySet().iterator(); while (it1.hasNext()) { Entry<String, String> tmp = it1.next(); String key = tmp.getKey(); String value1 = tmp.getValue(); if (key.endsWith(propertyName + DATATYPE_KEY)) { dataTypes = getDataTypeBeanFromJson(value1); updatePropertyWithTaskMetadata(property, dataTypes); property.setDataTypeBeanList(dataTypes); foundDataType = true; } } if (!foundDataType) { dataTypes = getDefaultDataTypeBean(); property.setDataTypeBeanList(dataTypes); } } else { if (!foundDataType) { dataTypes = getDefaultDataTypeBean(); property.setDataTypeBeanList(dataTypes); } } dataTypeMap.put(propertyName, property); foundDataType = Boolean.FALSE; } return dataTypeMap; } | /** Returns the component property hashmap
*
* @param credentials
* @param component
* @param flowUri
* @return the Map of String component's property name and property
* @throws MeandreServerException
*/ | Returns the component property hashmap | getComponentPropertyDataType | {
"repo_name": "kumaramit01/FlowService",
"path": "src/main/java/org/imirsel/nema/flowservice/MeandreFlowStore.java",
"license": "apache-2.0",
"size": 28780
} | [
"com.hp.hpl.jena.rdf.model.Model",
"java.util.HashMap",
"java.util.Iterator",
"java.util.List",
"java.util.Map",
"java.util.Set",
"javax.jcr.Credentials",
"org.imirsel.nema.annotations.parser.beans.DataTypeBean",
"org.imirsel.nema.model.Component",
"org.imirsel.nema.model.Property",
"org.meandre.core.repository.ExecutableComponentDescription",
"org.meandre.core.repository.ExecutableComponentInstanceDescription",
"org.meandre.core.repository.FlowDescription",
"org.meandre.core.repository.PropertiesDescriptionDefinition"
] | import com.hp.hpl.jena.rdf.model.Model; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; import javax.jcr.Credentials; import org.imirsel.nema.annotations.parser.beans.DataTypeBean; import org.imirsel.nema.model.Component; import org.imirsel.nema.model.Property; import org.meandre.core.repository.ExecutableComponentDescription; import org.meandre.core.repository.ExecutableComponentInstanceDescription; import org.meandre.core.repository.FlowDescription; import org.meandre.core.repository.PropertiesDescriptionDefinition; | import com.hp.hpl.jena.rdf.model.*; import java.util.*; import javax.jcr.*; import org.imirsel.nema.annotations.parser.beans.*; import org.imirsel.nema.model.*; import org.meandre.core.repository.*; | [
"com.hp.hpl",
"java.util",
"javax.jcr",
"org.imirsel.nema",
"org.meandre.core"
] | com.hp.hpl; java.util; javax.jcr; org.imirsel.nema; org.meandre.core; | 1,860,865 |
private void updateStringValueForColumn(TableColumn tableColumn,
TableCellRenderer renderer) {
getStringValueRegistry().setStringValue(
renderer instanceof StringValue ? (StringValue) renderer : null,
tableColumn.getModelIndex());
} | void function(TableColumn tableColumn, TableCellRenderer renderer) { getStringValueRegistry().setStringValue( renderer instanceof StringValue ? (StringValue) renderer : null, tableColumn.getModelIndex()); } | /**
* Updates per-column StringValue in StringValueRegistry based on given tableColumn.
* This is called after the column's renderer property changed or after the column
* is added.
*
* @param tableColumn the column to update from
* @param renderer the renderer potentially useful as StringValue.
*/ | Updates per-column StringValue in StringValueRegistry based on given tableColumn. This is called after the column's renderer property changed or after the column is added | updateStringValueForColumn | {
"repo_name": "trejkaz/swingx",
"path": "swingx-core/src/main/java/org/jdesktop/swingx/JXTable.java",
"license": "lgpl-2.1",
"size": 163623
} | [
"javax.swing.table.TableCellRenderer",
"javax.swing.table.TableColumn",
"org.jdesktop.swingx.renderer.StringValue"
] | import javax.swing.table.TableCellRenderer; import javax.swing.table.TableColumn; import org.jdesktop.swingx.renderer.StringValue; | import javax.swing.table.*; import org.jdesktop.swingx.renderer.*; | [
"javax.swing",
"org.jdesktop.swingx"
] | javax.swing; org.jdesktop.swingx; | 1,953,507 |
public static int getMonthFromString(String monthStr) {
int month = Calendar.JANUARY;
if(monthStr.matches("(?i).*((january)|(jan)).*")) {
return Calendar.JANUARY;
}
if(monthStr.matches("(?i).*((february)|(feb)).*")) {
return Calendar.FEBRUARY;
}
if(monthStr.matches("(?i).*((march)|(mar)).*")) {
return Calendar.MARCH;
}
if(monthStr.matches("(?i).*((april)|(apr)).*")) {
return Calendar.APRIL;
}
if(monthStr.matches("(?i).*(may).*")) {
return Calendar.MAY;
}
if(monthStr.matches("(?i).*((june)|(jun)).*")) {
return Calendar.JUNE;
}
if(monthStr.matches("(?i).*((july)|(jul)).*")) {
return Calendar.JULY;
}
if(monthStr.matches("(?i).*((august)|(aug)).*")) {
return Calendar.AUGUST;
}
if(monthStr.matches("(?i).*((september)|(sep)|(sept)).*")) {
return Calendar.SEPTEMBER;
}
if(monthStr.matches("(?i).*((october)|(oct)).*")) {
return Calendar.OCTOBER;
}
if(monthStr.matches("(?i).*((november)|(nov)).*")) {
return Calendar.NOVEMBER;
}
if(monthStr.matches("(?i).*((december)|(dec)).*")) {
return Calendar.DECEMBER;
}
return Calendar.JANUARY;
} | static int function(String monthStr) { int month = Calendar.JANUARY; if(monthStr.matches(STR)) { return Calendar.JANUARY; } if(monthStr.matches(STR)) { return Calendar.FEBRUARY; } if(monthStr.matches(STR)) { return Calendar.MARCH; } if(monthStr.matches(STR)) { return Calendar.APRIL; } if(monthStr.matches(STR)) { return Calendar.MAY; } if(monthStr.matches(STR)) { return Calendar.JUNE; } if(monthStr.matches(STR)) { return Calendar.JULY; } if(monthStr.matches(STR)) { return Calendar.AUGUST; } if(monthStr.matches(STR)) { return Calendar.SEPTEMBER; } if(monthStr.matches(STR)) { return Calendar.OCTOBER; } if(monthStr.matches(STR)) { return Calendar.NOVEMBER; } if(monthStr.matches(STR)) { return Calendar.DECEMBER; } return Calendar.JANUARY; } | /**
* Gets a month integer from a month string.
* @param monthStr Month string Jan or January etc...
* @return Integer of the month
*/ | Gets a month integer from a month string | getMonthFromString | {
"repo_name": "jakeabel/mpa",
"path": "src/main/java/us/jakeabel/mpa/util/DateUtils.java",
"license": "apache-2.0",
"size": 7007
} | [
"java.util.Calendar"
] | import java.util.Calendar; | import java.util.*; | [
"java.util"
] | java.util; | 1,835,409 |
public void setHandle(long handle)
{
if (this.handle != 0)
throw new RuntimeException ("EmbeddedWindow is already embedded");
this.handle = handle;
if (getPeer() != null)
((EmbeddedWindowPeer) getPeer()).embed (this.handle);
} | void function(long handle) { if (this.handle != 0) throw new RuntimeException (STR); this.handle = handle; if (getPeer() != null) ((EmbeddedWindowPeer) getPeer()).embed (this.handle); } | /**
* If the native peer for this embedded window has been created,
* then setHandle will embed the window. If not, setHandle tells
* us where to embed ourselves when our peer is created.
*
* @param handle the native handle to the screen area where the AWT
* window should be embedded
*/ | If the native peer for this embedded window has been created, then setHandle will embed the window. If not, setHandle tells us where to embed ourselves when our peer is created | setHandle | {
"repo_name": "aosm/gcc_40",
"path": "libjava/gnu/java/awt/EmbeddedWindow.java",
"license": "gpl-2.0",
"size": 4397
} | [
"gnu.java.awt.peer.EmbeddedWindowPeer"
] | import gnu.java.awt.peer.EmbeddedWindowPeer; | import gnu.java.awt.peer.*; | [
"gnu.java.awt"
] | gnu.java.awt; | 215,253 |
protected void automateNegationInsertion(Workspace workspace) {
TypeBlockManager typeBlockManager = workspace.getTypeBlockManager();
if (!typeBlockManager.isEnabled()) {
System.err.println("AutoMateNegationInsertion invoked but typeBlockManager is disabled.");
return;
}
// ====================>>>>>>>>>>>>>>>>>>>>>>>>>
// ====================focus coming in>>>>>>>>>> TODO
// ====================>>>>>>>>>>>>>>>>>>>>>>>>>
//get focus block
Long parentBlockID = typeBlockManager.focusManager.getFocusBlockID();
if (isNullBlockInstance(parentBlockID)) {
//focus on canvas
automateBlockInsertion(workspace, "number", "-");
} else {
Block parentBlock = workspace.getEnv().getBlock(parentBlockID);
if (parentBlock.isDataBlock()) {
//focus on a data block
automateBlockInsertion(workspace, "difference", null);
} else {
//focus on a non-data block
automateBlockInsertion(workspace, "number", "-");
}
}
} | void function(Workspace workspace) { TypeBlockManager typeBlockManager = workspace.getTypeBlockManager(); if (!typeBlockManager.isEnabled()) { System.err.println(STR); return; } Long parentBlockID = typeBlockManager.focusManager.getFocusBlockID(); if (isNullBlockInstance(parentBlockID)) { automateBlockInsertion(workspace, STR, "-"); } else { Block parentBlock = workspace.getEnv().getBlock(parentBlockID); if (parentBlock.isDataBlock()) { automateBlockInsertion(workspace, STR, null); } else { automateBlockInsertion(workspace, STR, "-"); } } } | /**
* assumes number and differen genus exist and number genus has ediitabel lable
*/ | assumes number and differen genus exist and number genus has ediitabel lable | automateNegationInsertion | {
"repo_name": "dwengovzw/Ardublock-for-Dwenguino",
"path": "openblocks-master/src/main/java/edu/mit/blocks/workspace/typeblocking/TypeBlockManager.java",
"license": "gpl-3.0",
"size": 38571
} | [
"edu.mit.blocks.codeblocks.Block",
"edu.mit.blocks.workspace.Workspace"
] | import edu.mit.blocks.codeblocks.Block; import edu.mit.blocks.workspace.Workspace; | import edu.mit.blocks.codeblocks.*; import edu.mit.blocks.workspace.*; | [
"edu.mit.blocks"
] | edu.mit.blocks; | 1,366,856 |
public static ISystemFileCommandsHelper getRpcFileSystemHelper() {
return rpcFileCommandsHelper;
}
| static ISystemFileCommandsHelper function() { return rpcFileCommandsHelper; } | /**
* Return the current SystemFileCommands helper, if any.
*/ | Return the current SystemFileCommands helper, if any | getRpcFileSystemHelper | {
"repo_name": "groboclown/p4ic4idea",
"path": "p4java/src/main/java/com/perforce/p4java/server/ServerFactory.java",
"license": "apache-2.0",
"size": 25549
} | [
"com.perforce.p4java.impl.generic.sys.ISystemFileCommandsHelper"
] | import com.perforce.p4java.impl.generic.sys.ISystemFileCommandsHelper; | import com.perforce.p4java.impl.generic.sys.*; | [
"com.perforce.p4java"
] | com.perforce.p4java; | 2,035,673 |
public List<T> findAll() {
return readableController.findAll();
}
| List<T> function() { return readableController.findAll(); } | /**
* Invokes <code>dao.findAll()<code>.
* @return
* @see br.com.arsmachina.controller.impl.ReadableControllerImpl#findAll()
*/ | Invokes <code>dao.findAll()<code> | findAll | {
"repo_name": "thiagohp/generic-controller",
"path": "src/main/java/br/com/arsmachina/controller/impl/ControllerImpl.java",
"license": "apache-2.0",
"size": 6562
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 340,924 |
public void createHyperlinksTo(XtextResource from, Region region, EObject target, IHyperlinkAcceptor acceptor) {
final URIConverter uriConverter = from.getResourceSet().getURIConverter();
final String hyperlinkText = labelProvider.getText(target);
final URI uri = EcoreUtil.getURI(target);
final URI normalized = uri.isPlatformResource() ? uri : uriConverter.normalize(uri);
XtextHyperlink result = hyperlinkProvider.get();
result.setHyperlinkRegion(region);
result.setURI(normalized);
result.setHyperlinkText(hyperlinkText);
acceptor.accept(result);
} | void function(XtextResource from, Region region, EObject target, IHyperlinkAcceptor acceptor) { final URIConverter uriConverter = from.getResourceSet().getURIConverter(); final String hyperlinkText = labelProvider.getText(target); final URI uri = EcoreUtil.getURI(target); final URI normalized = uri.isPlatformResource() ? uri : uriConverter.normalize(uri); XtextHyperlink result = hyperlinkProvider.get(); result.setHyperlinkRegion(region); result.setURI(normalized); result.setHyperlinkText(hyperlinkText); acceptor.accept(result); } | /**
* Produces hyperlinks for the given {@code region} that point to the referenced {@code target}.
*/ | Produces hyperlinks for the given region that point to the referenced target | createHyperlinksTo | {
"repo_name": "JKatzwinkel/bts",
"path": "org.eclipse.xtext.ui/src/org/eclipse/xtext/ui/editor/hyperlinking/HyperlinkHelper.java",
"license": "lgpl-3.0",
"size": 4540
} | [
"org.eclipse.emf.ecore.EObject",
"org.eclipse.emf.ecore.resource.URIConverter",
"org.eclipse.emf.ecore.util.EcoreUtil",
"org.eclipse.jface.text.Region",
"org.eclipse.xtext.resource.XtextResource"
] | import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.resource.URIConverter; import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.jface.text.Region; import org.eclipse.xtext.resource.XtextResource; | import org.eclipse.emf.ecore.*; import org.eclipse.emf.ecore.resource.*; import org.eclipse.emf.ecore.util.*; import org.eclipse.jface.text.*; import org.eclipse.xtext.resource.*; | [
"org.eclipse.emf",
"org.eclipse.jface",
"org.eclipse.xtext"
] | org.eclipse.emf; org.eclipse.jface; org.eclipse.xtext; | 683,680 |
default UserStatus getDesktopStatus() {
return getStatusOnClient(DiscordClient.DESKTOP);
} | default UserStatus getDesktopStatus() { return getStatusOnClient(DiscordClient.DESKTOP); } | /**
* Gets the status of the user on the {@link DiscordClient#DESKTOP desktop} client.
*
* <p>This will return {@link UserStatus#OFFLINE} for invisible users.
*
* @return The status of the the user.
* @see #getStatusOnClient(DiscordClient)
*/ | Gets the status of the user on the <code>DiscordClient#DESKTOP desktop</code> client. This will return <code>UserStatus#OFFLINE</code> for invisible users | getDesktopStatus | {
"repo_name": "BtoBastian/Javacord",
"path": "javacord-api/src/main/java/org/javacord/api/entity/user/User.java",
"license": "lgpl-3.0",
"size": 19590
} | [
"org.javacord.api.entity.DiscordClient"
] | import org.javacord.api.entity.DiscordClient; | import org.javacord.api.entity.*; | [
"org.javacord.api"
] | org.javacord.api; | 1,490,412 |
private void assertCorrectWalCompressedBytesMetrics(IgniteEx n) {
long exp = Arrays.stream(walMgr(n).walArchiveFiles()).filter(FileDescriptor::isCompressed)
.mapToLong(fd -> fd.file().length()).sum();
assertEquals(exp, dbMgr(n).persistentStoreMetrics().getWalCompressedBytes());
assertEquals(exp, dsMetricsMXBean(n).getWalCompressedBytes());
assertEquals(exp, ((LongAdderMetric)dsMetricRegistry(n).findMetric("WalCompressedBytes")).value());
} | void function(IgniteEx n) { long exp = Arrays.stream(walMgr(n).walArchiveFiles()).filter(FileDescriptor::isCompressed) .mapToLong(fd -> fd.file().length()).sum(); assertEquals(exp, dbMgr(n).persistentStoreMetrics().getWalCompressedBytes()); assertEquals(exp, dsMetricsMXBean(n).getWalCompressedBytes()); assertEquals(exp, ((LongAdderMetric)dsMetricRegistry(n).findMetric(STR)).value()); } | /**
* Check that the metric of the total size compressed segment is working correctly.
*
* @param n Node.
*/ | Check that the metric of the total size compressed segment is working correctly | assertCorrectWalCompressedBytesMetrics | {
"repo_name": "apache/ignite",
"path": "modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgniteDataStorageMetricsSelfTest.java",
"license": "apache-2.0",
"size": 24002
} | [
"java.util.Arrays",
"org.apache.ignite.internal.IgniteEx",
"org.apache.ignite.internal.processors.cache.persistence.wal.FileDescriptor",
"org.apache.ignite.internal.processors.metric.impl.LongAdderMetric"
] | import java.util.Arrays; import org.apache.ignite.internal.IgniteEx; import org.apache.ignite.internal.processors.cache.persistence.wal.FileDescriptor; import org.apache.ignite.internal.processors.metric.impl.LongAdderMetric; | import java.util.*; import org.apache.ignite.internal.*; import org.apache.ignite.internal.processors.cache.persistence.wal.*; import org.apache.ignite.internal.processors.metric.impl.*; | [
"java.util",
"org.apache.ignite"
] | java.util; org.apache.ignite; | 899,509 |
public void setInField(VNField in)
{
params.setActive(false);
Field inFld = in.getField();
if (inFld instanceof RegularField
&& (((RegularField) inFld).getDims() == null
|| ((RegularField) inFld).getDims().length != 2))
return;
if (inField == null || !inField.isDataCompatibleWith(inFld))
{
inField = inFld;
isoComponentSelector.setDataSchema(inFld.getSchema());
int k = -1;
for (int i = 0; i < inField.getNData(); i++)
if (inField.getData(i).isSimpleNumeric() && inField.getData(i).getVeclen() == 1)
{
k = i;
break;
}
isoComponentSelector.setSelectedIndex(0);
}
if (inField instanceof IrregularField)
{
String[] cellSetNames = new String[((IrregularField) inField).getNCellSets()];
for (int i = 0; i < cellSetNames.length; i++)
cellSetNames[i] = ((IrregularField) inField).getCellSet(i).getName();
cellSetList.setListData(cellSetNames);
cellSetList.setEnabled(true);
aCS = new boolean[((IrregularField) inField).getNCellSets()];
for (int i = 0; i < aCS.length; i++)
aCS[i] = true;
params.setActiveCellSets(aCS);
} else
cellSetList.setEnabled(false);
dataComponentList.setInField(inField);
setDataComponent(isoComponentSelector.getComponent());
params.setActive(true);
} | void function(VNField in) { params.setActive(false); Field inFld = in.getField(); if (inFld instanceof RegularField && (((RegularField) inFld).getDims() == null ((RegularField) inFld).getDims().length != 2)) return; if (inField == null !inField.isDataCompatibleWith(inFld)) { inField = inFld; isoComponentSelector.setDataSchema(inFld.getSchema()); int k = -1; for (int i = 0; i < inField.getNData(); i++) if (inField.getData(i).isSimpleNumeric() && inField.getData(i).getVeclen() == 1) { k = i; break; } isoComponentSelector.setSelectedIndex(0); } if (inField instanceof IrregularField) { String[] cellSetNames = new String[((IrregularField) inField).getNCellSets()]; for (int i = 0; i < cellSetNames.length; i++) cellSetNames[i] = ((IrregularField) inField).getCellSet(i).getName(); cellSetList.setListData(cellSetNames); cellSetList.setEnabled(true); aCS = new boolean[((IrregularField) inField).getNCellSets()]; for (int i = 0; i < aCS.length; i++) aCS[i] = true; params.setActiveCellSets(aCS); } else cellSetList.setEnabled(false); dataComponentList.setInField(inField); setDataComponent(isoComponentSelector.getComponent()); params.setActive(true); } | /**
* Setter for property inField.
*
* @param inField New value of property inField.
*/ | Setter for property inField | setInField | {
"repo_name": "IcmVis/VisNow-Pro",
"path": "src/pl/edu/icm/visnow/lib/basic/mappers/Isolines/IsolinesGUI.java",
"license": "gpl-3.0",
"size": 11839
} | [
"pl.edu.icm.visnow.datasets.Field",
"pl.edu.icm.visnow.datasets.IrregularField",
"pl.edu.icm.visnow.datasets.RegularField",
"pl.edu.icm.visnow.lib.types.VNField"
] | import pl.edu.icm.visnow.datasets.Field; import pl.edu.icm.visnow.datasets.IrregularField; import pl.edu.icm.visnow.datasets.RegularField; import pl.edu.icm.visnow.lib.types.VNField; | import pl.edu.icm.visnow.datasets.*; import pl.edu.icm.visnow.lib.types.*; | [
"pl.edu.icm"
] | pl.edu.icm; | 2,499,140 |
List<Object> commandInfo(CommandType... commands); | List<Object> commandInfo(CommandType... commands); | /**
* Returns an array reply of details about the requested commands.
*
* @param commands the commands to query for
* @return List<Object> array-reply
*/ | Returns an array reply of details about the requested commands | commandInfo | {
"repo_name": "mp911de/lettuce",
"path": "src/main/java/io/lettuce/core/api/sync/RedisServerCommands.java",
"license": "apache-2.0",
"size": 10937
} | [
"io.lettuce.core.protocol.CommandType",
"java.util.List"
] | import io.lettuce.core.protocol.CommandType; import java.util.List; | import io.lettuce.core.protocol.*; import java.util.*; | [
"io.lettuce.core",
"java.util"
] | io.lettuce.core; java.util; | 1,229,443 |
public Item findByName(String name) {
Item result = null;
PreparedStatement ps = null;
try {
ps = connector().prepareStatement("SELECT * FROM item WHERE name = ?");
ps.setString(1, name);
ResultSet rs = ps.executeQuery();
while (rs.next()) {
result = new Item(rs.getInt("id"), rs.getString("name"), rs.getString("description"), rs.getTimestamp("create_date"));
}
} catch (SQLException e) {
e.printStackTrace();
} finally {
if (ps != null) {
try {
connector().close();
ps.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
return result;
} | Item function(String name) { Item result = null; PreparedStatement ps = null; try { ps = connector().prepareStatement(STR); ps.setString(1, name); ResultSet rs = ps.executeQuery(); while (rs.next()) { result = new Item(rs.getInt("id"), rs.getString("name"), rs.getString(STR), rs.getTimestamp(STR)); } } catch (SQLException e) { e.printStackTrace(); } finally { if (ps != null) { try { connector().close(); ps.close(); } catch (SQLException e) { e.printStackTrace(); } } } return result; } | /**
* Find by name.
* @param name find.
* @return Item.
*/ | Find by name | findByName | {
"repo_name": "Apeksi1990/asemenov",
"path": "chapter_008/src/main/java/ru/asemenov/jdbc/TrackerSQL.java",
"license": "apache-2.0",
"size": 6594
} | [
"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; | 2,278,610 |
public Set<String> getDefaultTags() {
return defaultTags;
} | Set<String> function() { return defaultTags; } | /**
* Returns default tags of this channel.
*
* @return default tags of this channel.
*/ | Returns default tags of this channel | getDefaultTags | {
"repo_name": "smilzo-mobimesh/smarthome",
"path": "bundles/core/org.eclipse.smarthome.core.thing/src/main/java/org/eclipse/smarthome/core/thing/Channel.java",
"license": "epl-1.0",
"size": 4985
} | [
"java.util.Set"
] | import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 806,359 |
public Collection ejbFindAllComplaintsByStatus(CaseStatus status) throws FinderException {
return super.ejbFindAllCasesByStatus(status);
} | Collection function(CaseStatus status) throws FinderException { return super.ejbFindAllCasesByStatus(status); } | /**
* Method ejbFindAllComplaintsByStatus.
* @param CaseStatus status
* @return Collection
* @throws FinderException
* @throws RemoteException
*/ | Method ejbFindAllComplaintsByStatus | ejbFindAllComplaintsByStatus | {
"repo_name": "idega/se.idega.idegaweb.commune",
"path": "src/java/se/idega/idegaweb/commune/complaint/data/ComplaintBMPBean.java",
"license": "gpl-3.0",
"size": 6620
} | [
"com.idega.block.process.data.CaseStatus",
"java.util.Collection",
"javax.ejb.FinderException"
] | import com.idega.block.process.data.CaseStatus; import java.util.Collection; import javax.ejb.FinderException; | import com.idega.block.process.data.*; import java.util.*; import javax.ejb.*; | [
"com.idega.block",
"java.util",
"javax.ejb"
] | com.idega.block; java.util; javax.ejb; | 2,325,279 |
ImportResult importFromStream(String format, InputStream input, Map importMetadata); | ImportResult importFromStream(String format, InputStream input, Map importMetadata); | /**
* Import a serialized job, preserving the UUID
*
* @param format format, 'xml' or 'yaml'
* @param input input stream
* @param importMetadata metadata to attach to the job
*
* @return result
*/ | Import a serialized job, preserving the UUID | importFromStream | {
"repo_name": "variacode/rundeck",
"path": "core/src/main/java/com/dtolabs/rundeck/plugins/scm/JobImporter.java",
"license": "apache-2.0",
"size": 2452
} | [
"java.io.InputStream",
"java.util.Map"
] | import java.io.InputStream; import java.util.Map; | import java.io.*; import java.util.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 485,399 |
private void setAlphaInternal(float alpha) {
// TODO(mdjones): This null check is exclusively for Android K which has a slightly
// different order for animation events. Once deprecated we should remove it.
if (mModel == null) return;
if (MathUtils.areFloatsEqual(alpha, mModel.get(ScrimProperties.ALPHA))) return;
mModel.set(ScrimProperties.ALPHA, alpha);
if (mModel.get(ScrimProperties.AFFECTS_STATUS_BAR) && mSystemUiScrimDelegate != null) {
mSystemUiScrimDelegate.setStatusBarScrimFraction(alpha);
}
if (mModel.getAllSetProperties().contains(ScrimProperties.AFFECTS_NAVIGATION_BAR)
&& mModel.get(ScrimProperties.AFFECTS_NAVIGATION_BAR)
&& mSystemUiScrimDelegate != null) {
mSystemUiScrimDelegate.setNavigationBarScrimFraction(alpha);
}
boolean isVisible = alpha > 0;
if (mModel.get(ScrimProperties.VISIBILITY_CALLBACK) != null
&& mCurrentVisibility != isVisible) {
mModel.get(ScrimProperties.VISIBILITY_CALLBACK).onResult(isVisible);
}
mCurrentVisibility = isVisible;
if (mIsHidingOrHidden && !isVisible && mModel != null) {
mModel = null;
mScrimHiddenRunnable.run();
}
} | void function(float alpha) { if (mModel == null) return; if (MathUtils.areFloatsEqual(alpha, mModel.get(ScrimProperties.ALPHA))) return; mModel.set(ScrimProperties.ALPHA, alpha); if (mModel.get(ScrimProperties.AFFECTS_STATUS_BAR) && mSystemUiScrimDelegate != null) { mSystemUiScrimDelegate.setStatusBarScrimFraction(alpha); } if (mModel.getAllSetProperties().contains(ScrimProperties.AFFECTS_NAVIGATION_BAR) && mModel.get(ScrimProperties.AFFECTS_NAVIGATION_BAR) && mSystemUiScrimDelegate != null) { mSystemUiScrimDelegate.setNavigationBarScrimFraction(alpha); } boolean isVisible = alpha > 0; if (mModel.get(ScrimProperties.VISIBILITY_CALLBACK) != null && mCurrentVisibility != isVisible) { mModel.get(ScrimProperties.VISIBILITY_CALLBACK).onResult(isVisible); } mCurrentVisibility = isVisible; if (mIsHidingOrHidden && !isVisible && mModel != null) { mModel = null; mScrimHiddenRunnable.run(); } } | /**
* This method actually changes the alpha and can be used for setting the alpha via animation.
* @param alpha The new alpha for the scrim in range [0, 1].
*/ | This method actually changes the alpha and can be used for setting the alpha via animation | setAlphaInternal | {
"repo_name": "chromium/chromium",
"path": "components/browser_ui/widget/android/java/src/org/chromium/components/browser_ui/widget/scrim/ScrimMediator.java",
"license": "bsd-3-clause",
"size": 9767
} | [
"org.chromium.base.MathUtils"
] | import org.chromium.base.MathUtils; | import org.chromium.base.*; | [
"org.chromium.base"
] | org.chromium.base; | 2,474,820 |
public Class<? extends IHighlightingConfiguration> bindILexicalHighlightingConfiguration() {
return LexicalHighlightingConfiguration.class;
}
// Doesn't work since MindLabelProvider.getImage filters on Mind-specific types (legacy types dependency)
// and our content is never recognized
//
// @Override
// public void configureContentProposalLabelProvider(Binder binder) {
// binder.bind(ILabelProvider.class)
// .annotatedWith(ContentProposalLabelProvider.class)
// .to(MindLabelProvider.class);
// } | Class<? extends IHighlightingConfiguration> function() { return LexicalHighlightingConfiguration.class; } | /**
* register syntax coloring
* @return class which define MIND ADL syntax coloring
*/ | register syntax coloring | bindILexicalHighlightingConfiguration | {
"repo_name": "StephaneSeyvoz/mindEd",
"path": "org.ow2.mindEd.adl.textual.ui/src/org/ow2/mindEd/adl/textual/ui/FractalUiModule.java",
"license": "lgpl-3.0",
"size": 2663
} | [
"org.eclipse.xtext.ui.editor.syntaxcoloring.IHighlightingConfiguration"
] | import org.eclipse.xtext.ui.editor.syntaxcoloring.IHighlightingConfiguration; | import org.eclipse.xtext.ui.editor.syntaxcoloring.*; | [
"org.eclipse.xtext"
] | org.eclipse.xtext; | 715,974 |
private AnnotationMetadata getGvNIXWebServiceAnnotation(
ClassOrInterfaceDeclaration classOrInterfaceDeclaration,
ClassOrInterfaceDeclaration implementedInterface, JavaType javaType) {
AnnotationMetadata gvNIXWServAnnMdata;
List<AnnotationAttributeValue<?>> gvNIXWServAnnAttr = new ArrayList<AnnotationAttributeValue<?>>();
// Search for interface annotation attribute values.
List<AnnotationExpr> annotationInterfaceExprList = implementedInterface
.getAnnotations();
for (AnnotationExpr annotationExpr : annotationInterfaceExprList) {
if (annotationExpr instanceof NormalAnnotationExpr) {
NormalAnnotationExpr normalAnnotationExpr = (NormalAnnotationExpr) annotationExpr;
StringAttributeValue addressStringAttributeValue;
if (normalAnnotationExpr.getName().getName()
.contains(webServiceInterface)) {
// Retrieve values.
for (MemberValuePair pair : normalAnnotationExpr.getPairs()) {
if (pair.getName().contentEquals("name")) {
// address
addressStringAttributeValue = new StringAttributeValue(
new JavaSymbolName("name"),
((StringLiteralExpr) pair.getValue())
.getValue());
gvNIXWServAnnAttr.add(addressStringAttributeValue);
break;
}
}
}
else if (normalAnnotationExpr.getName().getName()
.contains(soapBinding)) {
for (MemberValuePair pair : normalAnnotationExpr.getPairs()) {
EnumAttributeValue enumparamStyleAttrVal;
// TODO this is dead code, to Remove it or it's a bug??
// enumparameterStyleAttributeValue = new
// EnumAttributeValue(
// new JavaSymbolName("parameterStyle"),
// new EnumDetails(
// new JavaType(
// "org.gvnix.service.roo.addon.annotations.GvNIXWebService.GvNIXWebServiceParameterStyle"),
// new JavaSymbolName("WRAPPED")));
if (pair.getName().contentEquals("parameterStyle")) {
enumparamStyleAttrVal = new EnumAttributeValue(
new JavaSymbolName("parameterStyle"),
new EnumDetails(
new JavaType(
"org.gvnix.service.roo.addon.annotations.GvNIXWebService.GvNIXWebServiceParameterStyle"),
new JavaSymbolName(
((FieldAccessExpr) pair
.getValue())
.getField())));
gvNIXWServAnnAttr.add(enumparamStyleAttrVal);
}
}
}
}
}
List<AnnotationExpr> annotationExprList = classOrInterfaceDeclaration
.getAnnotations();
for (AnnotationExpr annotationExpr : annotationExprList) {
if (annotationExpr instanceof NormalAnnotationExpr) {
NormalAnnotationExpr normalAnnotationExpr = (NormalAnnotationExpr) annotationExpr;
StringAttributeValue nameStringAttributeValue;
StringAttributeValue tarNamespaceStrAttrVal;
StringAttributeValue servNameStrAttrVal;
// Retrieve values.
for (MemberValuePair pair : normalAnnotationExpr.getPairs()) {
if (pair.getName().contentEquals("serviceName")) {
// serviceName
servNameStrAttrVal = new StringAttributeValue(
new JavaSymbolName("serviceName"),
((StringLiteralExpr) pair.getValue())
.getValue());
gvNIXWServAnnAttr.add(servNameStrAttrVal);
continue;
}
else if (pair.getName().contentEquals("targetNamespace")) {
// targetNamespace
tarNamespaceStrAttrVal = new StringAttributeValue(
new JavaSymbolName("targetNamespace"),
((StringLiteralExpr) pair.getValue())
.getValue());
gvNIXWServAnnAttr.add(tarNamespaceStrAttrVal);
continue;
}
else if (pair.getName().contentEquals("portName")) {
// name
nameStringAttributeValue = new StringAttributeValue(
new JavaSymbolName("address"),
((StringLiteralExpr) pair.getValue())
.getValue());
gvNIXWServAnnAttr.add(nameStringAttributeValue);
continue;
}
}
}
}
// fullyQualifiedTypeName
StringAttributeValue fullyQualStrAttrVal = new StringAttributeValue(
new JavaSymbolName("fullyQualifiedTypeName"),
javaType.getFullyQualifiedTypeName());
gvNIXWServAnnAttr.add(fullyQualStrAttrVal);
// exported
BooleanAttributeValue exportedAttributeValue = new BooleanAttributeValue(
new JavaSymbolName("exported"), true);
gvNIXWServAnnAttr.add(exportedAttributeValue);
// Create GvNIXWebService annotation.
gvNIXWServAnnMdata = new AnnotationMetadataBuilder(new JavaType(
GvNIXWebService.class.getName()), gvNIXWServAnnAttr).build();
return gvNIXWServAnnMdata;
} | AnnotationMetadata function( ClassOrInterfaceDeclaration classOrInterfaceDeclaration, ClassOrInterfaceDeclaration implementedInterface, JavaType javaType) { AnnotationMetadata gvNIXWServAnnMdata; List<AnnotationAttributeValue<?>> gvNIXWServAnnAttr = new ArrayList<AnnotationAttributeValue<?>>(); List<AnnotationExpr> annotationInterfaceExprList = implementedInterface .getAnnotations(); for (AnnotationExpr annotationExpr : annotationInterfaceExprList) { if (annotationExpr instanceof NormalAnnotationExpr) { NormalAnnotationExpr normalAnnotationExpr = (NormalAnnotationExpr) annotationExpr; StringAttributeValue addressStringAttributeValue; if (normalAnnotationExpr.getName().getName() .contains(webServiceInterface)) { for (MemberValuePair pair : normalAnnotationExpr.getPairs()) { if (pair.getName().contentEquals("name")) { addressStringAttributeValue = new StringAttributeValue( new JavaSymbolName("name"), ((StringLiteralExpr) pair.getValue()) .getValue()); gvNIXWServAnnAttr.add(addressStringAttributeValue); break; } } } else if (normalAnnotationExpr.getName().getName() .contains(soapBinding)) { for (MemberValuePair pair : normalAnnotationExpr.getPairs()) { EnumAttributeValue enumparamStyleAttrVal; if (pair.getName().contentEquals(STR)) { enumparamStyleAttrVal = new EnumAttributeValue( new JavaSymbolName(STR), new EnumDetails( new JavaType( STR), new JavaSymbolName( ((FieldAccessExpr) pair .getValue()) .getField()))); gvNIXWServAnnAttr.add(enumparamStyleAttrVal); } } } } } List<AnnotationExpr> annotationExprList = classOrInterfaceDeclaration .getAnnotations(); for (AnnotationExpr annotationExpr : annotationExprList) { if (annotationExpr instanceof NormalAnnotationExpr) { NormalAnnotationExpr normalAnnotationExpr = (NormalAnnotationExpr) annotationExpr; StringAttributeValue nameStringAttributeValue; StringAttributeValue tarNamespaceStrAttrVal; StringAttributeValue servNameStrAttrVal; for (MemberValuePair pair : normalAnnotationExpr.getPairs()) { if (pair.getName().contentEquals(STR)) { servNameStrAttrVal = new StringAttributeValue( new JavaSymbolName(STR), ((StringLiteralExpr) pair.getValue()) .getValue()); gvNIXWServAnnAttr.add(servNameStrAttrVal); continue; } else if (pair.getName().contentEquals(STR)) { tarNamespaceStrAttrVal = new StringAttributeValue( new JavaSymbolName(STR), ((StringLiteralExpr) pair.getValue()) .getValue()); gvNIXWServAnnAttr.add(tarNamespaceStrAttrVal); continue; } else if (pair.getName().contentEquals(STR)) { nameStringAttributeValue = new StringAttributeValue( new JavaSymbolName(STR), ((StringLiteralExpr) pair.getValue()) .getValue()); gvNIXWServAnnAttr.add(nameStringAttributeValue); continue; } } } } StringAttributeValue fullyQualStrAttrVal = new StringAttributeValue( new JavaSymbolName(STR), javaType.getFullyQualifiedTypeName()); gvNIXWServAnnAttr.add(fullyQualStrAttrVal); BooleanAttributeValue exportedAttributeValue = new BooleanAttributeValue( new JavaSymbolName(STR), true); gvNIXWServAnnAttr.add(exportedAttributeValue); gvNIXWServAnnMdata = new AnnotationMetadataBuilder(new JavaType( GvNIXWebService.class.getName()), gvNIXWServAnnAttr).build(); return gvNIXWServAnnMdata; } | /**
* Convert annotation @WebService values from
* {@link ClassOrInterfaceDeclaration} to {@link GvNIXWebService}. TODO to
* be removed from interface?. This method could be useless outside this
* service.
*
* @param classOrInterfaceDeclaration to retrieve values from @WebService
* annotations and convert to {@link GvNIXWebService} values.
* @param implementedInterface Web Service interface.
* @param javaType to retrieve mandatory Annotation attributed with its
* values.
* @return {@link GvNIXWebService} to define in class.
*/ | Convert annotation @WebService values from <code>ClassOrInterfaceDeclaration</code> to <code>GvNIXWebService</code>. TODO to be removed from interface?. This method could be useless outside this service | getGvNIXWebServiceAnnotation | {
"repo_name": "osroca/gvnix",
"path": "addon-service/addon/src/main/java/org/gvnix/service/roo/addon/addon/ws/export/WSExportWsdlConfigServiceImpl.java",
"license": "gpl-3.0",
"size": 51001
} | [
"com.github.antlrjavaparser.api.body.ClassOrInterfaceDeclaration",
"com.github.antlrjavaparser.api.expr.AnnotationExpr",
"com.github.antlrjavaparser.api.expr.FieldAccessExpr",
"com.github.antlrjavaparser.api.expr.MemberValuePair",
"com.github.antlrjavaparser.api.expr.NormalAnnotationExpr",
"com.github.antlrjavaparser.api.expr.StringLiteralExpr",
"java.util.ArrayList",
"java.util.List",
"org.gvnix.service.roo.addon.annotations.GvNIXWebService",
"org.springframework.roo.classpath.details.annotations.AnnotationAttributeValue",
"org.springframework.roo.classpath.details.annotations.AnnotationMetadata",
"org.springframework.roo.classpath.details.annotations.AnnotationMetadataBuilder",
"org.springframework.roo.classpath.details.annotations.BooleanAttributeValue",
"org.springframework.roo.classpath.details.annotations.EnumAttributeValue",
"org.springframework.roo.classpath.details.annotations.StringAttributeValue",
"org.springframework.roo.model.EnumDetails",
"org.springframework.roo.model.JavaSymbolName",
"org.springframework.roo.model.JavaType"
] | import com.github.antlrjavaparser.api.body.ClassOrInterfaceDeclaration; import com.github.antlrjavaparser.api.expr.AnnotationExpr; import com.github.antlrjavaparser.api.expr.FieldAccessExpr; import com.github.antlrjavaparser.api.expr.MemberValuePair; import com.github.antlrjavaparser.api.expr.NormalAnnotationExpr; import com.github.antlrjavaparser.api.expr.StringLiteralExpr; import java.util.ArrayList; import java.util.List; import org.gvnix.service.roo.addon.annotations.GvNIXWebService; import org.springframework.roo.classpath.details.annotations.AnnotationAttributeValue; import org.springframework.roo.classpath.details.annotations.AnnotationMetadata; import org.springframework.roo.classpath.details.annotations.AnnotationMetadataBuilder; import org.springframework.roo.classpath.details.annotations.BooleanAttributeValue; import org.springframework.roo.classpath.details.annotations.EnumAttributeValue; import org.springframework.roo.classpath.details.annotations.StringAttributeValue; import org.springframework.roo.model.EnumDetails; import org.springframework.roo.model.JavaSymbolName; import org.springframework.roo.model.JavaType; | import com.github.antlrjavaparser.api.body.*; import com.github.antlrjavaparser.api.expr.*; import java.util.*; import org.gvnix.service.roo.addon.annotations.*; import org.springframework.roo.classpath.details.annotations.*; import org.springframework.roo.model.*; | [
"com.github.antlrjavaparser",
"java.util",
"org.gvnix.service",
"org.springframework.roo"
] | com.github.antlrjavaparser; java.util; org.gvnix.service; org.springframework.roo; | 2,728,203 |
public boolean pathExists(E from, E to) {
List<E> successors = getSuccessors(from);
if(successors == null || successors.size() == 0) {
return false;
}
for (E successor : successors) {
if(successor.equals(to)
|| pathExists(successor, to)) {
return true;
}
}
return false;
} | boolean function(E from, E to) { List<E> successors = getSuccessors(from); if(successors == null successors.size() == 0) { return false; } for (E successor : successors) { if(successor.equals(to) pathExists(successor, to)) { return true; } } return false; } | /**
* A method to check if there is a path from a given node to another node
* @param from the start node for checking
* @param to the end node for checking
* @return true if path exists, false otherwise
*/ | A method to check if there is a path from a given node to another node | pathExists | {
"repo_name": "netxillon/pig",
"path": "src/org/apache/pig/impl/plan/OperatorPlan.java",
"license": "apache-2.0",
"size": 59154
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 561,009 |
public MmeFgwEnodeb addMmeFgwEnodeb(YangString plmnIdValue, YangUInt32 enodebIdValue)
throws JNCException {
MmeFgwEnodeb mmeFgwEnodeb = new MmeFgwEnodeb(plmnIdValue, enodebIdValue);
return addMmeFgwEnodeb(mmeFgwEnodeb);
} | MmeFgwEnodeb function(YangString plmnIdValue, YangUInt32 enodebIdValue) throws JNCException { MmeFgwEnodeb mmeFgwEnodeb = new MmeFgwEnodeb(plmnIdValue, enodebIdValue); return addMmeFgwEnodeb(mmeFgwEnodeb); } | /**
* Adds list entry "mmeFgwEnodeb", with specified keys.
* @param plmnIdValue Key argument of child.
* @param enodebIdValue Key argument of child.
* @return The added child.
*/ | Adds list entry "mmeFgwEnodeb", with specified keys | addMmeFgwEnodeb | {
"repo_name": "jnpr-shinma/yangfile",
"path": "hitel/src/hctaEpc/mmeSgsn/interface_/S1.java",
"license": "apache-2.0",
"size": 13962
} | [
"com.tailf.jnc.YangString",
"com.tailf.jnc.YangUInt32"
] | import com.tailf.jnc.YangString; import com.tailf.jnc.YangUInt32; | import com.tailf.jnc.*; | [
"com.tailf.jnc"
] | com.tailf.jnc; | 119,145 |
protected static void bootstrapUsing(final AppManifest appManifest) {
org.apache.log4j.PropertyConfigurator.configure("logging-integtest.properties");
IsisSystemForTest isft = IsisSystemForTest.getElseNull();
if(isft == null) {
isft = new IsisSystemForTest.Builder()
.withLoggingAt(org.apache.log4j.Level.INFO)
.with(appManifest)
.with(new IsisConfigurationForJdoIntegTests())
.build()
.setUpSystem();
IsisSystemForTest.set(isft);
}
// instantiating will install onto ThreadLocal
new ScenarioExecutionForIntegration();
} | static void function(final AppManifest appManifest) { org.apache.log4j.PropertyConfigurator.configure(STR); IsisSystemForTest isft = IsisSystemForTest.getElseNull(); if(isft == null) { isft = new IsisSystemForTest.Builder() .withLoggingAt(org.apache.log4j.Level.INFO) .with(appManifest) .with(new IsisConfigurationForJdoIntegTests()) .build() .setUpSystem(); IsisSystemForTest.set(isft); } new ScenarioExecutionForIntegration(); } | /**
* Intended to be called from the subclass' <code>@BeforeClass init()</code> method.
*/ | Intended to be called from the subclass' <code>@BeforeClass init()</code> method | bootstrapUsing | {
"repo_name": "incodehq/isis",
"path": "core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/IntegrationTestAbstract2.java",
"license": "apache-2.0",
"size": 4736
} | [
"org.apache.isis.applib.AppManifest",
"org.apache.isis.core.integtestsupport.scenarios.ScenarioExecutionForIntegration",
"org.apache.isis.objectstore.jdo.datanucleus.IsisConfigurationForJdoIntegTests"
] | import org.apache.isis.applib.AppManifest; import org.apache.isis.core.integtestsupport.scenarios.ScenarioExecutionForIntegration; import org.apache.isis.objectstore.jdo.datanucleus.IsisConfigurationForJdoIntegTests; | import org.apache.isis.applib.*; import org.apache.isis.core.integtestsupport.scenarios.*; import org.apache.isis.objectstore.jdo.datanucleus.*; | [
"org.apache.isis"
] | org.apache.isis; | 2,476,950 |
List<StatsStorageListener> getListeners(); | List<StatsStorageListener> getListeners(); | /**
* Get a list (shallow copy) of all listeners currently present
*
* @return List of listeners
*/ | Get a list (shallow copy) of all listeners currently present | getListeners | {
"repo_name": "crockpotveggies/deeplearning4j",
"path": "deeplearning4j-core/src/main/java/org/deeplearning4j/api/storage/StatsStorage.java",
"license": "apache-2.0",
"size": 7193
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 763,203 |
public int doStartTag() throws JspException
{
Tag parentTag = getParent();
while (!(parentTag instanceof Select)) {
parentTag = parentTag.getParent();
}
if (parentTag == null) {
//throw error
String s = Bundle.getString("Tags_SelectOptionNoSelect");
registerTagError(s, null);
return SKIP_BODY;
}
Select parentSelect = (Select) parentTag;
boolean repeating = parentSelect.isRepeater();
// if we find an option inside a select and it's not a repeating select report the error
if ((parentSelect.getOptionsDataSource() != null) && !repeating) {
String s = Bundle.getString("Tags_SelectOptionParentHasOptionsDataSource");
_hasError = true;
parentSelect.registerTagError(s, null);
return SKIP_BODY;
}
// if we are an option inside a repeating select, we must specify the type of repeater we are.
if (repeating && _repeatingType == null) {
String s = Bundle.getString("Tags_SelectRepeatingOptionType");
_hasError = true;
parentSelect.registerTagError(s, null);
return SKIP_BODY;
}
if (repeating && !isRenderable(parentSelect)) {
return SKIP_BODY;
}
// Do nothing until doEndTag() is called
return EVAL_BODY_BUFFERED;
} | int function() throws JspException { Tag parentTag = getParent(); while (!(parentTag instanceof Select)) { parentTag = parentTag.getParent(); } if (parentTag == null) { String s = Bundle.getString(STR); registerTagError(s, null); return SKIP_BODY; } Select parentSelect = (Select) parentTag; boolean repeating = parentSelect.isRepeater(); if ((parentSelect.getOptionsDataSource() != null) && !repeating) { String s = Bundle.getString(STR); _hasError = true; parentSelect.registerTagError(s, null); return SKIP_BODY; } if (repeating && _repeatingType == null) { String s = Bundle.getString(STR); _hasError = true; parentSelect.registerTagError(s, null); return SKIP_BODY; } if (repeating && !isRenderable(parentSelect)) { return SKIP_BODY; } return EVAL_BODY_BUFFERED; } | /**
* Process the start of this tag.
* @throws JspException if a JSP exception has occurred
*/ | Process the start of this tag | doStartTag | {
"repo_name": "moparisthebest/beehive",
"path": "beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/SelectOption.java",
"license": "apache-2.0",
"size": 11950
} | [
"javax.servlet.jsp.JspException",
"javax.servlet.jsp.tagext.Tag",
"org.apache.beehive.netui.util.Bundle"
] | import javax.servlet.jsp.JspException; import javax.servlet.jsp.tagext.Tag; import org.apache.beehive.netui.util.Bundle; | import javax.servlet.jsp.*; import javax.servlet.jsp.tagext.*; import org.apache.beehive.netui.util.*; | [
"javax.servlet",
"org.apache.beehive"
] | javax.servlet; org.apache.beehive; | 2,407,113 |
private native void nativeCopyContentToPicture(Picture picture); | native void function(Picture picture); | /**
* Create a flat picture from the set of pictures.
*/ | Create a flat picture from the set of pictures | nativeCopyContentToPicture | {
"repo_name": "ScotDiddle/Andy2Go",
"path": "java/WebView.class.java",
"license": "mit",
"size": 97341
} | [
"android.graphics.Picture"
] | import android.graphics.Picture; | import android.graphics.*; | [
"android.graphics"
] | android.graphics; | 1,273,330 |
private Response getComponents() {
return new Response(Response.OK, this.componetsObjectProperties);
} | Response function() { return new Response(Response.OK, this.componetsObjectProperties); } | /**
* Method for getting the component list.
*
* @return res ResponseObject. {@literal Body should be dict<Component.id, Component.property>}.
*/ | Method for getting the component list | getComponents | {
"repo_name": "y-higuchi/odenos",
"path": "src/main/java/org/o3project/odenos/core/manager/system/SystemManager.java",
"license": "apache-2.0",
"size": 51475
} | [
"org.o3project.odenos.remoteobject.message.Response"
] | import org.o3project.odenos.remoteobject.message.Response; | import org.o3project.odenos.remoteobject.message.*; | [
"org.o3project.odenos"
] | org.o3project.odenos; | 2,808,138 |
@Test
public void removeReferenceNtoN() {
final TestElement actor = Create.testElement();
final TestElement useCase = Create.testElement();
new EMFStoreCommand() {
| void function() { final TestElement actor = Create.testElement(); final TestElement useCase = Create.testElement(); new EMFStoreCommand() { | /**
* Remove a reference and check the generated notification.
*/ | Remove a reference and check the generated notification | removeReferenceNtoN | {
"repo_name": "edgarmueller/emfstore-rest",
"path": "tests/org.eclipse.emf.emfstore.client.changetracking.test/src/org/eclipse/emf/emfstore/client/changetracking/test/notification/ReferenceNotificationTest.java",
"license": "epl-1.0",
"size": 9800
} | [
"org.eclipse.emf.emfstore.client.test.common.dsl.Create",
"org.eclipse.emf.emfstore.internal.client.model.util.EMFStoreCommand",
"org.eclipse.emf.emfstore.test.model.TestElement"
] | import org.eclipse.emf.emfstore.client.test.common.dsl.Create; import org.eclipse.emf.emfstore.internal.client.model.util.EMFStoreCommand; import org.eclipse.emf.emfstore.test.model.TestElement; | import org.eclipse.emf.emfstore.client.test.common.dsl.*; import org.eclipse.emf.emfstore.internal.client.model.util.*; import org.eclipse.emf.emfstore.test.model.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 706,066 |
void setBoolean(boolean value);
/**
* Returns the value of the '<em><b>Boolean List</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* <!-- begin-model-doc -->
* XML List based on XML Schema boolean type. An element of this type contains a space-separated list of boolean values {0,1,true,false} | void setBoolean(boolean value); /** * Returns the value of the '<em><b>Boolean List</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * <!-- begin-model-doc --> * XML List based on XML Schema boolean type. An element of this type contains a space-separated list of boolean values {0,1,true,false} | /**
* Sets the value of the '{@link net.opengis.gml311.DocumentRoot#isBoolean <em>Boolean</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Boolean</em>' attribute.
* @see #isBoolean()
* @generated
*/ | Sets the value of the '<code>net.opengis.gml311.DocumentRoot#isBoolean Boolean</code>' attribute. | setBoolean | {
"repo_name": "geotools/geotools",
"path": "modules/ogc/net.opengis.wmts/src/net/opengis/gml311/DocumentRoot.java",
"license": "lgpl-2.1",
"size": 620429
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 960,253 |
public static <E> Set<E> orderedSet(final Set<E> set) {
return ListOrderedSet.listOrderedSet(set);
} | static <E> Set<E> function(final Set<E> set) { return ListOrderedSet.listOrderedSet(set); } | /**
* Returns a set that maintains the order of elements that are added
* backed by the given set.
* <p>
* If an element is added twice, the order is determined by the first add.
* The order is observed through the iterator or toArray.
*
* @param <E> the element type
* @param set the set to order, must not be null
* @return an ordered set backed by the given set
* @throws NullPointerException if the set is null
*/ | Returns a set that maintains the order of elements that are added backed by the given set. If an element is added twice, the order is determined by the first add. The order is observed through the iterator or toArray | orderedSet | {
"repo_name": "apache/commons-collections",
"path": "src/main/java/org/apache/commons/collections4/SetUtils.java",
"license": "apache-2.0",
"size": 24909
} | [
"java.util.Set",
"org.apache.commons.collections4.set.ListOrderedSet"
] | import java.util.Set; import org.apache.commons.collections4.set.ListOrderedSet; | import java.util.*; import org.apache.commons.collections4.set.*; | [
"java.util",
"org.apache.commons"
] | java.util; org.apache.commons; | 1,515,446 |
public void updateSkybox(int front, int right, int back, int left, int up, int down) throws Exception {
if(mSkyboxTexture.getClass() != CubeMapTexture.class)
throw new Exception("The skybox texture cannot be updated. It is not a cube map texture.");
int[] resourceIds = new int[] { front, right, back, left, up, down };
CubeMapTexture cubemap = (CubeMapTexture)mSkyboxTexture;
cubemap.setResourceIds(resourceIds);
mRenderer.getTextureManager().replaceTexture(cubemap);
}
| void function(int front, int right, int back, int left, int up, int down) throws Exception { if(mSkyboxTexture.getClass() != CubeMapTexture.class) throw new Exception(STR); int[] resourceIds = new int[] { front, right, back, left, up, down }; CubeMapTexture cubemap = (CubeMapTexture)mSkyboxTexture; cubemap.setResourceIds(resourceIds); mRenderer.getTextureManager().replaceTexture(cubemap); } | /**
* Updates the sky box textures with 6 new resource ids.
*
* @param front int Resource id for the front face.
* @param right int Resource id for the right face.
* @param back int Resource id for the back face.
* @param left int Resource id for the left face.
* @param up int Resource id for the up face.
* @param down int Resource id for the down face.
* @throws Exception
*/ | Updates the sky box textures with 6 new resource ids | updateSkybox | {
"repo_name": "sujitkjha/360-Video-Player-for-Android",
"path": "rajawali/src/main/java/org/rajawali3d/scene/RajawaliScene.java",
"license": "gpl-3.0",
"size": 47462
} | [
"org.rajawali3d.materials.textures.CubeMapTexture"
] | import org.rajawali3d.materials.textures.CubeMapTexture; | import org.rajawali3d.materials.textures.*; | [
"org.rajawali3d.materials"
] | org.rajawali3d.materials; | 684,944 |
@Deprecated
public List<HttpCookie> getHttpCookies(){
return getHttpCookies(null);
}
| List<HttpCookie> function(){ return getHttpCookies(null); } | /**
* Parses the response headers and build a lis of all the http cookies set. <br/>
* NOTE: For the cookies whose domain could not be determined, no domain is set, so this must be taken
* into account.
*
* @return the http cookies
* @deprecated Use the {@link #getHttpCookies(String)} method to take into account the default domain for
* cookie
*/ | Parses the response headers and build a lis of all the http cookies set. into account | getHttpCookies | {
"repo_name": "0xkasun/zaproxy",
"path": "src/org/parosproxy/paros/network/HttpResponseHeader.java",
"license": "apache-2.0",
"size": 10460
} | [
"java.net.HttpCookie",
"java.util.List"
] | import java.net.HttpCookie; import java.util.List; | import java.net.*; import java.util.*; | [
"java.net",
"java.util"
] | java.net; java.util; | 1,886,978 |
protected boolean isPersisted(Resource resource) {
boolean result = false;
try {
InputStream stream = editingDomain.getResourceSet().getURIConverter().createInputStream(resource.getURI());
if (stream != null) {
result = true;
stream.close();
}
}
catch (IOException e) {
// Ignore
}
return result;
} | boolean function(Resource resource) { boolean result = false; try { InputStream stream = editingDomain.getResourceSet().getURIConverter().createInputStream(resource.getURI()); if (stream != null) { result = true; stream.close(); } } catch (IOException e) { } return result; } | /**
* This returns whether something has been persisted to the URI of the specified resource.
* The implementation uses the URI converter from the editor's resource set to try to open an input stream.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | This returns whether something has been persisted to the URI of the specified resource. The implementation uses the URI converter from the editor's resource set to try to open an input stream. | isPersisted | {
"repo_name": "KAMP-Research/KAMP",
"path": "bundles/Toometa/de.uka.ipd.sdq.dsexplore.qml.dimensiontypes.editor/src/de/uka/ipd/sdq/dsexplore/qml/dimensiontypes/presentation/DimensiontypesEditor.java",
"license": "apache-2.0",
"size": 54663
} | [
"java.io.IOException",
"java.io.InputStream",
"org.eclipse.emf.ecore.resource.Resource"
] | import java.io.IOException; import java.io.InputStream; import org.eclipse.emf.ecore.resource.Resource; | import java.io.*; import org.eclipse.emf.ecore.resource.*; | [
"java.io",
"org.eclipse.emf"
] | java.io; org.eclipse.emf; | 476,813 |
public RowMetaInterface createResultRowMetaInterface() {
RowMetaInterface rowMetaInterface = new RowMeta();
ValueMetaInterface[] valuesMeta = {
new ValueMeta("Id", ValueMeta.TYPE_INTEGER),
new ValueMeta("State", ValueMeta.TYPE_STRING),
new ValueMeta("City", ValueMeta.TYPE_STRING)
};
for (int i = 0; i < valuesMeta.length; i++) {
rowMetaInterface.addValueMeta(valuesMeta[i]);
}
return rowMetaInterface;
} | RowMetaInterface function() { RowMetaInterface rowMetaInterface = new RowMeta(); ValueMetaInterface[] valuesMeta = { new ValueMeta("Id", ValueMeta.TYPE_INTEGER), new ValueMeta("State", ValueMeta.TYPE_STRING), new ValueMeta("City", ValueMeta.TYPE_STRING) }; for (int i = 0; i < valuesMeta.length; i++) { rowMetaInterface.addValueMeta(valuesMeta[i]); } return rowMetaInterface; } | /**
* Creates a row meta interface for the fields that
* are defined by performing a getFields and by
* checking "Result filenames - Add filenames to result
* from "Text File Input" dialog.
*
* @return
*/ | Creates a row meta interface for the fields that are defined by performing a getFields and by checking "Result filenames - Add filenames to result from "Text File Input" dialog | createResultRowMetaInterface | {
"repo_name": "lihongqiang/kettle-4.4.0-stable",
"path": "test/org/pentaho/di/trans/steps/jsonoutput/JsonOutputTest.java",
"license": "apache-2.0",
"size": 13805
} | [
"org.pentaho.di.core.row.RowMeta",
"org.pentaho.di.core.row.RowMetaInterface",
"org.pentaho.di.core.row.ValueMeta",
"org.pentaho.di.core.row.ValueMetaInterface"
] | import org.pentaho.di.core.row.RowMeta; import org.pentaho.di.core.row.RowMetaInterface; import org.pentaho.di.core.row.ValueMeta; import org.pentaho.di.core.row.ValueMetaInterface; | import org.pentaho.di.core.row.*; | [
"org.pentaho.di"
] | org.pentaho.di; | 305,632 |
public void handleEvent(SyncEvent event, SyncFolder folder) {
if (event instanceof SyncMkdirFailedEvent) {
SyncMkdirFailedEvent e = (SyncMkdirFailedEvent) event;
log(System.err, "ERRO Failed to create '" + e.getFolder() + "'");
} else if (event instanceof SyncChecksumFailedEvent) {
SyncChecksumFailedEvent e = (SyncChecksumFailedEvent) event;
log(System.err, "ERRO Failed to checksum '" + e.getPath() + "'");
} else if (event instanceof SyncDone) {
log(System.out, "SYDO Synchronization of '" + folder.getLocal().getAbsolutePath() + "' completed");
}
} | void function(SyncEvent event, SyncFolder folder) { if (event instanceof SyncMkdirFailedEvent) { SyncMkdirFailedEvent e = (SyncMkdirFailedEvent) event; log(System.err, STR + e.getFolder() + "'"); } else if (event instanceof SyncChecksumFailedEvent) { SyncChecksumFailedEvent e = (SyncChecksumFailedEvent) event; log(System.err, STR + e.getPath() + "'"); } else if (event instanceof SyncDone) { log(System.out, STR + folder.getLocal().getAbsolutePath() + STR); } } | /**
* Handles synchronization specific events
*
* @param event sync folder event
* @param folder folder that called event
*/ | Handles synchronization specific events | handleEvent | {
"repo_name": "zipekjan/minicloud-client-java",
"path": "src/cz/zipek/minicloud/TextSync.java",
"license": "mit",
"size": 7840
} | [
"cz.zipek.minicloud.sync.SyncEvent",
"cz.zipek.minicloud.sync.SyncFolder",
"cz.zipek.minicloud.sync.events.SyncChecksumFailedEvent",
"cz.zipek.minicloud.sync.events.SyncDone",
"cz.zipek.minicloud.sync.events.SyncMkdirFailedEvent"
] | import cz.zipek.minicloud.sync.SyncEvent; import cz.zipek.minicloud.sync.SyncFolder; import cz.zipek.minicloud.sync.events.SyncChecksumFailedEvent; import cz.zipek.minicloud.sync.events.SyncDone; import cz.zipek.minicloud.sync.events.SyncMkdirFailedEvent; | import cz.zipek.minicloud.sync.*; import cz.zipek.minicloud.sync.events.*; | [
"cz.zipek.minicloud"
] | cz.zipek.minicloud; | 59,591 |
PropertyDescriptorDTO getProcessorPropertyDescriptor(String id, String property); | PropertyDescriptorDTO getProcessorPropertyDescriptor(String id, String property); | /**
* Get the descriptor for the specified property of the specified processor.
*
* @param id id
* @param property property
* @return descriptor
*/ | Get the descriptor for the specified property of the specified processor | getProcessorPropertyDescriptor | {
"repo_name": "PuspenduBanerjee/nifi",
"path": "nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/NiFiServiceFacade.java",
"license": "apache-2.0",
"size": 53497
} | [
"org.apache.nifi.web.api.dto.PropertyDescriptorDTO"
] | import org.apache.nifi.web.api.dto.PropertyDescriptorDTO; | import org.apache.nifi.web.api.dto.*; | [
"org.apache.nifi"
] | org.apache.nifi; | 1,078,249 |
public static boolean isInsideProject(List<String> projectResources, String resourcename) {
for (int i = (projectResources.size() - 1); i >= 0; i--) {
String projectResource = projectResources.get(i);
if (CmsResource.isFolder(projectResource)) {
if (resourcename.startsWith(projectResource)) {
// folder - check only the prefix
return true;
}
} else {
if (resourcename.equals(projectResource)) {
// file - check the full path
return true;
}
}
}
return false;
} | static boolean function(List<String> projectResources, String resourcename) { for (int i = (projectResources.size() - 1); i >= 0; i--) { String projectResource = projectResources.get(i); if (CmsResource.isFolder(projectResource)) { if (resourcename.startsWith(projectResource)) { return true; } } else { if (resourcename.equals(projectResource)) { return true; } } } return false; } | /**
* Checks if the full resource name (including the site root) of a resource matches
* any of the project resources of a project.<p>
*
* @param projectResources a List of project resources as Strings
* @param resourcename the resource to check
* @return true, if the resource is "inside" the project resources
*/ | Checks if the full resource name (including the site root) of a resource matches any of the project resources of a project | isInsideProject | {
"repo_name": "serrapos/opencms-core",
"path": "src/org/opencms/file/CmsProject.java",
"license": "lgpl-2.1",
"size": 14636
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,351,230 |
public UpdateSettingsRequest settings(Settings settings) {
this.settings = settings;
return this;
} | UpdateSettingsRequest function(Settings settings) { this.settings = settings; return this; } | /**
* The settings to created the index with.
*/ | The settings to created the index with | settings | {
"repo_name": "jprante/elasticsearch-client",
"path": "elasticsearch-client-admin/src/main/java/org/elasticsearch/action/admin/indices/settings/UpdateSettingsRequest.java",
"license": "apache-2.0",
"size": 4686
} | [
"org.elasticsearch.common.settings.Settings"
] | import org.elasticsearch.common.settings.Settings; | import org.elasticsearch.common.settings.*; | [
"org.elasticsearch.common"
] | org.elasticsearch.common; | 1,755,208 |
public Set getClassNames() {
HashSet result = new HashSet();
LongVector v = items;
int size = numOfItems;
for (int i = 1; i < size; ++i) {
String className = v.elementAt(i).getClassName(this);
if (className != null)
result.add(className);
}
return result;
} | Set function() { HashSet result = new HashSet(); LongVector v = items; int size = numOfItems; for (int i = 1; i < size; ++i) { String className = v.elementAt(i).getClassName(this); if (className != null) result.add(className); } return result; } | /**
* Get all the class names.
*
* @return a set of class names (<code>String</code> objects).
*/ | Get all the class names | getClassNames | {
"repo_name": "erkieh/proxyhotswap",
"path": "src/main/java/io/github/proxyhotswap/javassist/bytecode/ConstPool.java",
"license": "gpl-2.0",
"size": 60250
} | [
"java.util.HashSet",
"java.util.Set"
] | import java.util.HashSet; import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 465,656 |
private void discardEditLogSegments(long startTxId) throws IOException {
File currentDir = sd.getCurrentDir();
List<EditLogFile> allLogFiles = matchEditLogs(currentDir);
List<EditLogFile> toTrash = Lists.newArrayList();
LOG.info("Discard the EditLog files, the given start txid is " + startTxId);
// go through the editlog files to make sure the startTxId is right at the
// segment boundary
for (EditLogFile elf : allLogFiles) {
if (elf.getFirstTxId() >= startTxId) {
toTrash.add(elf);
} else {
Preconditions.checkState(elf.getLastTxId() < startTxId);
}
}
for (EditLogFile elf : toTrash) {
// rename these editlog file as .trash
elf.moveAsideTrashFile(startTxId);
LOG.info("Trash the EditLog file " + elf);
}
} | void function(long startTxId) throws IOException { File currentDir = sd.getCurrentDir(); List<EditLogFile> allLogFiles = matchEditLogs(currentDir); List<EditLogFile> toTrash = Lists.newArrayList(); LOG.info(STR + startTxId); for (EditLogFile elf : allLogFiles) { if (elf.getFirstTxId() >= startTxId) { toTrash.add(elf); } else { Preconditions.checkState(elf.getLastTxId() < startTxId); } } for (EditLogFile elf : toTrash) { elf.moveAsideTrashFile(startTxId); LOG.info(STR + elf); } } | /**
* Discard all editlog segments whose first txid is greater than or equal to
* the given txid, by renaming them with suffix ".trash".
*/ | Discard all editlog segments whose first txid is greater than or equal to the given txid, by renaming them with suffix ".trash" | discardEditLogSegments | {
"repo_name": "VicoWu/hadoop-2.7.3",
"path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FileJournalManager.java",
"license": "apache-2.0",
"size": 21755
} | [
"com.google.common.base.Preconditions",
"com.google.common.collect.Lists",
"java.io.File",
"java.io.IOException",
"java.util.List"
] | import com.google.common.base.Preconditions; import com.google.common.collect.Lists; import java.io.File; import java.io.IOException; import java.util.List; | import com.google.common.base.*; import com.google.common.collect.*; import java.io.*; import java.util.*; | [
"com.google.common",
"java.io",
"java.util"
] | com.google.common; java.io; java.util; | 552,141 |
public static Metric<ILSingleDimensional> createDiscernabilityMetric(boolean monotonic) {
return createDiscernabilityMetric(monotonic, 0);
} | static Metric<ILSingleDimensional> function(boolean monotonic) { return createDiscernabilityMetric(monotonic, 0); } | /**
* Creates an instance of the discernability metric. The monotonic variant is DM*.
*
* @param monotonic If set to true, the monotonic variant (DM*) will be created
* @return
*/ | Creates an instance of the discernability metric. The monotonic variant is DM* | createDiscernabilityMetric | {
"repo_name": "RaffaelBild/arx",
"path": "src/main/org/deidentifier/arx/metric/v2/__MetricV2.java",
"license": "apache-2.0",
"size": 36238
} | [
"org.deidentifier.arx.metric.Metric"
] | import org.deidentifier.arx.metric.Metric; | import org.deidentifier.arx.metric.*; | [
"org.deidentifier.arx"
] | org.deidentifier.arx; | 938,599 |
public void registerJar(String name) throws IOException {
// Check if this operation is permitted
filter.validate(PigCommandFilter.Command.REGISTER);
if (pigContext.hasJar(name)) {
log.debug("Ignoring duplicate registration for jar " + name);
return;
}
// first try to locate jar via system resources
// if this fails, try by using "name" as File (this preserves
// compatibility with case when user passes absolute path or path
// relative to current working directory.)
if (name != null) {
if (name.isEmpty()) {
log.warn("Empty string specified for jar path");
return;
}
URL resource = locateJarFromResources(name);
if (resource == null) {
FetchFileRet[] files = FileLocalizer.fetchFiles(pigContext.getProperties(), name);
for (FetchFileRet file : files) {
File f = file.file;
if (!f.canRead()) {
int errCode = 4002;
String msg = "Can't read jar file: " + name;
throw new FrontendException(msg, errCode, PigException.USER_ENVIRONMENT);
}
pigContext.addJar(f.toURI().toURL(), name);
}
} else {
pigContext.addJar(resource, name);
}
}
} | void function(String name) throws IOException { filter.validate(PigCommandFilter.Command.REGISTER); if (pigContext.hasJar(name)) { log.debug(STR + name); return; } if (name != null) { if (name.isEmpty()) { log.warn(STR); return; } URL resource = locateJarFromResources(name); if (resource == null) { FetchFileRet[] files = FileLocalizer.fetchFiles(pigContext.getProperties(), name); for (FetchFileRet file : files) { File f = file.file; if (!f.canRead()) { int errCode = 4002; String msg = STR + name; throw new FrontendException(msg, errCode, PigException.USER_ENVIRONMENT); } pigContext.addJar(f.toURI().toURL(), name); } } else { pigContext.addJar(resource, name); } } } | /**
* Registers a jar file. Name of the jar file can be an absolute or
* relative path.
*
* If multiple resources are found with the specified name, the
* first one is registered as returned by getSystemResources.
* A warning is issued to inform the user.
*
* @param name of the jar file to register
* @throws IOException
*/ | Registers a jar file. Name of the jar file can be an absolute or relative path. If multiple resources are found with the specified name, the first one is registered as returned by getSystemResources. A warning is issued to inform the user | registerJar | {
"repo_name": "wenbingYu/pig-source",
"path": "src/org/apache/pig/PigServer.java",
"license": "apache-2.0",
"size": 71699
} | [
"java.io.File",
"java.io.IOException",
"org.apache.pig.impl.io.FileLocalizer",
"org.apache.pig.impl.logicalLayer.FrontendException",
"org.apache.pig.validator.PigCommandFilter"
] | import java.io.File; import java.io.IOException; import org.apache.pig.impl.io.FileLocalizer; import org.apache.pig.impl.logicalLayer.FrontendException; import org.apache.pig.validator.PigCommandFilter; | import java.io.*; import org.apache.pig.impl.*; import org.apache.pig.impl.io.*; import org.apache.pig.validator.*; | [
"java.io",
"org.apache.pig"
] | java.io; org.apache.pig; | 1,127,314 |
public static int getAppVersionCode(Context context) {
if (context != null) {
PackageManager pm = context.getPackageManager();
if (pm != null) {
PackageInfo pi;
try {
pi = pm.getPackageInfo(context.getPackageName(), 0);
if (pi != null) {
return pi.versionCode;
}
} catch (NameNotFoundException e) {
e.printStackTrace();
}
}
}
return -1;
} | static int function(Context context) { if (context != null) { PackageManager pm = context.getPackageManager(); if (pm != null) { PackageInfo pi; try { pi = pm.getPackageInfo(context.getPackageName(), 0); if (pi != null) { return pi.versionCode; } } catch (NameNotFoundException e) { e.printStackTrace(); } } } return -1; } | /**
* get app version code
*
* @param context
* @return
*/ | get app version code | getAppVersionCode | {
"repo_name": "kevin-duan/Imenu",
"path": "iMenu/src/com/huassit/imenu/android/util/PackageUtils.java",
"license": "apache-2.0",
"size": 17339
} | [
"android.content.Context",
"android.content.pm.PackageInfo",
"android.content.pm.PackageManager"
] | import android.content.Context; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; | import android.content.*; import android.content.pm.*; | [
"android.content"
] | android.content; | 704,993 |
protected String getUserEidBasedSiteId(String userId)
{
try
{
// use the user EID
String eid = UserDirectoryService.getUserEid(userId);
return SiteService.getUserSiteId(eid);
}
catch (UserNotDefinedException e)
{
M_log.warn("getUserEidBasedSiteId: user id not found for eid: " + userId);
return SiteService.getUserSiteId(userId);
}
} | String function(String userId) { try { String eid = UserDirectoryService.getUserEid(userId); return SiteService.getUserSiteId(eid); } catch (UserNotDefinedException e) { M_log.warn(STR + userId); return SiteService.getUserSiteId(userId); } } | /**
* Compute the string that will identify the user site for this user - use
* the EID if possible
*
* @param userId
* The user id
* @return The site "ID" but based on the user EID
*/ | Compute the string that will identify the user site for this user - use the EID if possible | getUserEidBasedSiteId | {
"repo_name": "eemirtekin/Sakai-10.6-TR",
"path": "portal/portal-impl/impl/src/java/org/sakaiproject/portal/charon/CharonPortal.java",
"license": "apache-2.0",
"size": 92740
} | [
"org.sakaiproject.site.cover.SiteService",
"org.sakaiproject.user.api.UserNotDefinedException",
"org.sakaiproject.user.cover.UserDirectoryService"
] | import org.sakaiproject.site.cover.SiteService; import org.sakaiproject.user.api.UserNotDefinedException; import org.sakaiproject.user.cover.UserDirectoryService; | import org.sakaiproject.site.cover.*; import org.sakaiproject.user.api.*; import org.sakaiproject.user.cover.*; | [
"org.sakaiproject.site",
"org.sakaiproject.user"
] | org.sakaiproject.site; org.sakaiproject.user; | 1,922,684 |
void validateIterator() {
refreshIfEmpty();
if (delegate != originalDelegate) {
throw new ConcurrentModificationException();
}
} | void validateIterator() { refreshIfEmpty(); if (delegate != originalDelegate) { throw new ConcurrentModificationException(); } } | /**
* If the delegate changed since the iterator was created, the iterator is no longer valid.
*/ | If the delegate changed since the iterator was created, the iterator is no longer valid | validateIterator | {
"repo_name": "EdwardLee03/guava",
"path": "android/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java",
"license": "apache-2.0",
"size": 44390
} | [
"java.util.ConcurrentModificationException"
] | import java.util.ConcurrentModificationException; | import java.util.*; | [
"java.util"
] | java.util; | 2,420,187 |
public DataFieldType getSwapNodeDataFieldType(final Tenor tenor) {
if (_swapNodeIds == null) {
throw new OpenGammaRuntimeException("Cannot get swap node id provider for curve node id mapper called " + _name);
}
return getDataFieldType(_swapNodeIds, tenor);
} | DataFieldType function(final Tenor tenor) { if (_swapNodeIds == null) { throw new OpenGammaRuntimeException(STR + _name); } return getDataFieldType(_swapNodeIds, tenor); } | /**
* Gets the data field type of the swap node at a particular tenor.
* @param tenor The tenor
* @return The data field type
* @throws OpenGammaRuntimeException if the data field type for this tenor could not be found.
*/ | Gets the data field type of the swap node at a particular tenor | getSwapNodeDataFieldType | {
"repo_name": "ChinaQuants/OG-Platform",
"path": "projects/OG-Financial/src/main/java/com/opengamma/financial/analytics/curve/CurveNodeIdMapper.java",
"license": "apache-2.0",
"size": 64618
} | [
"com.opengamma.OpenGammaRuntimeException",
"com.opengamma.financial.analytics.ircurve.strips.DataFieldType",
"com.opengamma.util.time.Tenor"
] | import com.opengamma.OpenGammaRuntimeException; import com.opengamma.financial.analytics.ircurve.strips.DataFieldType; import com.opengamma.util.time.Tenor; | import com.opengamma.*; import com.opengamma.financial.analytics.ircurve.strips.*; import com.opengamma.util.time.*; | [
"com.opengamma",
"com.opengamma.financial",
"com.opengamma.util"
] | com.opengamma; com.opengamma.financial; com.opengamma.util; | 2,499,919 |
public void printChatMessageWithOptionalDeletion(ITextComponent chatComponent, int chatLineId)
{
this.setChatLine(chatComponent, chatLineId, this.mc.ingameGUI.getUpdateCounter(), false);
LOGGER.info("[CHAT] " + NEWLINE_STRING_JOINER.join(NEWLINE_SPLITTER.split(chatComponent.getUnformattedText())));
} | void function(ITextComponent chatComponent, int chatLineId) { this.setChatLine(chatComponent, chatLineId, this.mc.ingameGUI.getUpdateCounter(), false); LOGGER.info(STR + NEWLINE_STRING_JOINER.join(NEWLINE_SPLITTER.split(chatComponent.getUnformattedText()))); } | /**
* prints the ChatComponent to Chat. If the ID is not 0, deletes an existing Chat Line of that ID from the GUI
*/ | prints the ChatComponent to Chat. If the ID is not 0, deletes an existing Chat Line of that ID from the GUI | printChatMessageWithOptionalDeletion | {
"repo_name": "danielyc/test-1.9.4",
"path": "build/tmp/recompileMc/sources/net/minecraft/client/gui/GuiNewChat.java",
"license": "gpl-3.0",
"size": 12132
} | [
"net.minecraft.util.text.ITextComponent"
] | import net.minecraft.util.text.ITextComponent; | import net.minecraft.util.text.*; | [
"net.minecraft.util"
] | net.minecraft.util; | 366,827 |
public synchronized boolean streamCleanup(long fileId, long streamTimeout) {
Preconditions
.checkState(streamTimeout >= NfsConfigKeys.DFS_NFS_STREAM_TIMEOUT_MIN_DEFAULT);
if (!activeState) {
return true;
}
boolean flag = false;
// Check the stream timeout
if (checkStreamTimeout(streamTimeout)) {
if (LOG.isDebugEnabled()) {
LOG.debug("stream can be closed for fileId:" + fileId);
}
flag = true;
}
return flag;
} | synchronized boolean function(long fileId, long streamTimeout) { Preconditions .checkState(streamTimeout >= NfsConfigKeys.DFS_NFS_STREAM_TIMEOUT_MIN_DEFAULT); if (!activeState) { return true; } boolean flag = false; if (checkStreamTimeout(streamTimeout)) { if (LOG.isDebugEnabled()) { LOG.debug(STR + fileId); } flag = true; } return flag; } | /**
* Check stream status to decide if it should be closed
* @return true, remove stream; false, keep stream
*/ | Check stream status to decide if it should be closed | streamCleanup | {
"repo_name": "HazelChen/hadoop",
"path": "hadoop-hdfs-project/hadoop-hdfs-nfs/src/main/java/org/apache/hadoop/hdfs/nfs/nfs3/OpenFileCtx.java",
"license": "apache-2.0",
"size": 47001
} | [
"com.google.common.base.Preconditions",
"org.apache.hadoop.hdfs.nfs.conf.NfsConfigKeys"
] | import com.google.common.base.Preconditions; import org.apache.hadoop.hdfs.nfs.conf.NfsConfigKeys; | import com.google.common.base.*; import org.apache.hadoop.hdfs.nfs.conf.*; | [
"com.google.common",
"org.apache.hadoop"
] | com.google.common; org.apache.hadoop; | 639,032 |
Bootstrap.main(args);
} | Bootstrap.main(args); } | /**
* Main class that delegates to Spring Shell's Bootstrap class in order to simplify debugging inside an IDE
*
* @param args
* @throws IOException
*/ | Main class that delegates to Spring Shell's Bootstrap class in order to simplify debugging inside an IDE | main | {
"repo_name": "holmbech/devtool-shell",
"path": "src/main/java/com/holmbech/devtoolshell/Main.java",
"license": "apache-2.0",
"size": 415
} | [
"org.springframework.shell.Bootstrap"
] | import org.springframework.shell.Bootstrap; | import org.springframework.shell.*; | [
"org.springframework.shell"
] | org.springframework.shell; | 1,650,417 |
public StepInterface getStepInterface( String stepname, int copy ) {
if ( steps == null ) {
return null;
}
// Now start all the threads...
for ( int i = 0; i < steps.size(); i++ ) {
StepMetaDataCombi sid = steps.get( i );
if ( sid.stepname.equalsIgnoreCase( stepname ) && sid.copy == copy ) {
return sid.step;
}
}
return null;
} | StepInterface function( String stepname, int copy ) { if ( steps == null ) { return null; } for ( int i = 0; i < steps.size(); i++ ) { StepMetaDataCombi sid = steps.get( i ); if ( sid.stepname.equalsIgnoreCase( stepname ) && sid.copy == copy ) { return sid.step; } } return null; } | /**
* Find the StepInterface (thread) by looking it up using the name.
*
* @param stepname
* The name of the step to look for
* @param copy
* the copy number of the step to look for
* @return the StepInterface or null if nothing was found.
*/ | Find the StepInterface (thread) by looking it up using the name | getStepInterface | {
"repo_name": "alina-ipatina/pentaho-kettle",
"path": "engine/src/org/pentaho/di/trans/Trans.java",
"license": "apache-2.0",
"size": 197880
} | [
"org.pentaho.di.trans.step.StepInterface",
"org.pentaho.di.trans.step.StepMetaDataCombi"
] | import org.pentaho.di.trans.step.StepInterface; import org.pentaho.di.trans.step.StepMetaDataCombi; | import org.pentaho.di.trans.step.*; | [
"org.pentaho.di"
] | org.pentaho.di; | 2,578,097 |
public static List<NabuccoPropertyDescriptor> getPropertyDescriptorList() {
return PropertyCache.getInstance().retrieve(AuthorizationInformationRs.class).getAllProperties();
}
| static List<NabuccoPropertyDescriptor> function() { return PropertyCache.getInstance().retrieve(AuthorizationInformationRs.class).getAllProperties(); } | /**
* Getter for the PropertyDescriptorList.
*
* @return the List<NabuccoPropertyDescriptor>.
*/ | Getter for the PropertyDescriptorList | getPropertyDescriptorList | {
"repo_name": "NABUCCO/org.nabucco.framework.common.authorization",
"path": "org.nabucco.framework.common.authorization.facade.message/src/main/gen/org/nabucco/framework/common/authorization/facade/message/AuthorizationInformationRs.java",
"license": "epl-1.0",
"size": 9294
} | [
"java.util.List",
"org.nabucco.framework.base.facade.datatype.property.NabuccoPropertyDescriptor",
"org.nabucco.framework.base.facade.datatype.property.PropertyCache"
] | import java.util.List; import org.nabucco.framework.base.facade.datatype.property.NabuccoPropertyDescriptor; import org.nabucco.framework.base.facade.datatype.property.PropertyCache; | import java.util.*; import org.nabucco.framework.base.facade.datatype.property.*; | [
"java.util",
"org.nabucco.framework"
] | java.util; org.nabucco.framework; | 1,433,797 |
public synchronized ObjectPool getPool(String name) {
try {
return getConnectionPool(name);
}
catch (Exception e) {
throw new DbcpException(e);
}
}
| synchronized ObjectPool function(String name) { try { return getConnectionPool(name); } catch (Exception e) { throw new DbcpException(e); } } | /**
* WARNING: This method throws DbcpExceptions (RuntimeExceptions)
* and will be replaced by the protected getConnectionPool method.
*
* @deprecated This will be removed in a future version of DBCP.
*/ | and will be replaced by the protected getConnectionPool method | getPool | {
"repo_name": "bbossgroups/bbossgroups-3.5",
"path": "bboss-persistent/src-jdk6/com/frameworkset/commons/dbcp/PoolingDriver.java",
"license": "apache-2.0",
"size": 17792
} | [
"com.frameworkset.commons.pool.ObjectPool"
] | import com.frameworkset.commons.pool.ObjectPool; | import com.frameworkset.commons.pool.*; | [
"com.frameworkset.commons"
] | com.frameworkset.commons; | 2,560,664 |
void checkUserIsNotSecurityAdmin(PerunSession sess, SecurityTeam securityTeam, User user) throws AlreadyAdminException; | void checkUserIsNotSecurityAdmin(PerunSession sess, SecurityTeam securityTeam, User user) throws AlreadyAdminException; | /**
* check if user is not security admin of given security team
* throw exception if it is
*
* @param sess
* @param securityTeam
* @param user
* @throws AlreadyAdminException
* @throws InternalErrorException
*/ | check if user is not security admin of given security team throw exception if it is | checkUserIsNotSecurityAdmin | {
"repo_name": "zlamalp/perun",
"path": "perun-core/src/main/java/cz/metacentrum/perun/core/bl/SecurityTeamsManagerBl.java",
"license": "bsd-2-clause",
"size": 9400
} | [
"cz.metacentrum.perun.core.api.PerunSession",
"cz.metacentrum.perun.core.api.SecurityTeam",
"cz.metacentrum.perun.core.api.User",
"cz.metacentrum.perun.core.api.exceptions.AlreadyAdminException"
] | import cz.metacentrum.perun.core.api.PerunSession; import cz.metacentrum.perun.core.api.SecurityTeam; import cz.metacentrum.perun.core.api.User; import cz.metacentrum.perun.core.api.exceptions.AlreadyAdminException; | import cz.metacentrum.perun.core.api.*; import cz.metacentrum.perun.core.api.exceptions.*; | [
"cz.metacentrum.perun"
] | cz.metacentrum.perun; | 130,302 |
public Long getLongOrZero(int columnIndex) throws SQLException; | Long function(int columnIndex) throws SQLException; | /**
* Returns <code>0</code> when null.
*/ | Returns <code>0</code> when null | getLongOrZero | {
"repo_name": "spincast/spincast-framework",
"path": "spincast-plugins/spincast-plugins-jdbc-parent/spincast-plugins-jdbc/src/main/java/org/spincast/plugins/jdbc/SpincastResultSet.java",
"license": "apache-2.0",
"size": 7942
} | [
"java.sql.SQLException"
] | import java.sql.SQLException; | import java.sql.*; | [
"java.sql"
] | java.sql; | 2,568,658 |
void checkUpdateJob(JobEntity job); | void checkUpdateJob(JobEntity job); | /**
* Checks if it is allowed to update the given job.
*/ | Checks if it is allowed to update the given job | checkUpdateJob | {
"repo_name": "Diaskhan/jetbpm",
"path": "camunda-bpm-platform-master/engine/src/main/java/org/camunda/bpm/engine/impl/cfg/CommandChecker.java",
"license": "apache-2.0",
"size": 9500
} | [
"org.camunda.bpm.engine.impl.persistence.entity.JobEntity"
] | import org.camunda.bpm.engine.impl.persistence.entity.JobEntity; | import org.camunda.bpm.engine.impl.persistence.entity.*; | [
"org.camunda.bpm"
] | org.camunda.bpm; | 983,842 |
private void processPasswordPolicydModify( ModifyOperationContext modifyContext ) throws LdapException
{
// handle the case where pwdPolicySubentry AT is about to be deleted in this modify()
PasswordPolicyConfiguration policyConfig = getPwdPolicy( modifyContext.getEntry() );
PwdModDetailsHolder pwdModDetails = getPwdModDetails( modifyContext, policyConfig );
if ( !pwdModDetails.isPwdModPresent() )
{
// We can going on, the password attribute is not present in the Modifications.
next( modifyContext );
}
else
{
// The password is present in the modifications. Deal with the various use cases.
CoreSession userSession = modifyContext.getSession();
boolean isPPolicyReqCtrlPresent = modifyContext.hasRequestControl( PasswordPolicyRequest.OID );
// First, check if the password must be changed, and if the operation allows it
checkPwdMustChange( modifyContext, userSession, pwdModDetails, isPPolicyReqCtrlPresent );
// Check the the old password is present if it's required by the PP config
checkOldPwdRequired( modifyContext, policyConfig, pwdModDetails, isPPolicyReqCtrlPresent );
// Check that we can't update the password if it's not allowed
checkChangePwdAllowed( modifyContext, policyConfig, isPPolicyReqCtrlPresent );
Entry entry = modifyContext.getEntry();
boolean removePwdReset = false;
List<Modification> mods = new ArrayList<>();
if ( pwdModDetails.isAddOrReplace() )
{
if ( isPwdTooYoung( modifyContext, entry, policyConfig ) )
{
if ( isPPolicyReqCtrlPresent )
{
PasswordPolicyResponse responseControl = new PasswordPolicyResponseImpl();
responseControl.setPasswordPolicyError(
PasswordPolicyErrorEnum.PASSWORD_TOO_YOUNG );
modifyContext.addResponseControl( responseControl );
}
throw new LdapOperationException( ResultCodeEnum.CONSTRAINT_VIOLATION,
"password is too young to update" );
}
byte[] newPassword = pwdModDetails.getNewPwd();
try
{
check( modifyContext, entry, newPassword, policyConfig );
}
catch ( PasswordPolicyException e )
{
if ( isPPolicyReqCtrlPresent )
{
PasswordPolicyResponse responseControl = new PasswordPolicyResponseImpl();
responseControl.setPasswordPolicyError(
PasswordPolicyErrorEnum.get( e.getErrorCode() ) );
modifyContext.addResponseControl( responseControl );
}
// throw exception if userPassword quality checks fail
throw new LdapOperationException( ResultCodeEnum.CONSTRAINT_VIOLATION, e.getMessage(), e );
}
int histSize = policyConfig.getPwdInHistory();
Modification pwdRemHistMod = null;
Modification pwdAddHistMod = null;
String pwdChangedTime = DateUtils.getGeneralizedTime( directoryService.getTimeProvider() );
if ( histSize > 0 )
{
Attribute pwdHistoryAt = entry.get( pwdHistoryAT );
if ( pwdHistoryAt == null )
{
pwdHistoryAt = new DefaultAttribute( pwdHistoryAT );
}
// Build the Modification containing the password history
pwdRemHistMod = buildPwdHistory( modifyContext, pwdHistoryAt, histSize,
newPassword, isPPolicyReqCtrlPresent );
PasswordHistory newPwdHist = new PasswordHistory( pwdChangedTime, newPassword );
pwdHistoryAt.add( newPwdHist.getHistoryValue() );
pwdAddHistMod = new DefaultModification( REPLACE_ATTRIBUTE, pwdHistoryAt );
}
next( modifyContext );
invalidateAuthenticatorCaches( modifyContext.getDn() );
LookupOperationContext lookupContext = new LookupOperationContext( adminSession, modifyContext.getDn(),
SchemaConstants.ALL_ATTRIBUTES_ARRAY );
lookupContext.setPartition( modifyContext.getPartition() );
lookupContext.setTransaction( modifyContext.getTransaction() );
entry = directoryService.getPartitionNexus().lookup( lookupContext );
if ( ( policyConfig.getPwdMinAge() > 0 ) || ( policyConfig.getPwdMaxAge() > 0 ) )
{
Attribute pwdChangedTimeAt = new DefaultAttribute( pwdChangedTimeAT );
pwdChangedTimeAt.add( pwdChangedTime );
Modification pwdChangedTimeMod = new DefaultModification( REPLACE_ATTRIBUTE, pwdChangedTimeAt );
mods.add( pwdChangedTimeMod );
}
if ( pwdAddHistMod != null )
{
mods.add( pwdAddHistMod );
}
if ( pwdRemHistMod != null )
{
mods.add( pwdRemHistMod );
}
if ( policyConfig.isPwdMustChange() )
{
Attribute pwdMustChangeAt = new DefaultAttribute( pwdResetAT );
Modification pwdMustChangeMod;
if ( modifyContext.getSession().isAnAdministrator() )
{
pwdMustChangeAt.add( "TRUE" );
pwdMustChangeMod = new DefaultModification( REPLACE_ATTRIBUTE, pwdMustChangeAt );
}
else
{
pwdMustChangeMod = new DefaultModification( REMOVE_ATTRIBUTE, pwdMustChangeAt );
removePwdReset = true;
}
mods.add( pwdMustChangeMod );
}
}
// Add the attributes that have been modified following a Add/Replace password
processModifyAddPwdAttributes( entry, mods, pwdModDetails );
String csnVal = directoryService.getCSN().toString();
Modification csnMod = new DefaultModification( REPLACE_ATTRIBUTE, directoryService.getAtProvider()
.getEntryCSN(), csnVal );
mods.add( csnMod );
ModifyOperationContext internalModifyCtx = new ModifyOperationContext( adminSession );
internalModifyCtx.setPushToEvtInterceptor( true );
internalModifyCtx.setDn( modifyContext.getDn() );
internalModifyCtx.setEntry( entry );
internalModifyCtx.setModItems( mods );
internalModify( modifyContext, internalModifyCtx );
if ( removePwdReset || pwdModDetails.isDelete() )
{
userSession.setPwdMustChange( false );
}
}
}
| void function( ModifyOperationContext modifyContext ) throws LdapException { PasswordPolicyConfiguration policyConfig = getPwdPolicy( modifyContext.getEntry() ); PwdModDetailsHolder pwdModDetails = getPwdModDetails( modifyContext, policyConfig ); if ( !pwdModDetails.isPwdModPresent() ) { next( modifyContext ); } else { CoreSession userSession = modifyContext.getSession(); boolean isPPolicyReqCtrlPresent = modifyContext.hasRequestControl( PasswordPolicyRequest.OID ); checkPwdMustChange( modifyContext, userSession, pwdModDetails, isPPolicyReqCtrlPresent ); checkOldPwdRequired( modifyContext, policyConfig, pwdModDetails, isPPolicyReqCtrlPresent ); checkChangePwdAllowed( modifyContext, policyConfig, isPPolicyReqCtrlPresent ); Entry entry = modifyContext.getEntry(); boolean removePwdReset = false; List<Modification> mods = new ArrayList<>(); if ( pwdModDetails.isAddOrReplace() ) { if ( isPwdTooYoung( modifyContext, entry, policyConfig ) ) { if ( isPPolicyReqCtrlPresent ) { PasswordPolicyResponse responseControl = new PasswordPolicyResponseImpl(); responseControl.setPasswordPolicyError( PasswordPolicyErrorEnum.PASSWORD_TOO_YOUNG ); modifyContext.addResponseControl( responseControl ); } throw new LdapOperationException( ResultCodeEnum.CONSTRAINT_VIOLATION, STR ); } byte[] newPassword = pwdModDetails.getNewPwd(); try { check( modifyContext, entry, newPassword, policyConfig ); } catch ( PasswordPolicyException e ) { if ( isPPolicyReqCtrlPresent ) { PasswordPolicyResponse responseControl = new PasswordPolicyResponseImpl(); responseControl.setPasswordPolicyError( PasswordPolicyErrorEnum.get( e.getErrorCode() ) ); modifyContext.addResponseControl( responseControl ); } throw new LdapOperationException( ResultCodeEnum.CONSTRAINT_VIOLATION, e.getMessage(), e ); } int histSize = policyConfig.getPwdInHistory(); Modification pwdRemHistMod = null; Modification pwdAddHistMod = null; String pwdChangedTime = DateUtils.getGeneralizedTime( directoryService.getTimeProvider() ); if ( histSize > 0 ) { Attribute pwdHistoryAt = entry.get( pwdHistoryAT ); if ( pwdHistoryAt == null ) { pwdHistoryAt = new DefaultAttribute( pwdHistoryAT ); } pwdRemHistMod = buildPwdHistory( modifyContext, pwdHistoryAt, histSize, newPassword, isPPolicyReqCtrlPresent ); PasswordHistory newPwdHist = new PasswordHistory( pwdChangedTime, newPassword ); pwdHistoryAt.add( newPwdHist.getHistoryValue() ); pwdAddHistMod = new DefaultModification( REPLACE_ATTRIBUTE, pwdHistoryAt ); } next( modifyContext ); invalidateAuthenticatorCaches( modifyContext.getDn() ); LookupOperationContext lookupContext = new LookupOperationContext( adminSession, modifyContext.getDn(), SchemaConstants.ALL_ATTRIBUTES_ARRAY ); lookupContext.setPartition( modifyContext.getPartition() ); lookupContext.setTransaction( modifyContext.getTransaction() ); entry = directoryService.getPartitionNexus().lookup( lookupContext ); if ( ( policyConfig.getPwdMinAge() > 0 ) ( policyConfig.getPwdMaxAge() > 0 ) ) { Attribute pwdChangedTimeAt = new DefaultAttribute( pwdChangedTimeAT ); pwdChangedTimeAt.add( pwdChangedTime ); Modification pwdChangedTimeMod = new DefaultModification( REPLACE_ATTRIBUTE, pwdChangedTimeAt ); mods.add( pwdChangedTimeMod ); } if ( pwdAddHistMod != null ) { mods.add( pwdAddHistMod ); } if ( pwdRemHistMod != null ) { mods.add( pwdRemHistMod ); } if ( policyConfig.isPwdMustChange() ) { Attribute pwdMustChangeAt = new DefaultAttribute( pwdResetAT ); Modification pwdMustChangeMod; if ( modifyContext.getSession().isAnAdministrator() ) { pwdMustChangeAt.add( "TRUE" ); pwdMustChangeMod = new DefaultModification( REPLACE_ATTRIBUTE, pwdMustChangeAt ); } else { pwdMustChangeMod = new DefaultModification( REMOVE_ATTRIBUTE, pwdMustChangeAt ); removePwdReset = true; } mods.add( pwdMustChangeMod ); } } processModifyAddPwdAttributes( entry, mods, pwdModDetails ); String csnVal = directoryService.getCSN().toString(); Modification csnMod = new DefaultModification( REPLACE_ATTRIBUTE, directoryService.getAtProvider() .getEntryCSN(), csnVal ); mods.add( csnMod ); ModifyOperationContext internalModifyCtx = new ModifyOperationContext( adminSession ); internalModifyCtx.setPushToEvtInterceptor( true ); internalModifyCtx.setDn( modifyContext.getDn() ); internalModifyCtx.setEntry( entry ); internalModifyCtx.setModItems( mods ); internalModify( modifyContext, internalModifyCtx ); if ( removePwdReset pwdModDetails.isDelete() ) { userSession.setPwdMustChange( false ); } } } | /**
* Proceed with the Modification operation when the PasswordPolicy is activated.
*/ | Proceed with the Modification operation when the PasswordPolicy is activated | processPasswordPolicydModify | {
"repo_name": "apache/directory-server",
"path": "interceptors/authn/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java",
"license": "apache-2.0",
"size": 67937
} | [
"java.util.ArrayList",
"java.util.List",
"org.apache.directory.api.ldap.extras.controls.ppolicy.PasswordPolicyErrorEnum",
"org.apache.directory.api.ldap.extras.controls.ppolicy.PasswordPolicyRequest",
"org.apache.directory.api.ldap.extras.controls.ppolicy.PasswordPolicyResponse",
"org.apache.directory.api.ldap.extras.controls.ppolicy.PasswordPolicyResponseImpl",
"org.apache.directory.api.ldap.model.constants.SchemaConstants",
"org.apache.directory.api.ldap.model.entry.Attribute",
"org.apache.directory.api.ldap.model.entry.DefaultAttribute",
"org.apache.directory.api.ldap.model.entry.DefaultModification",
"org.apache.directory.api.ldap.model.entry.Entry",
"org.apache.directory.api.ldap.model.entry.Modification",
"org.apache.directory.api.ldap.model.exception.LdapException",
"org.apache.directory.api.ldap.model.exception.LdapOperationException",
"org.apache.directory.api.ldap.model.message.ResultCodeEnum",
"org.apache.directory.api.util.DateUtils",
"org.apache.directory.server.core.api.CoreSession",
"org.apache.directory.server.core.api.authn.ppolicy.PasswordPolicyConfiguration",
"org.apache.directory.server.core.api.authn.ppolicy.PasswordPolicyException",
"org.apache.directory.server.core.api.interceptor.context.LookupOperationContext",
"org.apache.directory.server.core.api.interceptor.context.ModifyOperationContext"
] | import java.util.ArrayList; import java.util.List; import org.apache.directory.api.ldap.extras.controls.ppolicy.PasswordPolicyErrorEnum; import org.apache.directory.api.ldap.extras.controls.ppolicy.PasswordPolicyRequest; import org.apache.directory.api.ldap.extras.controls.ppolicy.PasswordPolicyResponse; import org.apache.directory.api.ldap.extras.controls.ppolicy.PasswordPolicyResponseImpl; import org.apache.directory.api.ldap.model.constants.SchemaConstants; import org.apache.directory.api.ldap.model.entry.Attribute; import org.apache.directory.api.ldap.model.entry.DefaultAttribute; import org.apache.directory.api.ldap.model.entry.DefaultModification; import org.apache.directory.api.ldap.model.entry.Entry; import org.apache.directory.api.ldap.model.entry.Modification; import org.apache.directory.api.ldap.model.exception.LdapException; import org.apache.directory.api.ldap.model.exception.LdapOperationException; import org.apache.directory.api.ldap.model.message.ResultCodeEnum; import org.apache.directory.api.util.DateUtils; import org.apache.directory.server.core.api.CoreSession; import org.apache.directory.server.core.api.authn.ppolicy.PasswordPolicyConfiguration; import org.apache.directory.server.core.api.authn.ppolicy.PasswordPolicyException; import org.apache.directory.server.core.api.interceptor.context.LookupOperationContext; import org.apache.directory.server.core.api.interceptor.context.ModifyOperationContext; | import java.util.*; import org.apache.directory.api.ldap.extras.controls.ppolicy.*; import org.apache.directory.api.ldap.model.constants.*; import org.apache.directory.api.ldap.model.entry.*; import org.apache.directory.api.ldap.model.exception.*; import org.apache.directory.api.ldap.model.message.*; import org.apache.directory.api.util.*; import org.apache.directory.server.core.api.*; import org.apache.directory.server.core.api.authn.ppolicy.*; import org.apache.directory.server.core.api.interceptor.context.*; | [
"java.util",
"org.apache.directory"
] | java.util; org.apache.directory; | 1,683,272 |
public Object getSafeAttribute(String name)
{
Map<String, Object> safeSession = (Map<String, Object>) this.session.getAttribute(KEY_SAFESESSION);
return safeSession != null ? safeSession.get(name) : null;
} | Object function(String name) { Map<String, Object> safeSession = (Map<String, Object>) this.session.getAttribute(KEY_SAFESESSION); return safeSession != null ? safeSession.get(name) : null; } | /**
* Access an attribute that is safe to use for any script author.
*
* @param name the name of the attribute
* @return the value of the attribute
*/ | Access an attribute that is safe to use for any script author | getSafeAttribute | {
"repo_name": "xwiki/xwiki-platform",
"path": "xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/render/ScriptHttpSession.java",
"license": "lgpl-2.1",
"size": 7681
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 1,868,789 |
public void itemRotated(OjbectManipulation multiTouchElement,
Spatial targetSpatial, float newAngle, float oldAngle);
| void function(OjbectManipulation multiTouchElement, Spatial targetSpatial, float newAngle, float oldAngle); | /**
* Item rotated.
*
* @param multiTouchElement
* the multi touch element
* @param targetSpatial
* the target spatial
* @param newAngle
* the new angle
* @param oldAngle
* the old angle
*/ | Item rotated | itemRotated | {
"repo_name": "synergynet/synergynet2.5",
"path": "synergynet2.5/src/main/java/apps/threedmanipulation/gestures/OjbectManipulation.java",
"license": "bsd-3-clause",
"size": 22911
} | [
"com.jme.scene.Spatial"
] | import com.jme.scene.Spatial; | import com.jme.scene.*; | [
"com.jme.scene"
] | com.jme.scene; | 2,763,190 |
public void removePaintListener(PaintListener listener) {
checkWidget();
if (listener == null)
error(SWT.ERROR_NULL_ARGUMENT);
if (eventTable == null)
return;
eventTable.unhook(SWT.Paint, listener);
} | void function(PaintListener listener) { checkWidget(); if (listener == null) error(SWT.ERROR_NULL_ARGUMENT); if (eventTable == null) return; eventTable.unhook(SWT.Paint, listener); } | /**
* Removes the listener from the collection of listeners who will be
* notified when the receiver needs to be painted.
*
* @param listener
* the listener which should no longer be notified
*
* @exception IllegalArgumentException
* <ul>
* <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
* </ul>
* @exception SWTException
* <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been
* disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the
* thread that created the receiver</li>
* </ul>
*
* @see PaintListener
* @see #addPaintListener
*/ | Removes the listener from the collection of listeners who will be notified when the receiver needs to be painted | removePaintListener | {
"repo_name": "ghillairet/gef-gwt",
"path": "src/main/java/org/eclipse/swt/widgets/Control.java",
"license": "epl-1.0",
"size": 120160
} | [
"org.eclipse.swt.events.PaintListener"
] | import org.eclipse.swt.events.PaintListener; | import org.eclipse.swt.events.*; | [
"org.eclipse.swt"
] | org.eclipse.swt; | 2,640,374 |
public static JSONObject anchorAction(String link, String text) {
JSONObject json = new JSONObject(true)
.put("type", RenderType.anchor.name())
.put("link", link)
.put("text", text);
return json;
} | static JSONObject function(String link, String text) { JSONObject json = new JSONObject(true) .put("type", RenderType.anchor.name()) .put("link", link) .put("text", text); return json; } | /**
* anchor action: draw a single anchor with descriptive text as anchor text
* @param link the link
* @param text the anchor text
* @return the action
*/ | anchor action: draw a single anchor with descriptive text as anchor text | anchorAction | {
"repo_name": "fazeem84/susi_server",
"path": "src/ai/susi/mind/SusiAction.java",
"license": "lgpl-2.1",
"size": 17240
} | [
"org.json.JSONObject"
] | import org.json.JSONObject; | import org.json.*; | [
"org.json"
] | org.json; | 233,082 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.