method
stringlengths 13
441k
| clean_method
stringlengths 7
313k
| doc
stringlengths 17
17.3k
| comment
stringlengths 3
1.42k
| method_name
stringlengths 1
273
| extra
dict | imports
sequence | imports_info
stringlengths 19
34.8k
| cluster_imports_info
stringlengths 15
3.66k
| libraries
sequence | libraries_info
stringlengths 6
661
| id
int64 0
2.92M
|
---|---|---|---|---|---|---|---|---|---|---|---|
public static Set<String> getSetValues(String params) {
Pattern parensPattern = Pattern.compile("^\\(.*\\)$");
if (! parensPattern.matcher(params).matches()) {
throw new IllegalArgumentException("Set values are not in correct format:"+params);
}
String values = params.substring(1, params.length()-1);
String[] vparts = values.split(",");
Pattern qPattern = Pattern.compile("^'[^']*'$");
Set<String> result = new HashSet<String>();
for (String v : vparts) {
v = v.trim();
if (! qPattern.matcher(v).matches()) {
throw new IllegalArgumentException("Invalid value in set:"+v+" SET="+params);
}
result.add(v.substring(1, v.length()-1));
}
return result;
} | static Set<String> function(String params) { Pattern parensPattern = Pattern.compile(STR); if (! parensPattern.matcher(params).matches()) { throw new IllegalArgumentException(STR+params); } String values = params.substring(1, params.length()-1); String[] vparts = values.split(","); Pattern qPattern = Pattern.compile(STR); Set<String> result = new HashSet<String>(); for (String v : vparts) { v = v.trim(); if (! qPattern.matcher(v).matches()) { throw new IllegalArgumentException(STR+v+STR+params); } result.add(v.substring(1, v.length()-1)); } return result; } | /**
* Extract the individual Strings from a parenthesized and comma-separated
* list of fragments that are individually quotes with single quotes.
* @param params
* @return
*/ | Extract the individual Strings from a parenthesized and comma-separated list of fragments that are individually quotes with single quotes | getSetValues | {
"repo_name": "chel1209/interopServer-DAL",
"path": "src/common/com/diversityarrays/dal/db/DbUtil.java",
"license": "gpl-3.0",
"size": 7028
} | [
"java.util.HashSet",
"java.util.Set",
"java.util.regex.Pattern"
] | import java.util.HashSet; import java.util.Set; import java.util.regex.Pattern; | import java.util.*; import java.util.regex.*; | [
"java.util"
] | java.util; | 1,274,669 |
protected int read(InputStream inputStream, byte[] buffer, int offset, int length) throws IOException {
int readLength = inputStream.read(buffer, offset, length);
if (readLength != length) {
throw new IOException("wrong byte length");
}
return readLength;
}
| int function(InputStream inputStream, byte[] buffer, int offset, int length) throws IOException { int readLength = inputStream.read(buffer, offset, length); if (readLength != length) { throw new IOException(STR); } return readLength; } | /**
* Reads a number (specified by length) of bytes from a given file reader into a byte array
* beginning at the given offset.
*
* @param inputStream the input stream
* @param buffer the buffer
* @param offset the offset
* @param length the length
* @return the int
* @throws IOException the io exception
*/ | Reads a number (specified by length) of bytes from a given file reader into a byte array beginning at the given offset | read | {
"repo_name": "cm-is-dog/rapidminer-studio-core",
"path": "src/main/java/com/rapidminer/operator/io/BytewiseExampleSource.java",
"license": "agpl-3.0",
"size": 12374
} | [
"java.io.IOException",
"java.io.InputStream"
] | import java.io.IOException; import java.io.InputStream; | import java.io.*; | [
"java.io"
] | java.io; | 2,550,440 |
@Override
public Fragment getItem(int position) {
CardViewFragment cvf = new CardViewFragment();
Bundle args = new Bundle();
args.putLong(CardViewFragment.CARD_ID, mCardIds[position]);
cvf.setArguments(args);
return cvf;
} | Fragment function(int position) { CardViewFragment cvf = new CardViewFragment(); Bundle args = new Bundle(); args.putLong(CardViewFragment.CARD_ID, mCardIds[position]); cvf.setArguments(args); return cvf; } | /**
* Make a fragment using the ID at this position in mCardIds, and return it
*
* @param position The index of the Fragment to make
* @return The Fragment at that index
*/ | Make a fragment using the ID at this position in mCardIds, and return it | getItem | {
"repo_name": "fenfir/mtg-familiar",
"path": "mobile/src/main/java/com/gelakinetic/mtgfam/fragments/CardViewPagerFragment.java",
"license": "mit",
"size": 7151
} | [
"android.os.Bundle",
"android.support.v4.app.Fragment"
] | import android.os.Bundle; import android.support.v4.app.Fragment; | import android.os.*; import android.support.v4.app.*; | [
"android.os",
"android.support"
] | android.os; android.support; | 1,642,457 |
protected String[] filterAppPaths(String[] unfilteredAppPaths) {
Pattern filter = host.getDeployIgnorePattern();
if (filter == null) {
return unfilteredAppPaths;
}
List<String> filteredList = new ArrayList<>();
Matcher matcher = null;
for (String appPath : unfilteredAppPaths) {
if (matcher == null) {
matcher = filter.matcher(appPath);
} else {
matcher.reset(appPath);
}
if (matcher.matches()) {
if (log.isDebugEnabled()) {
log.debug(sm.getString("hostConfig.ignorePath", appPath));
}
} else {
filteredList.add(appPath);
}
}
return filteredList.toArray(new String[filteredList.size()]);
} | String[] function(String[] unfilteredAppPaths) { Pattern filter = host.getDeployIgnorePattern(); if (filter == null) { return unfilteredAppPaths; } List<String> filteredList = new ArrayList<>(); Matcher matcher = null; for (String appPath : unfilteredAppPaths) { if (matcher == null) { matcher = filter.matcher(appPath); } else { matcher.reset(appPath); } if (matcher.matches()) { if (log.isDebugEnabled()) { log.debug(sm.getString(STR, appPath)); } } else { filteredList.add(appPath); } } return filteredList.toArray(new String[filteredList.size()]); } | /**
* Filter the list of application file paths to remove those that match
* the regular expression defined by {@link Host#getDeployIgnore()}.
*
* @param unfilteredAppPaths The list of application paths to filtert
*
* @return The filtered list of application paths
*/ | Filter the list of application file paths to remove those that match the regular expression defined by <code>Host#getDeployIgnore()</code> | filterAppPaths | {
"repo_name": "plumer/codana",
"path": "tomcat_files/8.0.22/HostConfig.java",
"license": "mit",
"size": 68025
} | [
"java.util.ArrayList",
"java.util.List",
"java.util.regex.Matcher",
"java.util.regex.Pattern"
] | import java.util.ArrayList; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; | import java.util.*; import java.util.regex.*; | [
"java.util"
] | java.util; | 2,153,805 |
private IgniteBiTuple<Integer, Matrix> readFromVector(Vector v, int rows, int cols, int off) {
Matrix mtx = new DenseMatrix(rows, cols);
int size = rows * cols;
for (int i = 0; i < size; i++)
mtx.setX(i / cols, i % cols, v.getX(off + i));
return new IgniteBiTuple<>(off + size, mtx);
} | IgniteBiTuple<Integer, Matrix> function(Vector v, int rows, int cols, int off) { Matrix mtx = new DenseMatrix(rows, cols); int size = rows * cols; for (int i = 0; i < size; i++) mtx.setX(i / cols, i % cols, v.getX(off + i)); return new IgniteBiTuple<>(off + size, mtx); } | /**
* Read matrix with given dimensions from vector starting with offset and return new offset position
* which is last matrix entry position + 1.
*
* @param v Vector to read from.
* @param rows Count of rows of matrix to read.
* @param cols Count of columns of matrix to read.
* @param off Start read position.
* @return New offset position which is last matrix entry position + 1.
*/ | Read matrix with given dimensions from vector starting with offset and return new offset position which is last matrix entry position + 1 | readFromVector | {
"repo_name": "ilantukh/ignite",
"path": "modules/ml/src/main/java/org/apache/ignite/ml/nn/MultilayerPerceptron.java",
"license": "apache-2.0",
"size": 20059
} | [
"org.apache.ignite.lang.IgniteBiTuple",
"org.apache.ignite.ml.math.primitives.matrix.Matrix",
"org.apache.ignite.ml.math.primitives.matrix.impl.DenseMatrix",
"org.apache.ignite.ml.math.primitives.vector.Vector"
] | import org.apache.ignite.lang.IgniteBiTuple; import org.apache.ignite.ml.math.primitives.matrix.Matrix; import org.apache.ignite.ml.math.primitives.matrix.impl.DenseMatrix; import org.apache.ignite.ml.math.primitives.vector.Vector; | import org.apache.ignite.lang.*; import org.apache.ignite.ml.math.primitives.matrix.*; import org.apache.ignite.ml.math.primitives.matrix.impl.*; import org.apache.ignite.ml.math.primitives.vector.*; | [
"org.apache.ignite"
] | org.apache.ignite; | 408,867 |
@Deprecated
public void serveFile(StaplerRequest req, StaplerResponse rsp, FilePath root, String icon, boolean serveDirIndex) throws IOException, ServletException, InterruptedException {
serveFile(req, rsp, root.toVirtualFile(), icon, serveDirIndex);
} | void function(StaplerRequest req, StaplerResponse rsp, FilePath root, String icon, boolean serveDirIndex) throws IOException, ServletException, InterruptedException { serveFile(req, rsp, root.toVirtualFile(), icon, serveDirIndex); } | /**
* Serves a file from the file system (Maps the URL to a directory in a file system.)
*
* @param icon
* The icon file name, like "folder-open.gif"
* @param serveDirIndex
* True to generate the directory index.
* False to serve "index.html"
* @deprecated as of 1.297
* Instead of calling this method explicitly, just return the {@link DirectoryBrowserSupport} object
* from the {@code doXYZ} method and let Stapler generate a response for you.
*/ | Serves a file from the file system (Maps the URL to a directory in a file system.) | serveFile | {
"repo_name": "jenkinsci/jenkins",
"path": "core/src/main/java/hudson/model/DirectoryBrowserSupport.java",
"license": "mit",
"size": 33934
} | [
"java.io.IOException",
"javax.servlet.ServletException",
"org.kohsuke.stapler.StaplerRequest",
"org.kohsuke.stapler.StaplerResponse"
] | import java.io.IOException; import javax.servlet.ServletException; import org.kohsuke.stapler.StaplerRequest; import org.kohsuke.stapler.StaplerResponse; | import java.io.*; import javax.servlet.*; import org.kohsuke.stapler.*; | [
"java.io",
"javax.servlet",
"org.kohsuke.stapler"
] | java.io; javax.servlet; org.kohsuke.stapler; | 1,149,106 |
protected User createUserAndInjectSecurityContext( boolean allAuth, String... auths )
{
return createUserAndInjectSecurityContext( null, allAuth, auths );
}
| User function( boolean allAuth, String... auths ) { return createUserAndInjectSecurityContext( null, allAuth, auths ); } | /**
* Creates a user and injects into the security context with username
* "username". Requires <code>identifiableObjectManager</code> and
* <code>userService</code> to be injected into the test.
*
* @param allAuth whether to grant ALL authority to user.
* @param auths authorities to grant to user.
* @return the user.
*/ | Creates a user and injects into the security context with username "username". Requires <code>identifiableObjectManager</code> and <code>userService</code> to be injected into the test | createUserAndInjectSecurityContext | {
"repo_name": "vmluan/dhis2-core",
"path": "dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java",
"license": "bsd-3-clause",
"size": 76838
} | [
"org.hisp.dhis.user.User"
] | import org.hisp.dhis.user.User; | import org.hisp.dhis.user.*; | [
"org.hisp.dhis"
] | org.hisp.dhis; | 2,730,176 |
public void testRowOpAllNoNull() throws Exception {
Client client = getClient();
loadData(false);
String sql;
// Run the same basic query forms as testRowInOrOpAnyNonNull
// where we PURPOSELY repeat each query using
// ORDER, LIMIT, and OFFSET
// instead of a filter to skip the first and last row
// to prevent to-EXISTS transformations (are these even possible?).
sql = "select ID from R1 " +
"where (WAGE, DEPT) = ALL " +
" (select WAGE, DEPT from R2 " +
" where ID > 1 and ID < 5);";
/ dumpQueryPlans(client, sql);
validateTableOfLongs(client, sql, EMPTY_TABLE);
sql = "select ID from R1 " +
"where (DEPT, WAGE) = ALL " +
" (select DEPT, WAGE from R2 " +
" where ID > 1 and ID < 5);";
validateTableOfLongs(client, sql, EMPTY_TABLE);
sql = "select ID from R1 " +
"where (WAGE, DEPT) = ALL " +
" (select WAGE, DEPT from R2 " +
" order by ID offset 1 limit 3);";
/ dumpQueryPlans(client, sql);
validateTableOfLongs(client, sql, EMPTY_TABLE);
sql = "select ID from R1 " +
"where (DEPT, WAGE) = ALL " +
" (select DEPT, WAGE from R2 " +
" order by ID offset 1 limit 3);";
validateTableOfLongs(client, sql, EMPTY_TABLE);
sql = "select ID from R1 " +
"where (WAGE, DEPT) >= ALL " +
" (select WAGE, DEPT from R2 " +
" where ID > 1 and ID < 5) " +
"order by 1;";
validateTableOfLongs(client, sql, new long[][] {{4},{5}});
sql = "select ID from R1 " +
"where (DEPT, WAGE) >= ALL " +
" (select DEPT, WAGE from R2 " +
" where ID > 1 and ID < 5) " +
"order by 1;";
validateTableOfLongs(client, sql, new long[][] {{4},{5}});
sql = "select ID from R1 " +
"where (WAGE, DEPT) >= ALL " +
" (select WAGE, DEPT from R2 " +
" order by ID offset 1 limit 3) " +
"order by 1;";
validateTableOfLongs(client, sql, new long[][] {{4},{5}});
sql = "select ID from R1 " +
"where (DEPT, WAGE) >= ALL " +
" (select DEPT, WAGE from R2 " +
" order by ID offset 1 limit 3) " +
"order by 1;";
validateTableOfLongs(client, sql, new long[][] {{4},{5}});
sql = "select ID from R1 " +
"where (WAGE, DEPT) <= ALL " +
" (select WAGE, DEPT from R2 " +
" where ID > 1 and ID < 5) " +
"order by 1;";
validateTableOfLongs(client, sql, new long[][] {{1},{2}});
sql = "select ID from R1 " +
"where (DEPT, WAGE) <= ALL " +
" (select DEPT, WAGE from R2 " +
" where ID > 1 and ID < 5) " +
"order by 1;";
validateTableOfLongs(client, sql, new long[][] {{1},{2}});
sql = "select ID from R1 " +
"where (WAGE, DEPT) <= ALL " +
" (select WAGE, DEPT from R2 " +
" order by ID offset 1 limit 3) " +
"order by 1;";
validateTableOfLongs(client, sql, new long[][] {{1},{2}});
sql = "select ID from R1 " +
"where (DEPT, WAGE) <= ALL " +
" (select DEPT, WAGE from R2 " +
" order by ID offset 1 limit 3) " +
"order by 1;";
validateTableOfLongs(client, sql, new long[][] {{1},{2}});
sql = "select ID from R1 " +
"where (WAGE, DEPT) > ALL " +
" (select WAGE, DEPT from R2 " +
" where ID > 1 and ID < 5);";
validateTableOfLongs(client, sql, new long[][] {{5}});
sql = "select ID from R1 " +
"where (DEPT, WAGE) > ALL " +
" (select DEPT, WAGE from R2 " +
" where ID > 1 and ID < 5);";
validateTableOfLongs(client, sql, new long[][] {{5}});
sql = "select ID from R1 " +
"where (WAGE, DEPT) > ALL " +
" (select WAGE, DEPT from R2 " +
" order by ID offset 1 limit 3);";
validateTableOfLongs(client, sql, new long[][] {{5}});
sql = "select ID from R1 " +
"where (DEPT, WAGE) > ALL " +
" (select DEPT, WAGE from R2 " +
" order by ID offset 1 limit 3);";
validateTableOfLongs(client, sql, new long[][] {{5}});
sql = "select ID from R1 " +
"where (WAGE, DEPT) < ALL " +
" (select WAGE, DEPT from R2 " +
" where ID > 1 and ID < 5);";
validateTableOfLongs(client, sql, new long[][] {{1}});
sql = "select ID from R1 " +
"where (DEPT, WAGE) < ALL " +
" (select DEPT, WAGE from R2 " +
" where ID > 1 and ID < 5);";
validateTableOfLongs(client, sql, new long[][] {{1}});
sql = "select ID from R1 " +
"where (WAGE, DEPT) < ALL " +
" (select WAGE, DEPT from R2 " +
" order by ID offset 1 limit 3);";
validateTableOfLongs(client, sql, new long[][] {{1}});
sql = "select ID from R1 " +
"where (DEPT, WAGE) < ALL " +
" (select DEPT, WAGE from R2 " +
" order by ID offset 1 limit 3);";
validateTableOfLongs(client, sql, new long[][] {{1}});
sql = "select ID from R1 " +
"where (WAGE, DEPT) <> ALL " +
" (select WAGE, DEPT from R2 " +
" where ID > 1 and ID < 5) " +
"order by 1;";
validateTableOfLongs(client, sql, new long[][] {{1},{5}});
sql = "select ID from R1 " +
"where (DEPT, WAGE) <> ALL " +
" (select DEPT, WAGE from R2 " +
" where ID > 1 and ID < 5) " +
"order by 1;";
validateTableOfLongs(client, sql, new long[][] {{1},{5}});
sql = "select ID from R1 " +
"where (WAGE, DEPT) <> ALL " +
" (select WAGE, DEPT from R2 " +
" order by ID offset 1 limit 3) " +
"order by 1;";
validateTableOfLongs(client, sql, new long[][] {{1},{5}});
sql = "select ID from R1 " +
"where (DEPT, WAGE) <> ALL " +
" (select DEPT, WAGE from R2 " +
" order by ID offset 1 limit 3) " +
"order by 1;";
validateTableOfLongs(client, sql, new long[][] {{1},{5}});
} | void function() throws Exception { Client client = getClient(); loadData(false); String sql; sql = STR + STR + STR + STR; / dumpQueryPlans(client, sql); validateTableOfLongs(client, sql, EMPTY_TABLE); sql = STR + STR + STR + STR; validateTableOfLongs(client, sql, EMPTY_TABLE); sql = STR + STR + STR + STR; / dumpQueryPlans(client, sql); validateTableOfLongs(client, sql, EMPTY_TABLE); sql = STR + STR + STR + STR; validateTableOfLongs(client, sql, EMPTY_TABLE); sql = STR + STR + STR + STR + STR; validateTableOfLongs(client, sql, new long[][] {{4},{5}}); sql = STR + STR + STR + STR + STR; validateTableOfLongs(client, sql, new long[][] {{4},{5}}); sql = STR + STR + STR + STR + STR; validateTableOfLongs(client, sql, new long[][] {{4},{5}}); sql = STR + STR + STR + STR + STR; validateTableOfLongs(client, sql, new long[][] {{4},{5}}); sql = STR + STR + STR + STR + STR; validateTableOfLongs(client, sql, new long[][] {{1},{2}}); sql = STR + STR + STR + STR + STR; validateTableOfLongs(client, sql, new long[][] {{1},{2}}); sql = STR + STR + STR + STR + STR; validateTableOfLongs(client, sql, new long[][] {{1},{2}}); sql = STR + STR + STR + STR + STR; validateTableOfLongs(client, sql, new long[][] {{1},{2}}); sql = STR + STR + STR + STR; validateTableOfLongs(client, sql, new long[][] {{5}}); sql = STR + STR + STR + STR; validateTableOfLongs(client, sql, new long[][] {{5}}); sql = STR + STR + STR + STR; validateTableOfLongs(client, sql, new long[][] {{5}}); sql = STR + STR + STR + STR; validateTableOfLongs(client, sql, new long[][] {{5}}); sql = STR + STR + STR + STR; validateTableOfLongs(client, sql, new long[][] {{1}}); sql = STR + STR + STR + STR; validateTableOfLongs(client, sql, new long[][] {{1}}); sql = STR + STR + STR + STR; validateTableOfLongs(client, sql, new long[][] {{1}}); sql = STR + STR + STR + STR; validateTableOfLongs(client, sql, new long[][] {{1}}); sql = STR + STR + STR + STR + STR; validateTableOfLongs(client, sql, new long[][] {{1},{5}}); sql = STR + STR + STR + STR + STR; validateTableOfLongs(client, sql, new long[][] {{1},{5}}); sql = STR + STR + STR + STR + STR; validateTableOfLongs(client, sql, new long[][] {{1},{5}}); sql = STR + STR + STR + STR + STR; validateTableOfLongs(client, sql, new long[][] {{1},{5}}); } | /**
* SELECT FROM WHERE OUTER OP ALL (SELECT INNER ...) with no NULLs.
*
* @throws Exception
*/ | SELECT FROM WHERE OUTER OP ALL (SELECT INNER ...) with no NULLs | testRowOpAllNoNull | {
"repo_name": "paulmartel/voltdb",
"path": "tests/frontend/org/voltdb/regressionsuites/TestSubQueriesSuite.java",
"license": "agpl-3.0",
"size": 159348
} | [
"org.voltdb.client.Client"
] | import org.voltdb.client.Client; | import org.voltdb.client.*; | [
"org.voltdb.client"
] | org.voltdb.client; | 1,760,050 |
public Field copyField(Field arg) {
return langReflectAccess().copyField(arg);
} | Field function(Field arg) { return langReflectAccess().copyField(arg); } | /** Makes a copy of the passed field. The returned field is a
"child" of the passed one; see the comments in Field.java for
details. */ | Makes a copy of the passed field. The returned field is a | copyField | {
"repo_name": "tranleduy2000/javaide",
"path": "jdk-1_7/src/main/java/sun/reflect/ReflectionFactory.java",
"license": "gpl-3.0",
"size": 17971
} | [
"java.lang.reflect.Field"
] | import java.lang.reflect.Field; | import java.lang.reflect.*; | [
"java.lang"
] | java.lang; | 2,643,504 |
public void sendMessage(ChipsterMessage message) throws JMSException {
// log
logger.debug("sending " + message);
// marshal message to MapMessage
MapMessage mapMessage = session.createMapMessage();
message.marshal(mapMessage);
MessageProducer producer = null;
try {
producer = session.createProducer(topic);
producer.send(mapMessage);
} finally {
try {
producer.close();
} catch (Exception e) {
}
}
} | void function(ChipsterMessage message) throws JMSException { logger.debug(STR + message); MapMessage mapMessage = session.createMapMessage(); message.marshal(mapMessage); MessageProducer producer = null; try { producer = session.createProducer(topic); producer.send(mapMessage); } finally { try { producer.close(); } catch (Exception e) { } } } | /**
* The basic message sending method. Sends a message without reply possibility.
* Not multithread safe.
*/ | The basic message sending method. Sends a message without reply possibility. Not multithread safe | sendMessage | {
"repo_name": "ilarischeinin/chipster",
"path": "src/main/java/fi/csc/microarray/messaging/MessagingTopic.java",
"license": "gpl-3.0",
"size": 4463
} | [
"fi.csc.microarray.messaging.message.ChipsterMessage",
"javax.jms.JMSException",
"javax.jms.MapMessage",
"javax.jms.MessageProducer"
] | import fi.csc.microarray.messaging.message.ChipsterMessage; import javax.jms.JMSException; import javax.jms.MapMessage; import javax.jms.MessageProducer; | import fi.csc.microarray.messaging.message.*; import javax.jms.*; | [
"fi.csc.microarray",
"javax.jms"
] | fi.csc.microarray; javax.jms; | 537,148 |
//-----------------------------------------------------------------------
public static List languagesByCountry(String countryCode) {
List langs = (List) cLanguagesByCountry.get(countryCode); //syncd
if (langs == null) {
if (countryCode != null) {
langs = new ArrayList();
List locales = availableLocaleList();
for (int i = 0; i < locales.size(); i++) {
Locale locale = (Locale) locales.get(i);
if (countryCode.equals(locale.getCountry()) &&
locale.getVariant().length() == 0) {
langs.add(locale);
}
}
langs = Collections.unmodifiableList(langs);
} else {
langs = Collections.EMPTY_LIST;
}
cLanguagesByCountry.put(countryCode, langs); //syncd
}
return langs;
} | static List function(String countryCode) { List langs = (List) cLanguagesByCountry.get(countryCode); if (langs == null) { if (countryCode != null) { langs = new ArrayList(); List locales = availableLocaleList(); for (int i = 0; i < locales.size(); i++) { Locale locale = (Locale) locales.get(i); if (countryCode.equals(locale.getCountry()) && locale.getVariant().length() == 0) { langs.add(locale); } } langs = Collections.unmodifiableList(langs); } else { langs = Collections.EMPTY_LIST; } cLanguagesByCountry.put(countryCode, langs); } return langs; } | /**
* <p>Obtains the list of languages supported for a given country.</p>
*
* <p>This method takes a country code and searches to find the
* languages available for that country. Variant locales are removed.</p>
*
* @param countryCode the 2 letter country code, null returns empty
* @return an unmodifiable List of Locale objects, never null
*/ | Obtains the list of languages supported for a given country. This method takes a country code and searches to find the languages available for that country. Variant locales are removed | languagesByCountry | {
"repo_name": "SpoonLabs/gumtree-spoon-ast-diff",
"path": "src/test/resources/examples/d4j/Lang_57/LocaleUtils/Lang_57_LocaleUtils_s.java",
"license": "apache-2.0",
"size": 11552
} | [
"java.util.ArrayList",
"java.util.Collections",
"java.util.List",
"java.util.Locale"
] | import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Locale; | import java.util.*; | [
"java.util"
] | java.util; | 2,567,436 |
public void testHashCode() {
PaintList p1 = new PaintList();
PaintList p2 = new PaintList();
assertTrue(p1.hashCode() == p2.hashCode());
p1.setPaint(0, Color.red);
assertFalse(p1.hashCode() == p2.hashCode());
p2.setPaint(0, Color.red);
assertTrue(p1.hashCode() == p2.hashCode());
p1.setPaint(1, new GradientPaint(1.0f, 2.0f, Color.RED, 3.0f, 4.0f,
Color.GREEN));
assertFalse(p1.hashCode() == p2.hashCode());
p2.setPaint(1, new GradientPaint(1.0f, 2.0f, Color.RED, 3.0f, 4.0f,
Color.GREEN));
assertTrue(p1.hashCode() == p2.hashCode());
} | void function() { PaintList p1 = new PaintList(); PaintList p2 = new PaintList(); assertTrue(p1.hashCode() == p2.hashCode()); p1.setPaint(0, Color.red); assertFalse(p1.hashCode() == p2.hashCode()); p2.setPaint(0, Color.red); assertTrue(p1.hashCode() == p2.hashCode()); p1.setPaint(1, new GradientPaint(1.0f, 2.0f, Color.RED, 3.0f, 4.0f, Color.GREEN)); assertFalse(p1.hashCode() == p2.hashCode()); p2.setPaint(1, new GradientPaint(1.0f, 2.0f, Color.RED, 3.0f, 4.0f, Color.GREEN)); assertTrue(p1.hashCode() == p2.hashCode()); } | /**
* Some checks for the testHashCode() method.
*/ | Some checks for the testHashCode() method | testHashCode | {
"repo_name": "ilyessou/jfreechart",
"path": "tests/org/jfree/chart/util/junit/PaintListTests.java",
"license": "lgpl-2.1",
"size": 6063
} | [
"java.awt.Color",
"java.awt.GradientPaint",
"org.jfree.chart.util.PaintList"
] | import java.awt.Color; import java.awt.GradientPaint; import org.jfree.chart.util.PaintList; | import java.awt.*; import org.jfree.chart.util.*; | [
"java.awt",
"org.jfree.chart"
] | java.awt; org.jfree.chart; | 312,694 |
@Override
public Header authenticate(
final Credentials credentials,
final HttpRequest request,
final HttpContext context) throws AuthenticationException {
Args.notNull(credentials, "Credentials");
Args.notNull(request, "HTTP request");
if (getParameter("realm") == null) {
throw new AuthenticationException("missing realm in challenge");
}
if (getParameter("nonce") == null) {
throw new AuthenticationException("missing nonce in challenge");
}
// Add method name and request-URI to the parameter map
getParameters().put("methodname", request.getRequestLine().getMethod());
getParameters().put("uri", request.getRequestLine().getUri());
final String charset = getParameter("charset");
if (charset == null) {
getParameters().put("charset", getCredentialsCharset(request));
}
return createDigestHeader(credentials, request);
}
| Header function( final Credentials credentials, final HttpRequest request, final HttpContext context) throws AuthenticationException { Args.notNull(credentials, STR); Args.notNull(request, STR); if (getParameter("realm") == null) { throw new AuthenticationException(STR); } if (getParameter("nonce") == null) { throw new AuthenticationException(STR); } getParameters().put(STR, request.getRequestLine().getMethod()); getParameters().put("uri", request.getRequestLine().getUri()); final String charset = getParameter(STR); if (charset == null) { getParameters().put(STR, getCredentialsCharset(request)); } return createDigestHeader(credentials, request); } | /**
* Produces a digest authorization string for the given set of
* {@link Credentials}, method name and URI.
*
* @param credentials A set of credentials to be used for athentication
* @param request The request being authenticated
*
* @throws org.apache.http.auth.InvalidCredentialsException if authentication credentials
* are not valid or not applicable for this authentication scheme
* @throws AuthenticationException if authorization string cannot
* be generated due to an authentication failure
*
* @return a digest authorization string
*/ | Produces a digest authorization string for the given set of <code>Credentials</code>, method name and URI | authenticate | {
"repo_name": "vuzzan/openclinic",
"path": "src/org/apache/http/impl/auth/DigestScheme.java",
"license": "apache-2.0",
"size": 17738
} | [
"org.apache.http.Header",
"org.apache.http.HttpRequest",
"org.apache.http.auth.AuthenticationException",
"org.apache.http.auth.Credentials",
"org.apache.http.protocol.HttpContext",
"org.apache.http.util.Args"
] | import org.apache.http.Header; import org.apache.http.HttpRequest; import org.apache.http.auth.AuthenticationException; import org.apache.http.auth.Credentials; import org.apache.http.protocol.HttpContext; import org.apache.http.util.Args; | import org.apache.http.*; import org.apache.http.auth.*; import org.apache.http.protocol.*; import org.apache.http.util.*; | [
"org.apache.http"
] | org.apache.http; | 1,012,075 |
@VisibleForTesting
void shutdownService() throws TimeoutException {
if (serviceStarted) {
InstrumentationRegistry.getInstrumentation().getTargetContext().stopService(serviceIntent);
serviceStarted = false;
}
unbindService();
} | void shutdownService() throws TimeoutException { if (serviceStarted) { InstrumentationRegistry.getInstrumentation().getTargetContext().stopService(serviceIntent); serviceStarted = false; } unbindService(); } | /**
* Makes the necessary calls to stop (or unbind) the service under test. This method is called
* automatically called after test execution. This is not a blocking call since there is no
* reliable way to guarantee successful disconnect without access to service lifecycle.
*/ | Makes the necessary calls to stop (or unbind) the service under test. This method is called automatically called after test execution. This is not a blocking call since there is no reliable way to guarantee successful disconnect without access to service lifecycle | shutdownService | {
"repo_name": "android/android-test",
"path": "runner/rules/java/androidx/test/rule/ServiceTestRule.java",
"license": "apache-2.0",
"size": 14052
} | [
"androidx.test.platform.app.InstrumentationRegistry",
"java.util.concurrent.TimeoutException"
] | import androidx.test.platform.app.InstrumentationRegistry; import java.util.concurrent.TimeoutException; | import androidx.test.platform.app.*; import java.util.concurrent.*; | [
"androidx.test",
"java.util"
] | androidx.test; java.util; | 1,871,885 |
@Generated
@Selector("snapshot")
public native UIImage snapshot(); | @Selector(STR) native UIImage function(); | /**
* [@property] snapshot
* <p>
* Draws the contents of the view and returns them as a new image object
* <p>
* This method is thread-safe and may be called at any time.
*/ | [@property] snapshot Draws the contents of the view and returns them as a new image object This method is thread-safe and may be called at any time | snapshot | {
"repo_name": "multi-os-engine/moe-core",
"path": "moe.apple/moe.platform.ios/src/main/java/apple/scenekit/SCNView.java",
"license": "apache-2.0",
"size": 33404
} | [
"org.moe.natj.objc.ann.Selector"
] | import org.moe.natj.objc.ann.Selector; | import org.moe.natj.objc.ann.*; | [
"org.moe.natj"
] | org.moe.natj; | 2,203,391 |
public BigDecimal getBreakValue ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_BreakValue);
if (bd == null)
return Env.ZERO;
return bd;
} | BigDecimal function () { BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_BreakValue); if (bd == null) return Env.ZERO; return bd; } | /** Get Break Value.
@return Low Value of trade discount break level
*/ | Get Break Value | getBreakValue | {
"repo_name": "neuroidss/adempiere",
"path": "base/src/org/compiere/model/X_I_PriceList.java",
"license": "gpl-2.0",
"size": 15815
} | [
"java.math.BigDecimal",
"org.compiere.util.Env"
] | import java.math.BigDecimal; import org.compiere.util.Env; | import java.math.*; import org.compiere.util.*; | [
"java.math",
"org.compiere.util"
] | java.math; org.compiere.util; | 1,232,614 |
ClassReader reader = new ClassReader(input);
ClassWriter writer = new ClassWriter(0);
reader.accept(new ClassEditor(writer), 0);
output.write(writer.toByteArray());
}
private class ClassEditor extends ClassVisitor {
ClassEditor(ClassVisitor forward) {
super(Opcodes.ASM5, forward);
} | ClassReader reader = new ClassReader(input); ClassWriter writer = new ClassWriter(0); reader.accept(new ClassEditor(writer), 0); output.write(writer.toByteArray()); } private class ClassEditor extends ClassVisitor { ClassEditor(ClassVisitor forward) { super(Opcodes.ASM5, forward); } | /**
* Rewrite the class binary and write it into the output.
* @param input input stream which provides the original class binary
* @param output the output stream which accepts the modified class binary
* @throws IOException if failed to rewrite by I/O error
*/ | Rewrite the class binary and write it into the output | rewrite | {
"repo_name": "asakusafw/asakusafw-compiler",
"path": "compiler-project/redirector/src/main/java/com/asakusafw/lang/compiler/redirector/ClassRewriter.java",
"license": "apache-2.0",
"size": 3713
} | [
"org.objectweb.asm.ClassReader",
"org.objectweb.asm.ClassVisitor",
"org.objectweb.asm.ClassWriter",
"org.objectweb.asm.Opcodes"
] | import org.objectweb.asm.ClassReader; import org.objectweb.asm.ClassVisitor; import org.objectweb.asm.ClassWriter; import org.objectweb.asm.Opcodes; | import org.objectweb.asm.*; | [
"org.objectweb.asm"
] | org.objectweb.asm; | 2,296,894 |
public String sanitize(String argument) {
int indexOfFirstEqual = argument.indexOf("=");
if (indexOfFirstEqual == -1) {
return argument;
}
String key = argument.substring(0, indexOfFirstEqual);
String value = argument.substring(indexOfFirstEqual + 1);
for (Pattern pattern : this.keysToSanitize) {
if (pattern.matcher(key).matches()) {
value = "******";
break;
}
}
return String.format("%s=%s", key, value);
} | String function(String argument) { int indexOfFirstEqual = argument.indexOf("="); if (indexOfFirstEqual == -1) { return argument; } String key = argument.substring(0, indexOfFirstEqual); String value = argument.substring(indexOfFirstEqual + 1); for (Pattern pattern : this.keysToSanitize) { if (pattern.matcher(key).matches()) { value = STR; break; } } return String.format("%s=%s", key, value); } | /**
* Replaces a potential secure value with "******".
* @param argument the argument to cleanse.
* @return the argument with a potentially sanitized value
*/ | Replaces a potential secure value with "******" | sanitize | {
"repo_name": "ericbottard/spring-cloud-dataflow",
"path": "spring-cloud-dataflow-server-core/src/main/java/org/springframework/cloud/dataflow/server/controller/support/ArgumentSanitizer.java",
"license": "apache-2.0",
"size": 2287
} | [
"java.util.regex.Pattern"
] | import java.util.regex.Pattern; | import java.util.regex.*; | [
"java.util"
] | java.util; | 999,109 |
public static CMnDbReleaseSummaryData parseSummary(ResultSet rs) throws SQLException {
String name = rs.getString(RELEASE_NAME);
CMnDbReleaseSummaryData data = new CMnDbReleaseSummaryData(name);
String text = rs.getString(RELEASE_TEXT);
data.setText(text);
String id = rs.getString(SUMMARY_ID);
data.setId(id);
int order = rs.getInt(SUMMARY_ORDER);
data.setOrder(order);
String version = rs.getString(BUILD_VERSION);
data.setBuildVersion(version);
String type = rs.getString(RELEASE_TYPE);
setReleaseType(data, type);
String status = rs.getString(RELEASE_STATUS);
setReleaseStatus(data, status);
return data;
} | static CMnDbReleaseSummaryData function(ResultSet rs) throws SQLException { String name = rs.getString(RELEASE_NAME); CMnDbReleaseSummaryData data = new CMnDbReleaseSummaryData(name); String text = rs.getString(RELEASE_TEXT); data.setText(text); String id = rs.getString(SUMMARY_ID); data.setId(id); int order = rs.getInt(SUMMARY_ORDER); data.setOrder(order); String version = rs.getString(BUILD_VERSION); data.setBuildVersion(version); String type = rs.getString(RELEASE_TYPE); setReleaseType(data, type); String status = rs.getString(RELEASE_STATUS); setReleaseStatus(data, status); return data; } | /**
* Parse the fields of an entry in the summary table and return the corresponding
* data as a data object.
*
* @param rs Result set containing the summary data
* @return Summary data for the current row
*/ | Parse the fields of an entry in the summary table and return the corresponding data as a data object | parseSummary | {
"repo_name": "ModelN/build-management",
"path": "mn-build-core/src/main/java/com/modeln/testfw/reporting/CMnReleaseSummaryTable.java",
"license": "mit",
"size": 9007
} | [
"java.sql.ResultSet",
"java.sql.SQLException"
] | import java.sql.ResultSet; import java.sql.SQLException; | import java.sql.*; | [
"java.sql"
] | java.sql; | 2,726,394 |
void register(Document toolXml); | void register(Document toolXml); | /**
* Add tools in this XML DOM to the registry, using the Tool XML schema.
* @param toolXml The parsed XML DOM in which tools to be added to the registry are to be found.
*/ | Add tools in this XML DOM to the registry, using the Tool XML schema | register | {
"repo_name": "eemirtekin/Sakai-10.6-TR",
"path": "kernel/api/src/main/java/org/sakaiproject/tool/api/ToolManager.java",
"license": "apache-2.0",
"size": 6605
} | [
"org.w3c.dom.Document"
] | import org.w3c.dom.Document; | import org.w3c.dom.*; | [
"org.w3c.dom"
] | org.w3c.dom; | 1,130,297 |
public ConstantAction getCreateRoleConstantAction(String roleName)
{
return new CreateRoleConstantAction(roleName);
} | ConstantAction function(String roleName) { return new CreateRoleConstantAction(roleName); } | /**
* Make the ConstantAction for a CREATE ROLE statement.
*
* @param roleName Name of role.
*/ | Make the ConstantAction for a CREATE ROLE statement | getCreateRoleConstantAction | {
"repo_name": "scnakandala/derby",
"path": "java/engine/org/apache/derby/impl/sql/execute/GenericConstantActionFactory.java",
"license": "apache-2.0",
"size": 40467
} | [
"org.apache.derby.iapi.sql.execute.ConstantAction"
] | import org.apache.derby.iapi.sql.execute.ConstantAction; | import org.apache.derby.iapi.sql.execute.*; | [
"org.apache.derby"
] | org.apache.derby; | 1,935,352 |
List findByNamedQueryAndNamedParam(String queryName, String[] paramNames, Object[] values)
throws DataAccessException; | List findByNamedQueryAndNamedParam(String queryName, String[] paramNames, Object[] values) throws DataAccessException; | /**
* Execute a named query, binding a number of values to ":" named
* parameters in the query string.
* <p>A named query is defined in a Hibernate mapping file.
* @param queryName the name of a Hibernate query in a mapping file
* @param paramNames the names of the parameters
* @param values the values of the parameters
* @return a {@link List} containing the results of the query execution
* @throws org.springframework.dao.DataAccessException in case of Hibernate errors
* @see org.hibernate.Session#getNamedQuery(String)
*/ | Execute a named query, binding a number of values to ":" named parameters in the query string. A named query is defined in a Hibernate mapping file | findByNamedQueryAndNamedParam | {
"repo_name": "mattxia/spring-2.5-analysis",
"path": "src/org/springframework/orm/hibernate3/HibernateOperations.java",
"license": "apache-2.0",
"size": 43554
} | [
"java.util.List",
"org.springframework.dao.DataAccessException"
] | import java.util.List; import org.springframework.dao.DataAccessException; | import java.util.*; import org.springframework.dao.*; | [
"java.util",
"org.springframework.dao"
] | java.util; org.springframework.dao; | 173,702 |
protected int getBucket(Cluster<T> cluster) {
int size = cluster.getSize();
if (size <= BUCKETS[0]) {
return size;
}
for (int i = 0; i < BUCKETS.length - 1; i++) {
if (size < BUCKETS[i + 1]) {
return BUCKETS[i];
}
}
return BUCKETS[BUCKETS.length - 1];
}
@SuppressLint("HandlerLeak")
private class ViewModifier extends Handler {
private static final int RUN_TASK = 0;
private static final int TASK_FINISHED = 1;
private boolean mViewModificationInProgress = false;
private RenderTask mNextClusters = null; | int function(Cluster<T> cluster) { int size = cluster.getSize(); if (size <= BUCKETS[0]) { return size; } for (int i = 0; i < BUCKETS.length - 1; i++) { if (size < BUCKETS[i + 1]) { return BUCKETS[i]; } } return BUCKETS[BUCKETS.length - 1]; } @SuppressLint(STR) private class ViewModifier extends Handler { private static final int RUN_TASK = 0; private static final int TASK_FINISHED = 1; private boolean mViewModificationInProgress = false; private RenderTask mNextClusters = null; | /**
* Gets the "bucket" for a particular cluster. By default, uses the number of points within the
* cluster, bucketed to some set points.
*/ | Gets the "bucket" for a particular cluster. By default, uses the number of points within the cluster, bucketed to some set points | getBucket | {
"repo_name": "alexws54tk/wigle-wifi-wardriving",
"path": "library/src/main/java/com/google/maps/android/clustering/view/DefaultClusterRenderer.java",
"license": "bsd-3-clause",
"size": 35743
} | [
"android.annotation.SuppressLint",
"android.os.Handler",
"com.google.maps.android.clustering.Cluster"
] | import android.annotation.SuppressLint; import android.os.Handler; import com.google.maps.android.clustering.Cluster; | import android.annotation.*; import android.os.*; import com.google.maps.android.clustering.*; | [
"android.annotation",
"android.os",
"com.google.maps"
] | android.annotation; android.os; com.google.maps; | 466,539 |
EAttribute getFossilSteamSupply_ControlTC(); | EAttribute getFossilSteamSupply_ControlTC(); | /**
* Returns the meta object for the attribute '{@link CIM.IEC61970.Generation.GenerationDynamics.FossilSteamSupply#getControlTC <em>Control TC</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the attribute '<em>Control TC</em>'.
* @see CIM.IEC61970.Generation.GenerationDynamics.FossilSteamSupply#getControlTC()
* @see #getFossilSteamSupply()
* @generated
*/ | Returns the meta object for the attribute '<code>CIM.IEC61970.Generation.GenerationDynamics.FossilSteamSupply#getControlTC Control TC</code>'. | getFossilSteamSupply_ControlTC | {
"repo_name": "georghinkel/ttc2017smartGrids",
"path": "solutions/ModelJoin/src/main/java/CIM/IEC61970/Generation/GenerationDynamics/GenerationDynamicsPackage.java",
"license": "mit",
"size": 239957
} | [
"org.eclipse.emf.ecore.EAttribute"
] | import org.eclipse.emf.ecore.EAttribute; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 1,751,963 |
public ArrayList<Long> genCards(List<Long> nids) {
return genCards(Utils.arrayList2array(nids));
} | ArrayList<Long> function(List<Long> nids) { return genCards(Utils.arrayList2array(nids)); } | /**
* Generate cards for non-empty templates, return ids to remove.
*/ | Generate cards for non-empty templates, return ids to remove | genCards | {
"repo_name": "patrick91/Anki-Android",
"path": "AnkiDroid/src/main/java/com/ichi2/libanki/Collection.java",
"license": "gpl-3.0",
"size": 57915
} | [
"java.util.ArrayList",
"java.util.List"
] | import java.util.ArrayList; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 853,866 |
public Observable<ServiceResponse<Page<ProviderInner>>> listSinglePageAsync(final Integer top, final String expand) {
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
} | Observable<ServiceResponse<Page<ProviderInner>>> function(final Integer top, final String expand) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException(STR); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException(STR); } | /**
* Gets a list of resource providers.
*
ServiceResponse<PageImpl<ProviderInner>> * @param top Query parameters. If null is passed returns all deployments.
ServiceResponse<PageImpl<ProviderInner>> * @param expand The $expand query parameter. e.g. To include property aliases in response, use $expand=resourceTypes/aliases.
* @return the PagedList<ProviderInner> object wrapped in {@link ServiceResponse} if successful.
*/ | Gets a list of resource providers | listSinglePageAsync | {
"repo_name": "herveyw/azure-sdk-for-java",
"path": "azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/implementation/ProvidersInner.java",
"license": "mit",
"size": 34144
} | [
"com.microsoft.azure.Page",
"com.microsoft.rest.ServiceResponse"
] | import com.microsoft.azure.Page; import com.microsoft.rest.ServiceResponse; | import com.microsoft.azure.*; import com.microsoft.rest.*; | [
"com.microsoft.azure",
"com.microsoft.rest"
] | com.microsoft.azure; com.microsoft.rest; | 2,229,347 |
protected void checkQuickTime() {
try {
String qtsystemPath =
Registry.getStringValue(REGISTRY_ROOT_KEY.LOCAL_MACHINE,
"Software\\Apple Computer, Inc.\\QuickTime",
"QTSysDir");
// Could show a warning message here if QT not installed, but that
// would annoy people who don't want anything to do with QuickTime.
if (qtsystemPath != null) {
File qtjavaZip = new File(qtsystemPath, "QTJava.zip");
if (qtjavaZip.exists()) {
String qtjavaZipPath = qtjavaZip.getAbsolutePath();
String cp = System.getProperty("java.class.path");
System.setProperty("java.class.path",
cp + File.pathSeparator + qtjavaZipPath);
}
}
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
| void function() { try { String qtsystemPath = Registry.getStringValue(REGISTRY_ROOT_KEY.LOCAL_MACHINE, STR, STR); if (qtsystemPath != null) { File qtjavaZip = new File(qtsystemPath, STR); if (qtjavaZip.exists()) { String qtjavaZipPath = qtjavaZip.getAbsolutePath(); String cp = System.getProperty(STR); System.setProperty(STR, cp + File.pathSeparator + qtjavaZipPath); } } } catch (UnsupportedEncodingException e) { e.printStackTrace(); } } | /**
* Find QuickTime for Java installation.
*/ | Find QuickTime for Java installation | checkQuickTime | {
"repo_name": "flutterwireless/ArduinoCodebase",
"path": "app/src/processing/app/windows/Platform.java",
"license": "lgpl-2.1",
"size": 12187
} | [
"java.io.File",
"java.io.UnsupportedEncodingException"
] | import java.io.File; import java.io.UnsupportedEncodingException; | import java.io.*; | [
"java.io"
] | java.io; | 697,170 |
private void enableInteractiveSettings() throws Exception {
console.setExpandEvents(false);
console.setHandleUserInterrupt(true);
File file = new File(historyStore);
file.createNewFile();
console.setHistory(new FileHistory(file));
Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() { | void function() throws Exception { console.setExpandEvents(false); console.setHandleUserInterrupt(true); File file = new File(historyStore); file.createNewFile(); console.setHistory(new FileHistory(file)); Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() { | /**
* Turn on the settings necessary to make the application "interactive"
* (e.g. a REPL). By default, these settings are turned off.
*/ | Turn on the settings necessary to make the application "interactive" (e.g. a REPL). By default, these settings are turned off | enableInteractiveSettings | {
"repo_name": "mAzurkovic/concourse",
"path": "concourse-shell/src/main/java/org/cinchapi/concourse/shell/ConcourseShell.java",
"license": "apache-2.0",
"size": 22037
} | [
"java.io.File",
"jline.console.history.FileHistory"
] | import java.io.File; import jline.console.history.FileHistory; | import java.io.*; import jline.console.history.*; | [
"java.io",
"jline.console.history"
] | java.io; jline.console.history; | 176,754 |
public void printStacks(Collection<InternalDistributedMember> ids, boolean useNative) {
Set<InternalDistributedMember> requiresMessage = new HashSet<>();
if (ids.contains(localAddress)) {
OSProcess.printStacks(0, useNative);
}
if (useNative) {
requiresMessage.addAll(ids);
ids.remove(localAddress);
} else {
for (InternalDistributedMember mbr : ids) {
if (mbr.getProcessId() > 0
&& mbr.getInetAddress().equals(localAddress.getInetAddress())) {
if (!mbr.equals(localAddress)) {
if (!OSProcess.printStacks(mbr.getProcessId(), false)) {
requiresMessage.add(mbr);
}
}
} else {
requiresMessage.add(mbr);
}
}
}
if (requiresMessage.size() > 0) {
HighPriorityAckedMessage msg = new HighPriorityAckedMessage();
msg.dumpStacks(requiresMessage, useNative, false);
}
} | void function(Collection<InternalDistributedMember> ids, boolean useNative) { Set<InternalDistributedMember> requiresMessage = new HashSet<>(); if (ids.contains(localAddress)) { OSProcess.printStacks(0, useNative); } if (useNative) { requiresMessage.addAll(ids); ids.remove(localAddress); } else { for (InternalDistributedMember mbr : ids) { if (mbr.getProcessId() > 0 && mbr.getInetAddress().equals(localAddress.getInetAddress())) { if (!mbr.equals(localAddress)) { if (!OSProcess.printStacks(mbr.getProcessId(), false)) { requiresMessage.add(mbr); } } } else { requiresMessage.add(mbr); } } } if (requiresMessage.size() > 0) { HighPriorityAckedMessage msg = new HighPriorityAckedMessage(); msg.dumpStacks(requiresMessage, useNative, false); } } | /**
* this causes the given InternalDistributedMembers to log thread dumps. If useNative is true we
* attempt to use OSProcess native code for the dumps. This goes to stdout instead of the
* system.log files.
*/ | this causes the given InternalDistributedMembers to log thread dumps. If useNative is true we attempt to use OSProcess native code for the dumps. This goes to stdout instead of the system.log files | printStacks | {
"repo_name": "davebarnes97/geode",
"path": "geode-core/src/main/java/org/apache/geode/distributed/internal/ClusterDistributionManager.java",
"license": "apache-2.0",
"size": 93878
} | [
"java.util.Collection",
"java.util.HashSet",
"java.util.Set",
"org.apache.geode.distributed.internal.membership.InternalDistributedMember",
"org.apache.geode.logging.internal.OSProcess"
] | import java.util.Collection; import java.util.HashSet; import java.util.Set; import org.apache.geode.distributed.internal.membership.InternalDistributedMember; import org.apache.geode.logging.internal.OSProcess; | import java.util.*; import org.apache.geode.distributed.internal.membership.*; import org.apache.geode.logging.internal.*; | [
"java.util",
"org.apache.geode"
] | java.util; org.apache.geode; | 2,724,676 |
private void readXmlFormat(Reader reader) throws IOException {
try {
XMLReader xmlReader = XMLReaderFactory.createXMLReader();
InputSource inputSource = new InputSource(reader);
xmlReader.setContentHandler(new ConfigurationContentHandler(this));
xmlReader.parse(inputSource);
if (null == getPath(PathKind.VTL)) {
// set VTL path by default to VIL path
setPathDirect(PathKind.VTL, getPath(PathKind.VIL));
}
} catch (SAXException e) {
throw new IOException(e);
}
} | void function(Reader reader) throws IOException { try { XMLReader xmlReader = XMLReaderFactory.createXMLReader(); InputSource inputSource = new InputSource(reader); xmlReader.setContentHandler(new ConfigurationContentHandler(this)); xmlReader.parse(inputSource); if (null == getPath(PathKind.VTL)) { setPathDirect(PathKind.VTL, getPath(PathKind.VIL)); } } catch (SAXException e) { throw new IOException(e); } } | /**
* Reads the configuration for the extensible XML format.
*
* @param reader the reader to read from
* @throws IOException in case of I/O problems
*/ | Reads the configuration for the extensible XML format | readXmlFormat | {
"repo_name": "SSEHUB/EASyProducer",
"path": "Plugins/EASy-Producer/de.uni_hildesheim.sse.EASy-Producer.persistence/src/net/ssehub/easy/producer/core/persistence/Configuration.java",
"license": "apache-2.0",
"size": 13364
} | [
"java.io.IOException",
"java.io.Reader",
"org.xml.sax.InputSource",
"org.xml.sax.SAXException",
"org.xml.sax.XMLReader",
"org.xml.sax.helpers.XMLReaderFactory"
] | import java.io.IOException; import java.io.Reader; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.xml.sax.XMLReader; import org.xml.sax.helpers.XMLReaderFactory; | import java.io.*; import org.xml.sax.*; import org.xml.sax.helpers.*; | [
"java.io",
"org.xml.sax"
] | java.io; org.xml.sax; | 1,384,423 |
@PluginFactory
public static FailoverAppender createAppender(
@PluginAttribute("name") final String name,
@PluginAttribute("primary") final String primary,
@PluginElement("Failovers") final String[] failovers,
@PluginAliases("retryInterval") // deprecated
@PluginAttribute("retryIntervalSeconds") final String retryIntervalSeconds,
@PluginConfiguration final Configuration config,
@PluginElement("Filter") final Filter filter,
@PluginAttribute("ignoreExceptions") final String ignore) {
if (name == null) {
LOGGER.error("A name for the Appender must be specified");
return null;
}
if (primary == null) {
LOGGER.error("A primary Appender must be specified");
return null;
}
if (failovers == null || failovers.length == 0) {
LOGGER.error("At least one failover Appender must be specified");
return null;
}
final int seconds = parseInt(retryIntervalSeconds, DEFAULT_INTERVAL_SECONDS);
int retryIntervalMillis;
if (seconds >= 0) {
retryIntervalMillis = seconds * Constants.MILLIS_IN_SECONDS;
} else {
LOGGER.warn("Interval " + retryIntervalSeconds + " is less than zero. Using default");
retryIntervalMillis = DEFAULT_INTERVAL_SECONDS * Constants.MILLIS_IN_SECONDS;
}
final boolean ignoreExceptions = Booleans.parseBoolean(ignore, true);
return new FailoverAppender(name, filter, primary, failovers, retryIntervalMillis, config, ignoreExceptions);
} | static FailoverAppender function( @PluginAttribute("name") final String name, @PluginAttribute(STR) final String primary, @PluginElement(STR) final String[] failovers, @PluginAliases(STR) @PluginAttribute(STR) final String retryIntervalSeconds, @PluginConfiguration final Configuration config, @PluginElement(STR) final Filter filter, @PluginAttribute(STR) final String ignore) { if (name == null) { LOGGER.error(STR); return null; } if (primary == null) { LOGGER.error(STR); return null; } if (failovers == null failovers.length == 0) { LOGGER.error(STR); return null; } final int seconds = parseInt(retryIntervalSeconds, DEFAULT_INTERVAL_SECONDS); int retryIntervalMillis; if (seconds >= 0) { retryIntervalMillis = seconds * Constants.MILLIS_IN_SECONDS; } else { LOGGER.warn(STR + retryIntervalSeconds + STR); retryIntervalMillis = DEFAULT_INTERVAL_SECONDS * Constants.MILLIS_IN_SECONDS; } final boolean ignoreExceptions = Booleans.parseBoolean(ignore, true); return new FailoverAppender(name, filter, primary, failovers, retryIntervalMillis, config, ignoreExceptions); } | /**
* Create a Failover Appender.
* @param name The name of the Appender (required).
* @param primary The name of the primary Appender (required).
* @param failovers The name of one or more Appenders to fail over to (at least one is required).
* @param retryIntervalSeconds The retry interval in seconds.
* @param config The current Configuration (passed by the Configuration when the appender is created).
* @param filter A Filter (optional).
* @param ignore If {@code "true"} (default) exceptions encountered when appending events are logged; otherwise
* they are propagated to the caller.
* @return The FailoverAppender that was created.
*/ | Create a Failover Appender | createAppender | {
"repo_name": "ChetnaChaudhari/logging-log4j2",
"path": "log4j-core/src/main/java/org/apache/logging/log4j/core/appender/FailoverAppender.java",
"license": "apache-2.0",
"size": 8615
} | [
"org.apache.logging.log4j.core.Filter",
"org.apache.logging.log4j.core.config.Configuration",
"org.apache.logging.log4j.core.config.plugins.PluginAliases",
"org.apache.logging.log4j.core.config.plugins.PluginAttribute",
"org.apache.logging.log4j.core.config.plugins.PluginConfiguration",
"org.apache.logging.log4j.core.config.plugins.PluginElement",
"org.apache.logging.log4j.core.util.Booleans",
"org.apache.logging.log4j.core.util.Constants"
] | import org.apache.logging.log4j.core.Filter; import org.apache.logging.log4j.core.config.Configuration; import org.apache.logging.log4j.core.config.plugins.PluginAliases; import org.apache.logging.log4j.core.config.plugins.PluginAttribute; import org.apache.logging.log4j.core.config.plugins.PluginConfiguration; import org.apache.logging.log4j.core.config.plugins.PluginElement; import org.apache.logging.log4j.core.util.Booleans; import org.apache.logging.log4j.core.util.Constants; | import org.apache.logging.log4j.core.*; import org.apache.logging.log4j.core.config.*; import org.apache.logging.log4j.core.config.plugins.*; import org.apache.logging.log4j.core.util.*; | [
"org.apache.logging"
] | org.apache.logging; | 351,599 |
void setContent(EObject value); | void setContent(EObject value); | /**
* Sets the value of the '{@link org.sourcepit.common.modeling.Annotation#getContent <em>Content</em>}' containment
* reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @param value the new value of the '<em>Content</em>' containment reference.
* @see #getContent()
* @generated
*/ | Sets the value of the '<code>org.sourcepit.common.modeling.Annotation#getContent Content</code>' containment reference. | setContent | {
"repo_name": "sourcepit/common-modeling",
"path": "gen/main/emf/org/sourcepit/common/modeling/Annotation.java",
"license": "apache-2.0",
"size": 7532
} | [
"org.eclipse.emf.ecore.EObject"
] | import org.eclipse.emf.ecore.EObject; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 2,203,721 |
public static void changeInitials(WBSModel wbsModel,
Map<String, String> initialsToChange) {
// update time data for any team members whose initials have changed.
// since it is possible for two team members to have swapped initials
// (or for larger cycles to exist), we perform the changes in 2 steps:
// (1) Rename the data from the old initials to something which is
// not a legal initials value, and is thus safe to avoid
// collisions with real data.
// (2) Rename the data from its interim value to the new initials.
for (String oldInitials : initialsToChange.keySet()) {
TeamMemberTimeColumn.changeInitials
(wbsModel, oldInitials, oldInitials + " ");
}
for (Map.Entry<String, String> me : initialsToChange.entrySet()) {
String oldInitials = me.getKey();
String newInitials = me.getValue();
TeamMemberTimeColumn.changeInitials
(wbsModel, oldInitials + " ", newInitials);
}
} | static void function(WBSModel wbsModel, Map<String, String> initialsToChange) { for (String oldInitials : initialsToChange.keySet()) { TeamMemberTimeColumn.changeInitials (wbsModel, oldInitials, oldInitials + " "); } for (Map.Entry<String, String> me : initialsToChange.entrySet()) { String oldInitials = me.getKey(); String newInitials = me.getValue(); TeamMemberTimeColumn.changeInitials (wbsModel, oldInitials + " ", newInitials); } } | /** Instances of this column use a team member's initials to store
* and retrieve data. Therefore, when the initials have changed for
* several team members, it is necessary to rename all of the data
* appropriately. This method performs that operation.
*/ | Instances of this column use a team member's initials to store and retrieve data. Therefore, when the initials have changed for several team members, it is necessary to rename all of the data appropriately. This method performs that operation | changeInitials | {
"repo_name": "superzadeh/processdash",
"path": "teamdash/src/teamdash/wbs/columns/TeamMemberTimeColumn.java",
"license": "gpl-3.0",
"size": 9290
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 687,135 |
public List<ListContainerItemInner> value() {
return this.value;
} | List<ListContainerItemInner> function() { return this.value; } | /**
* Get the value property: List of blobs containers returned.
*
* @return the value value.
*/ | Get the value property: List of blobs containers returned | value | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/resourcemanagerhybrid/azure-resourcemanager-storage/src/main/java/com/azure/resourcemanager/storage/models/ListContainerItems.java",
"license": "mit",
"size": 2025
} | [
"com.azure.resourcemanager.storage.fluent.models.ListContainerItemInner",
"java.util.List"
] | import com.azure.resourcemanager.storage.fluent.models.ListContainerItemInner; import java.util.List; | import com.azure.resourcemanager.storage.fluent.models.*; import java.util.*; | [
"com.azure.resourcemanager",
"java.util"
] | com.azure.resourcemanager; java.util; | 2,227,403 |
public static List<DiskImage> imagesSubtract(Iterable<DiskImage> images, Iterable<DiskImage> imagesToSubtract) {
List<DiskImage> subtract = new ArrayList<>();
for (DiskImage image : images) {
if (getDiskImageById(image.getId(), imagesToSubtract) == null) {
subtract.add(image);
}
}
return subtract;
} | static List<DiskImage> function(Iterable<DiskImage> images, Iterable<DiskImage> imagesToSubtract) { List<DiskImage> subtract = new ArrayList<>(); for (DiskImage image : images) { if (getDiskImageById(image.getId(), imagesToSubtract) == null) { subtract.add(image); } } return subtract; } | /**
* Returns the subtraction set of the specified image lists (based on images' IDs)
* @param images full list
* @param imagesToSubtract images to subtract list
* @return the subtraction set
*/ | Returns the subtraction set of the specified image lists (based on images' IDs) | imagesSubtract | {
"repo_name": "OpenUniversity/ovirt-engine",
"path": "backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/disk/image/ImagesHandler.java",
"license": "apache-2.0",
"size": 39979
} | [
"java.util.ArrayList",
"java.util.List",
"org.ovirt.engine.core.common.businessentities.storage.DiskImage"
] | import java.util.ArrayList; import java.util.List; import org.ovirt.engine.core.common.businessentities.storage.DiskImage; | import java.util.*; import org.ovirt.engine.core.common.businessentities.storage.*; | [
"java.util",
"org.ovirt.engine"
] | java.util; org.ovirt.engine; | 1,473,220 |
@Test
public void testDocAssemblerForImage() {
final boolean result = false;
batchInstanceId = prop.getProperty(TEST_CASE3_BATCH_INSTANCE_ID);
batchClassId = prop.getProperty(TEST_CASE3_BATCH_CLASS_ID);
boolean created = false;
BatchClass initialBatchClass = new BatchClass();
try {
BatchInstance batchInstance = batchInstanceService.getBatchInstanceByIdentifier(batchInstanceId);
if (null == batchInstance) {
batchInstance = new BatchInstance();
batchInstance.setIdentifier(batchInstanceId);
BatchClass batchClass = batchClassService.getBatchClassByIdentifier(batchClassId);
batchInstance.setBatchClass(batchClass);
batchInstanceService.createBatchInstance(batchInstance);
created = true;
} else {
initialBatchClass = batchInstance.getBatchClass();
BatchClass batchClass = batchClassService.getBatchClassByIdentifier(batchClassId);
batchInstance.setBatchClass(batchClass);
}
List<BatchClassPluginConfig> batchClassPluginConfigs = batchClassPluginConfigService.getAllPluginConfiguration(
batchInstanceId, DA_PLUGIN);
for (BatchClassPluginConfig batchClassPluginConfig : batchClassPluginConfigs) {
if (batchClassPluginConfig.getName().equals(DA_CLASSIFICATION)) {
initialClassification = batchClassPluginConfig.getValue();
batchClassPluginConfig.setValue(prop.getProperty(TEST_CASE3_CLASSIFICATION));
}
}
batchClassPluginConfigService.updatePluginConfiguration(batchClassPluginConfigs);
documentAssemblerService.createDocumentXml(new BatchInstanceID(batchInstanceId), null);
// compare two XML's
compareXMLs(actualOutputFolder, expectedOutputFolder, batchInstanceId);
} catch (DCMAException e) {
assertTrue(e.getMessage(), result);
} catch (Exception e) {
assertTrue(e.getMessage(), result);
} finally {
if (created) {
BatchInstance batchInstance = batchInstanceService.getBatchInstanceByIdentifier(batchInstanceId);
if (batchInstance != null) {
batchInstanceService.removeBatchInstance(batchInstance);
}
} else {
BatchInstance batchInstance = batchInstanceService.getBatchInstanceByIdentifier(batchInstanceId);
batchInstance.setBatchClass(initialBatchClass);
batchInstanceService.updateBatchInstance(batchInstance);
}
}
} | void function() { final boolean result = false; batchInstanceId = prop.getProperty(TEST_CASE3_BATCH_INSTANCE_ID); batchClassId = prop.getProperty(TEST_CASE3_BATCH_CLASS_ID); boolean created = false; BatchClass initialBatchClass = new BatchClass(); try { BatchInstance batchInstance = batchInstanceService.getBatchInstanceByIdentifier(batchInstanceId); if (null == batchInstance) { batchInstance = new BatchInstance(); batchInstance.setIdentifier(batchInstanceId); BatchClass batchClass = batchClassService.getBatchClassByIdentifier(batchClassId); batchInstance.setBatchClass(batchClass); batchInstanceService.createBatchInstance(batchInstance); created = true; } else { initialBatchClass = batchInstance.getBatchClass(); BatchClass batchClass = batchClassService.getBatchClassByIdentifier(batchClassId); batchInstance.setBatchClass(batchClass); } List<BatchClassPluginConfig> batchClassPluginConfigs = batchClassPluginConfigService.getAllPluginConfiguration( batchInstanceId, DA_PLUGIN); for (BatchClassPluginConfig batchClassPluginConfig : batchClassPluginConfigs) { if (batchClassPluginConfig.getName().equals(DA_CLASSIFICATION)) { initialClassification = batchClassPluginConfig.getValue(); batchClassPluginConfig.setValue(prop.getProperty(TEST_CASE3_CLASSIFICATION)); } } batchClassPluginConfigService.updatePluginConfiguration(batchClassPluginConfigs); documentAssemblerService.createDocumentXml(new BatchInstanceID(batchInstanceId), null); compareXMLs(actualOutputFolder, expectedOutputFolder, batchInstanceId); } catch (DCMAException e) { assertTrue(e.getMessage(), result); } catch (Exception e) { assertTrue(e.getMessage(), result); } finally { if (created) { BatchInstance batchInstance = batchInstanceService.getBatchInstanceByIdentifier(batchInstanceId); if (batchInstance != null) { batchInstanceService.removeBatchInstance(batchInstance); } } else { BatchInstance batchInstance = batchInstanceService.getBatchInstanceByIdentifier(batchInstanceId); batchInstance.setBatchClass(initialBatchClass); batchInstanceService.updateBatchInstance(batchInstance); } } } | /**
* Test a scenario for image document assembler.
*/ | Test a scenario for image document assembler | testDocAssemblerForImage | {
"repo_name": "ungerik/ephesoft",
"path": "Ephesoft_Community_Release_4.0.2.0/source/dcma-da/src/test/java/com/ephesoft/dcma/docassembler/DocumentAssemblerTest.java",
"license": "agpl-3.0",
"size": 15154
} | [
"com.ephesoft.dcma.core.DCMAException",
"com.ephesoft.dcma.da.domain.BatchClass",
"com.ephesoft.dcma.da.domain.BatchClassPluginConfig",
"com.ephesoft.dcma.da.domain.BatchInstance",
"com.ephesoft.dcma.da.id.BatchInstanceID",
"java.util.List"
] | import com.ephesoft.dcma.core.DCMAException; import com.ephesoft.dcma.da.domain.BatchClass; import com.ephesoft.dcma.da.domain.BatchClassPluginConfig; import com.ephesoft.dcma.da.domain.BatchInstance; import com.ephesoft.dcma.da.id.BatchInstanceID; import java.util.List; | import com.ephesoft.dcma.core.*; import com.ephesoft.dcma.da.domain.*; import com.ephesoft.dcma.da.id.*; import java.util.*; | [
"com.ephesoft.dcma",
"java.util"
] | com.ephesoft.dcma; java.util; | 1,356,211 |
private void
makeSuccessNotification(String fName, String lName, String boardingPosition,
@Nullable String gate, String origin, String destination) {
NotificationCompat.Builder mBuilder =
new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.ic_launcher)
.setContentTitle(lName)//getString(R.string.notification_title))
.setContentText(getString(R.string.notification_text_small, boardingPosition)
+ (gate == null ? "" : getString(R.string.notification_has_gate, gate)))
.setAutoCancel(true);
if (origin != null && destination != null) {
mBuilder.setStyle(new NotificationCompat.BigTextStyle()
.bigText(getString(R.string.notification_big_text, fName, lName, origin, destination, boardingPosition, gate)));
}
mBuilder.setContentIntent(PendingIntent.getActivity(getApplicationContext(), 0,
LaunchActivity.getLaunchIntent(getApplicationContext()), PendingIntent.FLAG_ONE_SHOT));
// Gets an instance of the NotificationManager service
NotificationManager mNotifyMgr =
(NotificationManager) getSystemService(NOTIFICATION_SERVICE);
// Builds the notification and issues it.
mNotifyMgr.notify(SUCCESS_NOTIFICATION_ID, mBuilder.build());
} | void function(String fName, String lName, String boardingPosition, @Nullable String gate, String origin, String destination) { NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this) .setSmallIcon(R.drawable.ic_launcher) .setContentTitle(lName) .setContentText(getString(R.string.notification_text_small, boardingPosition) + (gate == null ? "" : getString(R.string.notification_has_gate, gate))) .setAutoCancel(true); if (origin != null && destination != null) { mBuilder.setStyle(new NotificationCompat.BigTextStyle() .bigText(getString(R.string.notification_big_text, fName, lName, origin, destination, boardingPosition, gate))); } mBuilder.setContentIntent(PendingIntent.getActivity(getApplicationContext(), 0, LaunchActivity.getLaunchIntent(getApplicationContext()), PendingIntent.FLAG_ONE_SHOT)); NotificationManager mNotifyMgr = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); mNotifyMgr.notify(SUCCESS_NOTIFICATION_ID, mBuilder.build()); } | /**
* Creates the success notification. Clicking the notification does nothing.
*
* @param fName first name
* @param lName last name
* @param boardingPosition boarding position, eg "A01"
* @param gate name of gate, eg "C6"
* @param origin where the flight originates from
* @param destination where the flight is headed
* @throws IOException
*/ | Creates the success notification. Clicking the notification does nothing | makeSuccessNotification | {
"repo_name": "ajoshi/A-List",
"path": "app/src/main/java/biz/ajoshi/t1401654727/checkin/services/SWCheckinService.java",
"license": "apache-2.0",
"size": 14305
} | [
"android.app.NotificationManager",
"android.app.PendingIntent",
"android.support.annotation.Nullable",
"android.support.v4.app.NotificationCompat",
"biz.ajoshi.t1401654727.checkin.LaunchActivity"
] | import android.app.NotificationManager; import android.app.PendingIntent; import android.support.annotation.Nullable; import android.support.v4.app.NotificationCompat; import biz.ajoshi.t1401654727.checkin.LaunchActivity; | import android.app.*; import android.support.annotation.*; import android.support.v4.app.*; import biz.ajoshi.t1401654727.checkin.*; | [
"android.app",
"android.support",
"biz.ajoshi.t1401654727"
] | android.app; android.support; biz.ajoshi.t1401654727; | 786,662 |
@Override
protected void drawSymbol(Graphics2D g2, Rectangle r) {
g2.setStroke(ArchimateUtils.defaultStroke);
g2.setPaint(Color.BLACK);
// Draw left arc
g2.drawArc(r.x, r.y, (int)(0.3*r.width), r.height, 90, 180);
// Draw lines
g2.drawLine((int)(r.x+(0.15*r.width)), r.y, (int)(r.x+(0.7*r.width)), r.y);
g2.drawLine((int)(r.x+(0.15*r.width)), r.y+r.height, (int)(r.x+(0.7*r.width)), r.y+r.height);
// Draw circle
g2.drawOval((int)(r.x+(0.6*r.width)), r.y, (int)(0.3*r.width), r.height);
} | void function(Graphics2D g2, Rectangle r) { g2.setStroke(ArchimateUtils.defaultStroke); g2.setPaint(Color.BLACK); g2.drawArc(r.x, r.y, (int)(0.3*r.width), r.height, 90, 180); g2.drawLine((int)(r.x+(0.15*r.width)), r.y, (int)(r.x+(0.7*r.width)), r.y); g2.drawLine((int)(r.x+(0.15*r.width)), r.y+r.height, (int)(r.x+(0.7*r.width)), r.y+r.height); g2.drawOval((int)(r.x+(0.6*r.width)), r.y, (int)(0.3*r.width), r.height); } | /**
* Draws the symbol inside the given Rectangle.
* @param p
* @param d
*/ | Draws the symbol inside the given Rectangle | drawSymbol | {
"repo_name": "bptlab/processeditor",
"path": "src/net/frapu/code/visualization/archimate/BusinessRole.java",
"license": "apache-2.0",
"size": 1672
} | [
"java.awt.Color",
"java.awt.Graphics2D",
"java.awt.Rectangle"
] | import java.awt.Color; import java.awt.Graphics2D; import java.awt.Rectangle; | import java.awt.*; | [
"java.awt"
] | java.awt; | 2,055,741 |
BiConsumer<List<T>, K> getPartitionProcessor(); | BiConsumer<List<T>, K> getPartitionProcessor(); | /**
* Returns the partition processor associated with the window.
* @return partitionProcessor
*/ | Returns the partition processor associated with the window | getPartitionProcessor | {
"repo_name": "dlaboss/incubator-quarks",
"path": "api/window/src/main/java/org/apache/edgent/window/Window.java",
"license": "apache-2.0",
"size": 6504
} | [
"java.util.List",
"org.apache.edgent.function.BiConsumer"
] | import java.util.List; import org.apache.edgent.function.BiConsumer; | import java.util.*; import org.apache.edgent.function.*; | [
"java.util",
"org.apache.edgent"
] | java.util; org.apache.edgent; | 1,903,113 |
public void put(final CacheKey key, EncodedImage encodedImage) {
try {
if (FrescoSystrace.isTracing()) {
FrescoSystrace.beginSection("BufferedDiskCache#put");
}
Preconditions.checkNotNull(key);
Preconditions.checkArgument(EncodedImage.isValid(encodedImage));
// Store encodedImage in staging area
mStagingArea.put(key, encodedImage); | void function(final CacheKey key, EncodedImage encodedImage) { try { if (FrescoSystrace.isTracing()) { FrescoSystrace.beginSection(STR); } Preconditions.checkNotNull(key); Preconditions.checkArgument(EncodedImage.isValid(encodedImage)); mStagingArea.put(key, encodedImage); | /**
* Associates encodedImage with given key in disk cache. Disk write is performed on background
* thread, so the caller of this method is not blocked
*/ | Associates encodedImage with given key in disk cache. Disk write is performed on background thread, so the caller of this method is not blocked | put | {
"repo_name": "facebook/fresco",
"path": "imagepipeline/src/main/java/com/facebook/imagepipeline/cache/BufferedDiskCache.java",
"license": "mit",
"size": 17019
} | [
"com.facebook.cache.common.CacheKey",
"com.facebook.common.internal.Preconditions",
"com.facebook.imagepipeline.image.EncodedImage",
"com.facebook.imagepipeline.systrace.FrescoSystrace"
] | import com.facebook.cache.common.CacheKey; import com.facebook.common.internal.Preconditions; import com.facebook.imagepipeline.image.EncodedImage; import com.facebook.imagepipeline.systrace.FrescoSystrace; | import com.facebook.cache.common.*; import com.facebook.common.internal.*; import com.facebook.imagepipeline.image.*; import com.facebook.imagepipeline.systrace.*; | [
"com.facebook.cache",
"com.facebook.common",
"com.facebook.imagepipeline"
] | com.facebook.cache; com.facebook.common; com.facebook.imagepipeline; | 2,144,762 |
protected Object createObject(ResultSet rs) throws SQLException {
User user;
user = new User();
user.setId(rs.getInt(ID_COLUMN));
user.setName(rs.getString(NAME_COLUMN));
user.setLogin(rs.getString(LOGIN_COLUMN));
user.setPassword(rs.getString(PASSWORD_COLUMN));
user.setEmail(rs.getString(EMAIL_COLUMN));
user.setLanguage(rs.getString(LANGUAGE_COLUMN));
user.setEmailOnNewPhoto(rs.getInt(EMAIL_ON_NEW_PHOTO_COLUMN) == 1 ? true : false);
user.setEmailOnNewIdPhoto(rs.getInt(EMAIL_ON_NEW_ID_PHOTO_COLUMN) == 1 ? true : false);
user.setEmailOnNewSound(rs.getInt(EMAIL_ON_NEW_SOUND_COLUMN) == 1 ? true : false);
user.setAddPhoto(rs.getInt(ADD_PHOTO_COLUMN) == 1 ? true : false);
user.setAddSound(rs.getInt(ADD_SOUND_COLUMN) == 1 ? true : false);
user.setAdmin(rs.getBoolean(ADMIN_COLUMN));
return user;
}
| Object function(ResultSet rs) throws SQLException { User user; user = new User(); user.setId(rs.getInt(ID_COLUMN)); user.setName(rs.getString(NAME_COLUMN)); user.setLogin(rs.getString(LOGIN_COLUMN)); user.setPassword(rs.getString(PASSWORD_COLUMN)); user.setEmail(rs.getString(EMAIL_COLUMN)); user.setLanguage(rs.getString(LANGUAGE_COLUMN)); user.setEmailOnNewPhoto(rs.getInt(EMAIL_ON_NEW_PHOTO_COLUMN) == 1 ? true : false); user.setEmailOnNewIdPhoto(rs.getInt(EMAIL_ON_NEW_ID_PHOTO_COLUMN) == 1 ? true : false); user.setEmailOnNewSound(rs.getInt(EMAIL_ON_NEW_SOUND_COLUMN) == 1 ? true : false); user.setAddPhoto(rs.getInt(ADD_PHOTO_COLUMN) == 1 ? true : false); user.setAddSound(rs.getInt(ADD_SOUND_COLUMN) == 1 ? true : false); user.setAdmin(rs.getBoolean(ADMIN_COLUMN)); return user; } | /**
* This method creates a <code>User</code> object with the data from
* database
*
* @param rs
* The <code>ResultSet<code> object to retrieve the data
*
* @return A new <code>User</code> object
*
* @throws SQLException If an error occur while retrieving data from result set
*/ | This method creates a <code>User</code> object with the data from database | createObject | {
"repo_name": "BackupTheBerlios/arara-svn",
"path": "core/tags/arara-1.1/src/main/java/net/indrix/arara/dao/UserDAO.java",
"license": "gpl-2.0",
"size": 10572
} | [
"java.sql.ResultSet",
"java.sql.SQLException",
"net.indrix.arara.vo.User"
] | import java.sql.ResultSet; import java.sql.SQLException; import net.indrix.arara.vo.User; | import java.sql.*; import net.indrix.arara.vo.*; | [
"java.sql",
"net.indrix.arara"
] | java.sql; net.indrix.arara; | 1,322,342 |
@Override
public void visitCode(Code obj) {
unusedParms.clear();
regToParm.clear();
stack.resetForMethodEntry(this);
Method m = getMethod();
String methodName = m.getName();
if (IGNORE_METHODS.contains(methodName)) {
return;
}
int accessFlags = m.getAccessFlags();
if (((accessFlags & (Constants.ACC_STATIC | Constants.ACC_PRIVATE)) == 0) || ((accessFlags & Constants.ACC_SYNTHETIC) != 0)) {
return;
}
List<String> parmTypes = SignatureUtils.getParameterSignatures(m.getSignature());
if (parmTypes.isEmpty()) {
return;
}
int firstReg = 0;
if ((accessFlags & Constants.ACC_STATIC) == 0) {
++firstReg;
}
int reg = firstReg;
for (int i = 0; i < parmTypes.size(); ++i) {
unusedParms.set(reg);
regToParm.put(Integer.valueOf(reg), Integer.valueOf(i + 1));
String parmSig = parmTypes.get(i);
reg += SignatureUtils.getSignatureSize(parmSig);
}
try {
super.visitCode(obj);
if (!unusedParms.isEmpty()) {
LocalVariableTable lvt = m.getLocalVariableTable();
reg = unusedParms.nextSetBit(firstReg);
while (reg >= 0) {
LocalVariable lv = (lvt == null) ? null : lvt.getLocalVariable(reg, 0);
if (lv != null) {
String parmName = lv.getName();
bugReporter.reportBug(new BugInstance(this, BugType.UP_UNUSED_PARAMETER.name(), NORMAL_PRIORITY).addClass(this).addMethod(this)
.addString("Parameter " + regToParm.get(Integer.valueOf(reg)) + ": " + parmName));
}
reg = unusedParms.nextSetBit(reg + 1);
}
}
} catch (StopOpcodeParsingException e) {
// no unusedParms left
}
} | void function(Code obj) { unusedParms.clear(); regToParm.clear(); stack.resetForMethodEntry(this); Method m = getMethod(); String methodName = m.getName(); if (IGNORE_METHODS.contains(methodName)) { return; } int accessFlags = m.getAccessFlags(); if (((accessFlags & (Constants.ACC_STATIC Constants.ACC_PRIVATE)) == 0) ((accessFlags & Constants.ACC_SYNTHETIC) != 0)) { return; } List<String> parmTypes = SignatureUtils.getParameterSignatures(m.getSignature()); if (parmTypes.isEmpty()) { return; } int firstReg = 0; if ((accessFlags & Constants.ACC_STATIC) == 0) { ++firstReg; } int reg = firstReg; for (int i = 0; i < parmTypes.size(); ++i) { unusedParms.set(reg); regToParm.put(Integer.valueOf(reg), Integer.valueOf(i + 1)); String parmSig = parmTypes.get(i); reg += SignatureUtils.getSignatureSize(parmSig); } try { super.visitCode(obj); if (!unusedParms.isEmpty()) { LocalVariableTable lvt = m.getLocalVariableTable(); reg = unusedParms.nextSetBit(firstReg); while (reg >= 0) { LocalVariable lv = (lvt == null) ? null : lvt.getLocalVariable(reg, 0); if (lv != null) { String parmName = lv.getName(); bugReporter.reportBug(new BugInstance(this, BugType.UP_UNUSED_PARAMETER.name(), NORMAL_PRIORITY).addClass(this).addMethod(this) .addString(STR + regToParm.get(Integer.valueOf(reg)) + STR + parmName)); } reg = unusedParms.nextSetBit(reg + 1); } } } catch (StopOpcodeParsingException e) { } } | /**
* implements the visitor to clear the parm set, and check for potential methods
*
* @param obj
* the context object of the currently parsed code block
*/ | implements the visitor to clear the parm set, and check for potential methods | visitCode | {
"repo_name": "rblasch/fb-contrib",
"path": "src/main/java/com/mebigfatguy/fbcontrib/detect/UnusedParameter.java",
"license": "lgpl-2.1",
"size": 6417
} | [
"com.mebigfatguy.fbcontrib.utils.BugType",
"com.mebigfatguy.fbcontrib.utils.SignatureUtils",
"com.mebigfatguy.fbcontrib.utils.StopOpcodeParsingException",
"edu.umd.cs.findbugs.BugInstance",
"java.util.List",
"org.apache.bcel.Constants",
"org.apache.bcel.classfile.Code",
"org.apache.bcel.classfile.LocalVariable",
"org.apache.bcel.classfile.LocalVariableTable",
"org.apache.bcel.classfile.Method"
] | import com.mebigfatguy.fbcontrib.utils.BugType; import com.mebigfatguy.fbcontrib.utils.SignatureUtils; import com.mebigfatguy.fbcontrib.utils.StopOpcodeParsingException; import edu.umd.cs.findbugs.BugInstance; import java.util.List; import org.apache.bcel.Constants; import org.apache.bcel.classfile.Code; import org.apache.bcel.classfile.LocalVariable; import org.apache.bcel.classfile.LocalVariableTable; import org.apache.bcel.classfile.Method; | import com.mebigfatguy.fbcontrib.utils.*; import edu.umd.cs.findbugs.*; import java.util.*; import org.apache.bcel.*; import org.apache.bcel.classfile.*; | [
"com.mebigfatguy.fbcontrib",
"edu.umd.cs",
"java.util",
"org.apache.bcel"
] | com.mebigfatguy.fbcontrib; edu.umd.cs; java.util; org.apache.bcel; | 1,745,372 |
@SuppressWarnings("unchecked")
public static List<Integer> getAt(int[] array, ObjectRange range) {
return primitiveArrayGet(array, range);
} | @SuppressWarnings(STR) static List<Integer> function(int[] array, ObjectRange range) { return primitiveArrayGet(array, range); } | /**
* Support the subscript operator with an ObjectRange for an int array
*
* @param array an int array
* @param range an ObjectRange indicating the indices for the items to retrieve
* @return list of the retrieved ints
* @since 1.0
*/ | Support the subscript operator with an ObjectRange for an int array | getAt | {
"repo_name": "mv2a/yajsw",
"path": "src/groovy-patch/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java",
"license": "apache-2.0",
"size": 704164
} | [
"groovy.lang.ObjectRange",
"java.util.List"
] | import groovy.lang.ObjectRange; import java.util.List; | import groovy.lang.*; import java.util.*; | [
"groovy.lang",
"java.util"
] | groovy.lang; java.util; | 1,565,621 |
public List<Appliance> getAppliances() throws SUSEStudioException {
StudioConnection sc = new StudioConnection("/user/appliances", config);
Appliances result = sc.get(Appliances.class);
return result.getAppliances();
} | List<Appliance> function() throws SUSEStudioException { StudioConnection sc = new StudioConnection(STR, config); Appliances result = sc.get(Appliances.class); return result.getAppliances(); } | /**
* Get all appliances of the current user.
*
* GET /api/v2/user/appliances
*
* @return list of the current user's appliances
* @throws SUSEStudioException if SUSE Studio returns an error response
*/ | Get all appliances of the current user. GET /api/v2/user/appliances | getAppliances | {
"repo_name": "susestudio/susestudio-lib-java",
"path": "src/main/java/com/suse/studio/client/SUSEStudio.java",
"license": "mit",
"size": 17992
} | [
"com.suse.studio.client.exception.SUSEStudioException",
"com.suse.studio.client.model.Appliance",
"com.suse.studio.client.model.Appliances",
"com.suse.studio.client.net.StudioConnection",
"java.util.List"
] | import com.suse.studio.client.exception.SUSEStudioException; import com.suse.studio.client.model.Appliance; import com.suse.studio.client.model.Appliances; import com.suse.studio.client.net.StudioConnection; import java.util.List; | import com.suse.studio.client.exception.*; import com.suse.studio.client.model.*; import com.suse.studio.client.net.*; import java.util.*; | [
"com.suse.studio",
"java.util"
] | com.suse.studio; java.util; | 1,079,263 |
@Override
public void parseQuotientByteCode(Vertex state, DataInputStream dataStream, Network network) throws IOException {
float correctness = dataStream.readFloat();
long id = dataStream.readLong();
if (id == 0) {
return;
}
Object[] result = new Object[3];
result[0] = id;
parseArgumentByteCode(result, dataStream, null, network);
id = (Long)result[0];
Vertex element = (Vertex)result[2];
if (element == null) {
return;
}
Relationship relationship = state.addWeakRelationship(Primitive.QUOTIENT, element, correctness);
if (id == 0) {
return;
}
result[0] = id;
result[1] = null;
result[2] = null;
parseArgumentByteCode(result, dataStream, null, network);
id = (Long)result[0];
element = (Vertex)result[2];
if (element == null) {
return;
}
if (element.is(Primitive.PREVIOUS)) {
Vertex meta = network.createTemporyVertex();
relationship.setMeta(meta);
while (id > 0) {
result[0] = id;
result[1] = null;
result[2] = null;
parseArgumentByteCode(result, dataStream, null, network);
id = (Long)result[0];
element = (Vertex)result[2];
if (element != null) {
if (element.is(Primitive.NOT)) {
if (id == 0) {
return;
}
result[0] = id;
result[1] = null;
result[2] = null;
parseArgumentByteCode(result, dataStream, null, network);
id = (Long)result[0];
element = (Vertex)result[2];
if (element == null) {
continue;
}
meta.removeRelationship(Primitive.PREVIOUS, element);
} else {
meta.addRelationship(Primitive.PREVIOUS, element);
}
}
}
}
}
| void function(Vertex state, DataInputStream dataStream, Network network) throws IOException { float correctness = dataStream.readFloat(); long id = dataStream.readLong(); if (id == 0) { return; } Object[] result = new Object[3]; result[0] = id; parseArgumentByteCode(result, dataStream, null, network); id = (Long)result[0]; Vertex element = (Vertex)result[2]; if (element == null) { return; } Relationship relationship = state.addWeakRelationship(Primitive.QUOTIENT, element, correctness); if (id == 0) { return; } result[0] = id; result[1] = null; result[2] = null; parseArgumentByteCode(result, dataStream, null, network); id = (Long)result[0]; element = (Vertex)result[2]; if (element == null) { return; } if (element.is(Primitive.PREVIOUS)) { Vertex meta = network.createTemporyVertex(); relationship.setMeta(meta); while (id > 0) { result[0] = id; result[1] = null; result[2] = null; parseArgumentByteCode(result, dataStream, null, network); id = (Long)result[0]; element = (Vertex)result[2]; if (element != null) { if (element.is(Primitive.NOT)) { if (id == 0) { return; } result[0] = id; result[1] = null; result[2] = null; parseArgumentByteCode(result, dataStream, null, network); id = (Long)result[0]; element = (Vertex)result[2]; if (element == null) { continue; } meta.removeRelationship(Primitive.PREVIOUS, element); } else { meta.addRelationship(Primitive.PREVIOUS, element); } } } } } | /**
* Parse the GOTO bytecode.
*/ | Parse the GOTO bytecode | parseQuotientByteCode | {
"repo_name": "BOTlibre/BOTlibre",
"path": "ai-engine/source/org/botlibre/self/Self4Decompiler.java",
"license": "epl-1.0",
"size": 56442
} | [
"java.io.DataInputStream",
"java.io.IOException",
"org.botlibre.api.knowledge.Network",
"org.botlibre.api.knowledge.Relationship",
"org.botlibre.api.knowledge.Vertex",
"org.botlibre.knowledge.Primitive"
] | import java.io.DataInputStream; import java.io.IOException; import org.botlibre.api.knowledge.Network; import org.botlibre.api.knowledge.Relationship; import org.botlibre.api.knowledge.Vertex; import org.botlibre.knowledge.Primitive; | import java.io.*; import org.botlibre.api.knowledge.*; import org.botlibre.knowledge.*; | [
"java.io",
"org.botlibre.api",
"org.botlibre.knowledge"
] | java.io; org.botlibre.api; org.botlibre.knowledge; | 303,827 |
@Test
public void sendPersonOverStream() throws IOException {
outputStream.write(person.toByteArray());
outputStream.close();
Person recoveredPerson = wire.parseFrom(inputStream, Person.class);
assertEquals(name, recoveredPerson.name);
assertEquals(id, recoveredPerson.id);
assertEquals(person, recoveredPerson);
} | void function() throws IOException { outputStream.write(person.toByteArray()); outputStream.close(); Person recoveredPerson = wire.parseFrom(inputStream, Person.class); assertEquals(name, recoveredPerson.name); assertEquals(id, recoveredPerson.id); assertEquals(person, recoveredPerson); } | /**
* Test that we can read a protobuf object over a stream ONLY IF the object
* is the entire stream (stream closes after object).
*/ | Test that we can read a protobuf object over a stream ONLY IF the object is the entire stream (stream closes after object) | sendPersonOverStream | {
"repo_name": "casific/murmur",
"path": "unit test/WireTest.java",
"license": "apache-2.0",
"size": 8188
} | [
"java.io.IOException",
"org.junit.Assert"
] | import java.io.IOException; import org.junit.Assert; | import java.io.*; import org.junit.*; | [
"java.io",
"org.junit"
] | java.io; org.junit; | 2,248,172 |
public void listRemotePackages_NoGUI(boolean includeAll, boolean extendedOutput) {
List<ArchiveInfo> archives = getRemoteArchives_NoGUI(includeAll);
mSdkLog.info("Packages available for installation or update: %1$d\n", archives.size());
int index = 1;
for (ArchiveInfo ai : archives) {
Archive a = ai.getNewArchive();
if (a != null) {
Package p = a.getParentPackage();
if (p != null) {
if (extendedOutput) {
mSdkLog.info("----------\n");
mSdkLog.info("id: %1$d or \"%2$s\"\n", index, p.installId());
mSdkLog.info(" Type: %1$s\n",
p.getClass().getSimpleName().replaceAll("Package", "")); //$NON-NLS-1$ //$NON-NLS-2$
String desc = LineUtil.reformatLine(" Desc: %s\n",
p.getLongDescription());
mSdkLog.info("%s", desc); //$NON-NLS-1$
} else {
mSdkLog.info("%1$ 4d- %2$s\n",
index,
p.getShortDescription());
}
index++;
}
}
}
}
/**
* Tries to update all the *existing* local packages.
* This version is intended to run without a GUI and
* only outputs to the current {@link ILogger}.
*
* @param pkgFilter A list of {@link SdkRepoConstants#NODES} or {@link Package#installId()} | void function(boolean includeAll, boolean extendedOutput) { List<ArchiveInfo> archives = getRemoteArchives_NoGUI(includeAll); mSdkLog.info(STR, archives.size()); int index = 1; for (ArchiveInfo ai : archives) { Archive a = ai.getNewArchive(); if (a != null) { Package p = a.getParentPackage(); if (p != null) { if (extendedOutput) { mSdkLog.info(STR); mSdkLog.info(STR%2$s\"\n", index, p.installId()); mSdkLog.info(STR, p.getClass().getSimpleName().replaceAll(STR, STR Desc: %s\nSTR%sSTR%1$ 4d- %2$s\n", index, p.getShortDescription()); } index++; } } } } /** * Tries to update all the *existing* local packages. * This version is intended to run without a GUI and * only outputs to the current {@link ILogger}. * * @param pkgFilter A list of {@link SdkRepoConstants#NODES} or {@link Package#installId()} | /**
* Lists remote packages available for install using
* {@link UpdaterData#updateOrInstallAll_NoGUI}.
*
* @param includeAll True to list and install all packages, including obsolete ones.
* @param extendedOutput True to display more details on each package.
*/ | Lists remote packages available for install using <code>UpdaterData#updateOrInstallAll_NoGUI</code> | listRemotePackages_NoGUI | {
"repo_name": "rex-xxx/mt6572_x201",
"path": "sdk/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/UpdaterData.java",
"license": "gpl-2.0",
"size": 45714
} | [
"com.android.sdklib.internal.repository.archives.Archive",
"com.android.sdklib.internal.repository.packages.Package",
"com.android.sdklib.repository.SdkRepoConstants",
"com.android.utils.ILogger",
"java.util.List"
] | import com.android.sdklib.internal.repository.archives.Archive; import com.android.sdklib.internal.repository.packages.Package; import com.android.sdklib.repository.SdkRepoConstants; import com.android.utils.ILogger; import java.util.List; | import com.android.sdklib.internal.repository.archives.*; import com.android.sdklib.internal.repository.packages.*; import com.android.sdklib.repository.*; import com.android.utils.*; import java.util.*; | [
"com.android.sdklib",
"com.android.utils",
"java.util"
] | com.android.sdklib; com.android.utils; java.util; | 880,977 |
public void init (final String vertexShaderPath, final String fragmentShaderPath, final String lightingVertexShader, final String lightingFragmentShader) throws Exception {
if (isInitialized.get()) {
throw new IllegalStateException("UIRenderer was already initialized.");
}
//create new UI shader program
this.uiShaderProgram = new OpenGLShaderProgram();
System.out.println("HUD vertex shader:\n" + FileUtils.readFile(vertexShaderPath, StandardCharsets.UTF_8));
System.out.println("HUD fragment shader:\n" + FileUtils.readFile(fragmentShaderPath, StandardCharsets.UTF_8));
//add vertex shader
this.uiShaderProgram.setVertexShader(FileUtils.readFile(vertexShaderPath, StandardCharsets.UTF_8));//.setVertexShader(FileUtils.readFile(vertexShaderPath, StandardCharsets.UTF_8));
//add fragment shader
this.uiShaderProgram.setFragmentShader(FileUtils.readFile(fragmentShaderPath, StandardCharsets.UTF_8));
//.setFragmentShader(FileUtils.readFile(fragmentShaderPath, StandardCharsets.UTF_8));
//compile shader program
this.uiShaderProgram.link();
//create uniforms for ortographic model projection matrix and base color
this.uiShaderProgram.createUniform("projModelMatrix");
this.uiShaderProgram.createUniform("colour");
this.uiShaderProgram.createUniform("hasTexture");
//https://www.opengl.org/wiki/Texture
if (lightingInitialized.get()) {
//create uniforms for lighting
this.uiShaderProgram.createUniform("ambientColor");
//create uniform for resolution
this.uiShaderProgram.createUniform("resolution");
}
this.lightMapShaderPrgrogram = new OpenGLShaderProgram();
//add vertex shader
this.lightMapShaderPrgrogram.setVertexShader(FileUtils.readFile(lightingVertexShader, StandardCharsets.UTF_8));//.setVertexShader(FileUtils.readFile(vertexShaderPath, StandardCharsets.UTF_8));
//add fragment shader
this.lightMapShaderPrgrogram.setFragmentShader(FileUtils.readFile(lightingFragmentShader, StandardCharsets.UTF_8));
//compile shader program
this.lightMapShaderPrgrogram.link();
//create uniforms for ortographic model projection matrix and base color
this.lightMapShaderPrgrogram.createUniform("projModelMatrix");
this.lightMapShaderPrgrogram.createUniform("colour");
this.lightMapShaderPrgrogram.createUniform("hasTexture");
//create uniforms for lighting
this.lightMapShaderPrgrogram.createUniform("ambientColor");
this.isInitialized.set(true);
} | void function (final String vertexShaderPath, final String fragmentShaderPath, final String lightingVertexShader, final String lightingFragmentShader) throws Exception { if (isInitialized.get()) { throw new IllegalStateException(STR); } this.uiShaderProgram = new OpenGLShaderProgram(); System.out.println(STR + FileUtils.readFile(vertexShaderPath, StandardCharsets.UTF_8)); System.out.println(STR + FileUtils.readFile(fragmentShaderPath, StandardCharsets.UTF_8)); this.uiShaderProgram.setVertexShader(FileUtils.readFile(vertexShaderPath, StandardCharsets.UTF_8)); this.uiShaderProgram.setFragmentShader(FileUtils.readFile(fragmentShaderPath, StandardCharsets.UTF_8)); this.uiShaderProgram.link(); this.uiShaderProgram.createUniform(STR); this.uiShaderProgram.createUniform(STR); this.uiShaderProgram.createUniform(STR); if (lightingInitialized.get()) { this.uiShaderProgram.createUniform(STR); this.uiShaderProgram.createUniform(STR); } this.lightMapShaderPrgrogram = new OpenGLShaderProgram(); this.lightMapShaderPrgrogram.setVertexShader(FileUtils.readFile(lightingVertexShader, StandardCharsets.UTF_8)); this.lightMapShaderPrgrogram.setFragmentShader(FileUtils.readFile(lightingFragmentShader, StandardCharsets.UTF_8)); this.lightMapShaderPrgrogram.link(); this.lightMapShaderPrgrogram.createUniform(STR); this.lightMapShaderPrgrogram.createUniform(STR); this.lightMapShaderPrgrogram.createUniform(STR); this.lightMapShaderPrgrogram.createUniform(STR); this.isInitialized.set(true); } | /**
* initialize UI renderer
*/ | initialize UI renderer | init | {
"repo_name": "JuKu/rpg-2dgame-engine",
"path": "rpg-graphic-engine/src/main/java/com/jukusoft/rpg/graphic/opengl/renderer/UIRenderer.java",
"license": "apache-2.0",
"size": 15102
} | [
"com.jukusoft.rpg.core.utils.FileUtils",
"com.jukusoft.rpg.graphic.opengl.shader.OpenGLShaderProgram",
"java.nio.charset.StandardCharsets"
] | import com.jukusoft.rpg.core.utils.FileUtils; import com.jukusoft.rpg.graphic.opengl.shader.OpenGLShaderProgram; import java.nio.charset.StandardCharsets; | import com.jukusoft.rpg.core.utils.*; import com.jukusoft.rpg.graphic.opengl.shader.*; import java.nio.charset.*; | [
"com.jukusoft.rpg",
"java.nio"
] | com.jukusoft.rpg; java.nio; | 1,904,400 |
public void createArchetypeProject(IProject project, IPath location, Archetype archetype, String groupId,
String artifactId, String version, String javaPackage, Properties properties,
ProjectImportConfiguration configuration, IProgressMonitor monitor) throws CoreException {
monitor.beginTask(NLS.bind(Messages.ProjectConfigurationManager_task_creating_project1, project.getName()), 2);
IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
monitor.subTask(NLS.bind(Messages.ProjectConfigurationManager_task_executing_archetype, archetype.getGroupId(), archetype.getArtifactId()));
if(location == null) {
// if the project should be created in the workspace, figure out the path
location = workspaceRoot.getLocation();
}
try {
Artifact artifact = resolveArchetype(archetype, monitor);
ArchetypeGenerationRequest request = new ArchetypeGenerationRequest() //
.setTransferListener(maven.createTransferListener(monitor)) //
.setArchetypeGroupId(artifact.getGroupId()) //
.setArchetypeArtifactId(artifact.getArtifactId()) //
.setArchetypeVersion(artifact.getVersion()) //
.setArchetypeRepository(archetype.getRepository()) //
.setGroupId(groupId) //
.setArtifactId(artifactId) //
.setVersion(version) //
.setPackage(javaPackage) // the model does not have a package field
.setLocalRepository(maven.getLocalRepository()) //
.setRemoteArtifactRepositories(maven.getArtifactRepositories(true))
.setProperties(properties).setOutputDirectory(location.toPortableString());
MavenSession session = maven.createSession(maven.createExecutionRequest(monitor), null);
MavenSession oldSession = MavenPluginActivator.getDefault().setSession(session);
ArchetypeGenerationResult result;
try {
result = getArchetyper().generateProjectFromArchetype(request);
} finally {
MavenPluginActivator.getDefault().setSession(oldSession);
}
Exception cause = result.getCause();
if(cause != null) {
String msg = NLS.bind(Messages.ProjectConfigurationManager_error_unable_archetype, archetype.toString());
log.error(msg, cause);
throw new CoreException(new Status(IStatus.ERROR, IMavenConstants.PLUGIN_ID, -1, msg, cause));
}
monitor.worked(1);
// XXX Archetyper don't allow to specify project folder
String projectFolder = location.append(artifactId).toFile().getAbsolutePath();
LocalProjectScanner scanner = new LocalProjectScanner(workspaceRoot.getLocation().toFile(), //
projectFolder, true, mavenModelManager);
scanner.run(monitor);
Set<MavenProjectInfo> projectSet = collectProjects(scanner.getProjects());
importProjects(projectSet, configuration, monitor);
monitor.worked(1);
} catch (CoreException e) {
throw e;
} catch (InterruptedException e) {
throw new CoreException(Status.CANCEL_STATUS);
} catch (Exception ex) {
throw new CoreException(new Status(IStatus.ERROR, "org.eclipse.m2e", Messages.ProjectConfigurationManager_error_failed, ex)); //$NON-NLS-1$
}
} | void function(IProject project, IPath location, Archetype archetype, String groupId, String artifactId, String version, String javaPackage, Properties properties, ProjectImportConfiguration configuration, IProgressMonitor monitor) throws CoreException { monitor.beginTask(NLS.bind(Messages.ProjectConfigurationManager_task_creating_project1, project.getName()), 2); IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot(); monitor.subTask(NLS.bind(Messages.ProjectConfigurationManager_task_executing_archetype, archetype.getGroupId(), archetype.getArtifactId())); if(location == null) { location = workspaceRoot.getLocation(); } try { Artifact artifact = resolveArchetype(archetype, monitor); ArchetypeGenerationRequest request = new ArchetypeGenerationRequest() .setArchetypeGroupId(artifact.getGroupId()) .setArchetypeVersion(artifact.getVersion()) .setGroupId(groupId) .setVersion(version) .setLocalRepository(maven.getLocalRepository()) .setProperties(properties).setOutputDirectory(location.toPortableString()); MavenSession session = maven.createSession(maven.createExecutionRequest(monitor), null); MavenSession oldSession = MavenPluginActivator.getDefault().setSession(session); ArchetypeGenerationResult result; try { result = getArchetyper().generateProjectFromArchetype(request); } finally { MavenPluginActivator.getDefault().setSession(oldSession); } Exception cause = result.getCause(); if(cause != null) { String msg = NLS.bind(Messages.ProjectConfigurationManager_error_unable_archetype, archetype.toString()); log.error(msg, cause); throw new CoreException(new Status(IStatus.ERROR, IMavenConstants.PLUGIN_ID, -1, msg, cause)); } monitor.worked(1); String projectFolder = location.append(artifactId).toFile().getAbsolutePath(); LocalProjectScanner scanner = new LocalProjectScanner(workspaceRoot.getLocation().toFile(), scanner.run(monitor); Set<MavenProjectInfo> projectSet = collectProjects(scanner.getProjects()); importProjects(projectSet, configuration, monitor); monitor.worked(1); } catch (CoreException e) { throw e; } catch (InterruptedException e) { throw new CoreException(Status.CANCEL_STATUS); } catch (Exception ex) { throw new CoreException(new Status(IStatus.ERROR, STR, Messages.ProjectConfigurationManager_error_failed, ex)); } } | /**
* Creates project structure using Archetype and then imports created project
*/ | Creates project structure using Archetype and then imports created project | createArchetypeProject | {
"repo_name": "deathknight0718/foliage",
"path": "src/foliage-m2e/org.foliage.m2e.core/src/org/eclipse/m2e/core/internal/project/ProjectConfigurationManager.java",
"license": "apache-2.0",
"size": 33497
} | [
"java.util.Properties",
"java.util.Set",
"org.apache.maven.archetype.ArchetypeGenerationRequest",
"org.apache.maven.archetype.ArchetypeGenerationResult",
"org.apache.maven.archetype.catalog.Archetype",
"org.apache.maven.artifact.Artifact",
"org.apache.maven.execution.MavenSession",
"org.eclipse.core.resources.IProject",
"org.eclipse.core.resources.IWorkspaceRoot",
"org.eclipse.core.resources.ResourcesPlugin",
"org.eclipse.core.runtime.CoreException",
"org.eclipse.core.runtime.IPath",
"org.eclipse.core.runtime.IProgressMonitor",
"org.eclipse.core.runtime.IStatus",
"org.eclipse.core.runtime.Status",
"org.eclipse.m2e.core.internal.IMavenConstants",
"org.eclipse.m2e.core.internal.MavenPluginActivator",
"org.eclipse.m2e.core.internal.Messages",
"org.eclipse.m2e.core.project.LocalProjectScanner",
"org.eclipse.m2e.core.project.MavenProjectInfo",
"org.eclipse.m2e.core.project.ProjectImportConfiguration",
"org.eclipse.osgi.util.NLS"
] | import java.util.Properties; import java.util.Set; import org.apache.maven.archetype.ArchetypeGenerationRequest; import org.apache.maven.archetype.ArchetypeGenerationResult; import org.apache.maven.archetype.catalog.Archetype; import org.apache.maven.artifact.Artifact; import org.apache.maven.execution.MavenSession; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IWorkspaceRoot; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; import org.eclipse.m2e.core.internal.IMavenConstants; import org.eclipse.m2e.core.internal.MavenPluginActivator; import org.eclipse.m2e.core.internal.Messages; import org.eclipse.m2e.core.project.LocalProjectScanner; import org.eclipse.m2e.core.project.MavenProjectInfo; import org.eclipse.m2e.core.project.ProjectImportConfiguration; import org.eclipse.osgi.util.NLS; | import java.util.*; import org.apache.maven.archetype.*; import org.apache.maven.archetype.catalog.*; import org.apache.maven.artifact.*; import org.apache.maven.execution.*; import org.eclipse.core.resources.*; import org.eclipse.core.runtime.*; import org.eclipse.m2e.core.internal.*; import org.eclipse.m2e.core.project.*; import org.eclipse.osgi.util.*; | [
"java.util",
"org.apache.maven",
"org.eclipse.core",
"org.eclipse.m2e",
"org.eclipse.osgi"
] | java.util; org.apache.maven; org.eclipse.core; org.eclipse.m2e; org.eclipse.osgi; | 881,955 |
@Override
public void createFood(FoodEntity foodDto)
{
message.info("\n\n idUser:" +foodDto.getUserByIdUser().getId()+"\n\n");
this.save(foodDto.getMacrosEntity());
this.save(foodDto);
} | void function(FoodEntity foodDto) { message.info(STR +foodDto.getUserByIdUser().getId()+"\n\n"); this.save(foodDto.getMacrosEntity()); this.save(foodDto); } | /**
* <h1>crearFood</h1>
* <p>Guarda el objeto pasado como parametro</p>
*
* @param foodDto objeto que sera guardado en la base de datos
*/ | crearFood Guarda el objeto pasado como parametro | createFood | {
"repo_name": "tomas-93/My-Macros",
"path": "Repository/src/main/java/com/mymacros/repository/dao/implement/database/FoodDataBaseImplementDao.java",
"license": "apache-2.0",
"size": 3010
} | [
"com.mymacros.database.entity.FoodEntity"
] | import com.mymacros.database.entity.FoodEntity; | import com.mymacros.database.entity.*; | [
"com.mymacros.database"
] | com.mymacros.database; | 1,231,607 |
public void setIconSolid(boolean _iconSolid) {
if (_iconSolid) {
AddResourcesListener.setFontAwesomeVersion(5, this);
}
getStateHelper().put(PropertyKeys.iconSolid, _iconSolid);
} | void function(boolean _iconSolid) { if (_iconSolid) { AddResourcesListener.setFontAwesomeVersion(5, this); } getStateHelper().put(PropertyKeys.iconSolid, _iconSolid); } | /**
* Use the free font of FontAwesome 5. As a side effect, every FontAwesome icon on the same page is switched to FontAwesome 5.2.0. By default, the icon set is the older version 4.7.0. <P>
* Usually this method is called internally by the JSF engine.
*/ | Use the free font of FontAwesome 5. As a side effect, every FontAwesome icon on the same page is switched to FontAwesome 5.2.0. By default, the icon set is the older version 4.7.0. Usually this method is called internally by the JSF engine | setIconSolid | {
"repo_name": "chongma/BootsFaces-OSP",
"path": "src/main/java/net/bootsfaces/component/link/Link.java",
"license": "apache-2.0",
"size": 50298
} | [
"net.bootsfaces.listeners.AddResourcesListener"
] | import net.bootsfaces.listeners.AddResourcesListener; | import net.bootsfaces.listeners.*; | [
"net.bootsfaces.listeners"
] | net.bootsfaces.listeners; | 2,109,683 |
public String getStreetNumberFromAddressString(String addressString) {
int index = TextSoap.getIndexOfFirstNumberInString(addressString);
if (index != -1) {
return addressString.substring(index, addressString.length()).trim();
}
return null;
} | String function(String addressString) { int index = TextSoap.getIndexOfFirstNumberInString(addressString); if (index != -1) { return addressString.substring(index, addressString.length()).trim(); } return null; } | /**
* Gets the streetnumber from a string with the format.<br>
* "Streetname Number ..." e.g. "My Street 24" would return "24".<br>
*
* @return Finds the first number in the string and returns a substring from
* that point or null if no number found
*/ | Gets the streetnumber from a string with the format. "Streetname Number ..." e.g. "My Street 24" would return "24" | getStreetNumberFromAddressString | {
"repo_name": "grimurjonsson/com.idega.core",
"path": "src/java/com/idega/core/location/business/AddressBusinessBean.java",
"license": "gpl-3.0",
"size": 14083
} | [
"com.idega.util.text.TextSoap"
] | import com.idega.util.text.TextSoap; | import com.idega.util.text.*; | [
"com.idega.util"
] | com.idega.util; | 530,147 |
public void testTwoInOneOutProc() throws SQLException
{
CallableStatement cs = prepareCall
("call TWO_IN_ONE_OUT_PROC (?, ?, ?)");
cs.setInt(1, 6);
cs.setInt(2, 9);
cs.registerOutParameter (3, java.sql.Types.INTEGER);
cs.execute();
assertEquals("Sum of 6 and 9", 15, cs.getInt(3));
} | void function() throws SQLException { CallableStatement cs = prepareCall (STR); cs.setInt(1, 6); cs.setInt(2, 9); cs.registerOutParameter (3, java.sql.Types.INTEGER); cs.execute(); assertEquals(STR, 15, cs.getInt(3)); } | /**
* Calls a SQL procedure with two input parameters and one output.
* @throws SQLException
*/ | Calls a SQL procedure with two input parameters and one output | testTwoInOneOutProc | {
"repo_name": "splicemachine/spliceengine",
"path": "db-testing/src/test/java/com/splicemachine/dbTesting/functionTests/tests/jdbcapi/CallableTest.java",
"license": "agpl-3.0",
"size": 43760
} | [
"java.sql.CallableStatement",
"java.sql.SQLException",
"java.sql.Types"
] | import java.sql.CallableStatement; import java.sql.SQLException; import java.sql.Types; | import java.sql.*; | [
"java.sql"
] | java.sql; | 1,559,330 |
protected String getEnabledUserPassword(String userName) throws StartException, IOException {
return getValueFromProperty(userName, values.getUserFiles().get(0).getAbsolutePath());
} | String function(String userName) throws StartException, IOException { return getValueFromProperty(userName, values.getUserFiles().get(0).getAbsolutePath()); } | /**
* Get the password of the enabled user.<br/>
* Read the properties users file and return the password of the user
*
* @param userName The name of the user
* @return The password of the user
* @throws StartException
* @throws IOException
*/ | Get the password of the enabled user. Read the properties users file and return the password of the user | getEnabledUserPassword | {
"repo_name": "jamezp/wildfly-core",
"path": "domain-management/src/test/java/org/jboss/as/domain/management/security/adduser/PropertyTestHelper.java",
"license": "lgpl-2.1",
"size": 11357
} | [
"java.io.IOException",
"org.jboss.msc.service.StartException"
] | import java.io.IOException; import org.jboss.msc.service.StartException; | import java.io.*; import org.jboss.msc.service.*; | [
"java.io",
"org.jboss.msc"
] | java.io; org.jboss.msc; | 1,975,172 |
boolean onShoveEnd();
}
private static final long MULTITOUCH_BUFFER_TIME = 256; // milliseconds
private static final long DOUBLE_TAP_TIMEOUT = ViewConfiguration.getDoubleTapTimeout(); // milliseconds
private GestureDetector panTapGestureDetector;
private ScaleGestureDetector scaleGestureDetector;
private RotateGestureDetector rotateGestureDetector;
private ShoveGestureDetector shoveGestureDetector;
private TapResponder tapResponder;
private DoubleTapResponder doubleTapResponder;
private LongPressResponder longPressResponder;
private PanResponder panResponder;
private ScaleResponder scaleResponder;
private RotateResponder rotateResponder;
private ShoveResponder shoveResponder;
private EnumSet<Gestures> enabledGestures;
private EnumSet<Gestures> detectedGestures;
private EnumMap<Gestures, EnumSet<Gestures>> allowedSimultaneousGestures;
private long lastMultiTouchEndTime = -MULTITOUCH_BUFFER_TIME;
public TouchInput(Context context) {
this.panTapGestureDetector = new GestureDetector(context, new GestureListener());
this.scaleGestureDetector = new ScaleGestureDetector(context, new ScaleGestureListener());
this.rotateGestureDetector = new RotateGestureDetector(context, new RotateGestureListener());
this.shoveGestureDetector = new ShoveGestureDetector(context, new ShoveGestureListener());
this.enabledGestures = EnumSet.allOf(Gestures.class);
this.detectedGestures = EnumSet.noneOf(Gestures.class);
this.allowedSimultaneousGestures = new EnumMap<>(Gestures.class);
// By default, all gestures are allowed to detect simultaneously
for (Gestures g : Gestures.values()) {
allowedSimultaneousGestures.put(g, EnumSet.allOf(Gestures.class));
}
} | boolean onShoveEnd(); } private static final long MULTITOUCH_BUFFER_TIME = 256; private static final long DOUBLE_TAP_TIMEOUT = ViewConfiguration.getDoubleTapTimeout(); private GestureDetector panTapGestureDetector; private ScaleGestureDetector scaleGestureDetector; private RotateGestureDetector rotateGestureDetector; private ShoveGestureDetector shoveGestureDetector; private TapResponder tapResponder; private DoubleTapResponder doubleTapResponder; private LongPressResponder longPressResponder; private PanResponder panResponder; private ScaleResponder scaleResponder; private RotateResponder rotateResponder; private ShoveResponder shoveResponder; private EnumSet<Gestures> enabledGestures; private EnumSet<Gestures> detectedGestures; private EnumMap<Gestures, EnumSet<Gestures>> allowedSimultaneousGestures; private long lastMultiTouchEndTime = -MULTITOUCH_BUFFER_TIME; public TouchInput(Context context) { this.panTapGestureDetector = new GestureDetector(context, new GestureListener()); this.scaleGestureDetector = new ScaleGestureDetector(context, new ScaleGestureListener()); this.rotateGestureDetector = new RotateGestureDetector(context, new RotateGestureListener()); this.shoveGestureDetector = new ShoveGestureDetector(context, new ShoveGestureListener()); this.enabledGestures = EnumSet.allOf(Gestures.class); this.detectedGestures = EnumSet.noneOf(Gestures.class); this.allowedSimultaneousGestures = new EnumMap<>(Gestures.class); for (Gestures g : Gestures.values()) { allowedSimultaneousGestures.put(g, EnumSet.allOf(Gestures.class)); } } | /**
* Called when Shove Gesture ends
* @return True if the event is consumed, false if the event should continue to propagate
*/ | Called when Shove Gesture ends | onShoveEnd | {
"repo_name": "tangrams/tangram-es",
"path": "platforms/android/tangram/src/main/java/com/mapzen/tangram/TouchInput.java",
"license": "mit",
"size": 22943
} | [
"android.content.Context",
"android.view.GestureDetector",
"android.view.ScaleGestureDetector",
"android.view.ViewConfiguration",
"com.almeros.android.multitouch.RotateGestureDetector",
"com.almeros.android.multitouch.ShoveGestureDetector",
"java.util.EnumMap",
"java.util.EnumSet"
] | import android.content.Context; import android.view.GestureDetector; import android.view.ScaleGestureDetector; import android.view.ViewConfiguration; import com.almeros.android.multitouch.RotateGestureDetector; import com.almeros.android.multitouch.ShoveGestureDetector; import java.util.EnumMap; import java.util.EnumSet; | import android.content.*; import android.view.*; import com.almeros.android.multitouch.*; import java.util.*; | [
"android.content",
"android.view",
"com.almeros.android",
"java.util"
] | android.content; android.view; com.almeros.android; java.util; | 837,904 |
public void print(PrintWriter out, CodeStyle style, int indent) {
if (comment != null) {
out.println();
comment.print(out, style, indent);
}
out.print(style.getIndent(indent));
out.print(name);
if (value != null) {
out.print(" = ");
out.print(value);
}
if (this != last) {
out.print(",");
}
out.println();
}
} | void function(PrintWriter out, CodeStyle style, int indent) { if (comment != null) { out.println(); comment.print(out, style, indent); } out.print(style.getIndent(indent)); out.print(name); if (value != null) { out.print(STR); out.print(value); } if (this != last) { out.print(","); } out.println(); } } | /**
* Prints the code element to the specified output stream.
*
* @param out the output stream
* @param style the code style to use
* @param indent the indentation level
*/ | Prints the code element to the specified output stream | print | {
"repo_name": "runner-mei/mibble",
"path": "src/main/java/net/percederberg/grammatica/code/csharp/CSharpEnumeration.java",
"license": "gpl-2.0",
"size": 6974
} | [
"java.io.PrintWriter",
"net.percederberg.grammatica.code.CodeStyle"
] | import java.io.PrintWriter; import net.percederberg.grammatica.code.CodeStyle; | import java.io.*; import net.percederberg.grammatica.code.*; | [
"java.io",
"net.percederberg.grammatica"
] | java.io; net.percederberg.grammatica; | 171,578 |
public static void checkSuperuserPrivilege(UserGroupInformation owner,
String supergroup)
throws AccessControlException {
FSPermissionChecker checker =
new FSPermissionChecker(owner.getShortUserName(), supergroup);
if (!checker.isSuper) {
throw new AccessControlException("Access denied for user "
+ checker.user + ". Superuser privilege is required");
}
} | static void function(UserGroupInformation owner, String supergroup) throws AccessControlException { FSPermissionChecker checker = new FSPermissionChecker(owner.getShortUserName(), supergroup); if (!checker.isSuper) { throw new AccessControlException(STR + checker.user + STR); } } | /**
* Verify if the caller has the required permission. This will result into
* an exception if the caller is not allowed to access the resource.
* @param owner owner of the system
* @param supergroup supergroup of the system
*/ | Verify if the caller has the required permission. This will result into an exception if the caller is not allowed to access the resource | checkSuperuserPrivilege | {
"repo_name": "cumulusyebl/cumulus",
"path": "src/java/org/apache/hadoop/hdfs/server/namenode/FSPermissionChecker.java",
"license": "apache-2.0",
"size": 8206
} | [
"org.apache.hadoop.security.AccessControlException",
"org.apache.hadoop.security.UserGroupInformation"
] | import org.apache.hadoop.security.AccessControlException; import org.apache.hadoop.security.UserGroupInformation; | import org.apache.hadoop.security.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 2,544,863 |
protected boolean validateVdsCluster() {
VDSGroup vdsGroup = getVdsGroupDao().get(getVdsGroupId());
return vdsGroup == null ?
failCanDoAction(EngineMessage.VDS_CLUSTER_IS_NOT_VALID)
: vdsGroup.getArchitecture() != getVm().getClusterArch() ?
failCanDoAction(EngineMessage.ACTION_TYPE_FAILED_VM_CANNOT_IMPORT_VM_ARCHITECTURE_NOT_SUPPORTED_BY_CLUSTER)
: true;
} | boolean function() { VDSGroup vdsGroup = getVdsGroupDao().get(getVdsGroupId()); return vdsGroup == null ? failCanDoAction(EngineMessage.VDS_CLUSTER_IS_NOT_VALID) : vdsGroup.getArchitecture() != getVm().getClusterArch() ? failCanDoAction(EngineMessage.ACTION_TYPE_FAILED_VM_CANNOT_IMPORT_VM_ARCHITECTURE_NOT_SUPPORTED_BY_CLUSTER) : true; } | /**
* Validates that that the required cluster exists and is compatible
* @return <code>true</code> if the validation passes, <code>false</code> otherwise.
*/ | Validates that that the required cluster exists and is compatible | validateVdsCluster | {
"repo_name": "jtux270/translate",
"path": "ovirt/3.6_source/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImportVmCommandBase.java",
"license": "gpl-3.0",
"size": 23237
} | [
"org.ovirt.engine.core.common.businessentities.VDSGroup",
"org.ovirt.engine.core.common.errors.EngineMessage"
] | import org.ovirt.engine.core.common.businessentities.VDSGroup; import org.ovirt.engine.core.common.errors.EngineMessage; | import org.ovirt.engine.core.common.businessentities.*; import org.ovirt.engine.core.common.errors.*; | [
"org.ovirt.engine"
] | org.ovirt.engine; | 2,696,785 |
protected String getRecipient() {
return parameterService.getParameterValueAsString(AwardDocument.class,
Constants.REPORT_TRACKING_NOTIFICATIONS_BATCH_RECIPIENT);
} | String function() { return parameterService.getParameterValueAsString(AwardDocument.class, Constants.REPORT_TRACKING_NOTIFICATIONS_BATCH_RECIPIENT); } | /**
* This method gets the recipient specified in the parameter.
*
* @return
*/ | This method gets the recipient specified in the parameter | getRecipient | {
"repo_name": "vivantech/kc_fixes",
"path": "src/main/java/org/kuali/kra/award/paymentreports/awardreports/reporting/service/ReportTrackingNotificationJobDetail.java",
"license": "apache-2.0",
"size": 6784
} | [
"org.kuali.kra.award.document.AwardDocument",
"org.kuali.kra.infrastructure.Constants"
] | import org.kuali.kra.award.document.AwardDocument; import org.kuali.kra.infrastructure.Constants; | import org.kuali.kra.award.document.*; import org.kuali.kra.infrastructure.*; | [
"org.kuali.kra"
] | org.kuali.kra; | 70,332 |
public static synchronized void LogDebug(File root, String message, LogLevel level, boolean printScreen) throws IOException {
//If debug mode is on in the prefs, we want to log this to the screen too
if (Prefs.DebugMode() || Prefs.ShowWarnings() || level == LogLevel.ERROR) {
String color = "";
Level lev = Level.INFO;
boolean show = false;
switch (level) {
case ERROR:
color = TermColors.RED;
lev = Level.SEVERE;
show = true;
break;
case WARNING:
color = TermColors.YELLOW;
lev = Level.WARNING;
if (Prefs.DebugMode() || Prefs.ShowWarnings()) {
show = true;
}
break;
case INFO:
color = TermColors.GREEN;
lev = Level.INFO;
if (Prefs.DebugMode()) {
show = true;
}
break;
case DEBUG:
color = TermColors.BRIGHT_BLUE;
lev = Level.INFO;
if (Prefs.DebugMode()) {
show = true;
}
break;
case VERBOSE:
color = TermColors.WHITE;
lev = Level.INFO;
if (Prefs.DebugMode()) {
show = true;
}
break;
}
if (show && printScreen) {
Static.getLogger().log(lev, "{0}{1}{2}", new Object[]{color, message, TermColors.reset()});
}
}
String timestamp = DateUtils.ParseCalendarNotation("%Y-%M-%D %h:%m.%s - ");
QuickAppend(Static.debugLogFile(root), timestamp + message + Static.LF());
} | static synchronized void function(File root, String message, LogLevel level, boolean printScreen) throws IOException { if (Prefs.DebugMode() Prefs.ShowWarnings() level == LogLevel.ERROR) { String color = STR{0}{1}{2}STR%Y-%M-%D %h:%m.%s - "); QuickAppend(Static.debugLogFile(root), timestamp + message + Static.LF()); } | /**
* Logs an error message, depending on the log level of the message and the
* user's preferences.
*
* @param root
* @param message
* @param level
* @param printScreen If true, the message (if otherwise shown) will be
* printed to the screen. If false, it never will be, though it will still
* be logged to the log file.
* @throws IOException
*/ | Logs an error message, depending on the log level of the message and the user's preferences | LogDebug | {
"repo_name": "Murreey/CommandHelper",
"path": "src/main/java/com/laytonsmith/core/Static.java",
"license": "gpl-3.0",
"size": 51833
} | [
"java.io.File",
"java.io.IOException"
] | import java.io.File; import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,868,548 |
@Column(name = "name", unique = true, nullable = false)
public String getName();
// -------------------------------------------------------------------------
// FROM and INTO
// ------------------------------------------------------------------------- | @Column(name = "name", unique = true, nullable = false) String function(); | /**
* Getter for <code>public.group.name</code>.
*/ | Getter for <code>public.group.name</code> | getName | {
"repo_name": "nickguletskii/OpenOlympus",
"path": "src-gen/main/java/org/ng200/openolympus/jooq/tables/interfaces/IGroup.java",
"license": "mit",
"size": 2780
} | [
"javax.persistence.Column"
] | import javax.persistence.Column; | import javax.persistence.*; | [
"javax.persistence"
] | javax.persistence; | 2,710,044 |
List<MsixPackageApplications> packageApplications(); | List<MsixPackageApplications> packageApplications(); | /**
* Gets the packageApplications property: List of package applications.
*
* @return the packageApplications value.
*/ | Gets the packageApplications property: List of package applications | packageApplications | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/MsixPackage.java",
"license": "mit",
"size": 13792
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,939,387 |
public void testFacetByTokenCount() throws IOException {
init();
String facetField = randomFrom(Arrays.asList(
"foo.token_count", "foo.token_count_unstored", "foo.token_count_with_doc_values"));
SearchResponse result = searchByNumericRange(1, 10)
.addAggregation(AggregationBuilders.terms("facet").field(facetField)).get();
assertSearchReturns(result, "single", "bulk1", "bulk2", "multi", "multibulk1", "multibulk2");
assertThat(result.getAggregations().asList().size(), equalTo(1));
Terms terms = (Terms) result.getAggregations().asList().get(0);
assertThat(terms.getBuckets().size(), equalTo(9));
} | void function() throws IOException { init(); String facetField = randomFrom(Arrays.asList( STR, STR, STR)); SearchResponse result = searchByNumericRange(1, 10) .addAggregation(AggregationBuilders.terms("facet").field(facetField)).get(); assertSearchReturns(result, STR, "bulk1", "bulk2", "multi", STR, STR); assertThat(result.getAggregations().asList().size(), equalTo(1)); Terms terms = (Terms) result.getAggregations().asList().get(0); assertThat(terms.getBuckets().size(), equalTo(9)); } | /**
* It is possible to search by token count.
*/ | It is possible to search by token count | testFacetByTokenCount | {
"repo_name": "masaruh/elasticsearch",
"path": "modules/mapper-extras/src/test/java/org/elasticsearch/index/mapper/TokenCountFieldMapperIntegrationIT.java",
"license": "apache-2.0",
"size": 11048
} | [
"java.io.IOException",
"java.util.Arrays",
"org.elasticsearch.action.search.SearchResponse",
"org.elasticsearch.search.aggregations.AggregationBuilders",
"org.elasticsearch.search.aggregations.bucket.terms.Terms",
"org.hamcrest.Matchers"
] | import java.io.IOException; import java.util.Arrays; import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.search.aggregations.AggregationBuilders; import org.elasticsearch.search.aggregations.bucket.terms.Terms; import org.hamcrest.Matchers; | import java.io.*; import java.util.*; import org.elasticsearch.action.search.*; import org.elasticsearch.search.aggregations.*; import org.elasticsearch.search.aggregations.bucket.terms.*; import org.hamcrest.*; | [
"java.io",
"java.util",
"org.elasticsearch.action",
"org.elasticsearch.search",
"org.hamcrest"
] | java.io; java.util; org.elasticsearch.action; org.elasticsearch.search; org.hamcrest; | 1,046,263 |
@Test
public void test_getReport() throws Exception {
CurrentSuspenseReportResponse response = instance.getReport(new CurrentSuspenseReportRequest());
assertNotNull(response); | void function() throws Exception { CurrentSuspenseReportResponse response = instance.getReport(new CurrentSuspenseReportRequest()); assertNotNull(response); | /**
* <p>
* Accuracy test for the method <code>getReport(CurrentSuspenseReportRequest request)</code>.<br>
* The result should be correct.
* </p>
*
* @throws Exception to JUnit.
*/ | Accuracy test for the method <code>getReport(CurrentSuspenseReportRequest request)</code>. The result should be correct. | test_getReport | {
"repo_name": "NASA-Tournament-Lab/CoECI-OPM-Service-Credit-Redeposit-Deposit-Application",
"path": "Code/SCRD_BRE/src/java/tests/gov/opm/scrd/services/impl/reporting/CurrentSuspenseReportServiceTests.java",
"license": "apache-2.0",
"size": 5617
} | [
"gov.opm.scrd.services.impl.reporting.CurrentSuspenseReportRequest",
"gov.opm.scrd.services.impl.reporting.CurrentSuspenseReportResponse",
"org.junit.Assert"
] | import gov.opm.scrd.services.impl.reporting.CurrentSuspenseReportRequest; import gov.opm.scrd.services.impl.reporting.CurrentSuspenseReportResponse; import org.junit.Assert; | import gov.opm.scrd.services.impl.reporting.*; import org.junit.*; | [
"gov.opm.scrd",
"org.junit"
] | gov.opm.scrd; org.junit; | 1,867,008 |
public Shape getShape() {
return this.shape;
}
| Shape function() { return this.shape; } | /**
* Returns the shape.
*
* @return The shape.
*
* @see #setShape(Shape)
*/ | Returns the shape | getShape | {
"repo_name": "greearb/jfreechart-fse-ct",
"path": "src/main/java/org/jfree/chart/title/LegendGraphic.java",
"license": "lgpl-2.1",
"size": 23216
} | [
"java.awt.Shape"
] | import java.awt.Shape; | import java.awt.*; | [
"java.awt"
] | java.awt; | 1,769,664 |
public KeyNamePair getKeyNamePair()
{
return new KeyNamePair(get_ID(), String.valueOf(getA_Asset_Change_ID()));
} | KeyNamePair function() { return new KeyNamePair(get_ID(), String.valueOf(getA_Asset_Change_ID())); } | /** Get Record ID/ColumnName
@return ID/ColumnName pair
*/ | Get Record ID/ColumnName | getKeyNamePair | {
"repo_name": "erpcya/adempierePOS",
"path": "base/src/org/compiere/model/X_A_Asset_Change.java",
"license": "gpl-2.0",
"size": 44348
} | [
"org.compiere.util.KeyNamePair"
] | import org.compiere.util.KeyNamePair; | import org.compiere.util.*; | [
"org.compiere.util"
] | org.compiere.util; | 1,951,079 |
public JobSettings withRemoteStart(ModeCommand.RemoteStart remoteStart) {
this.remoteStart = remoteStart;
return this;
} | JobSettings function(ModeCommand.RemoteStart remoteStart) { this.remoteStart = remoteStart; return this; } | /**
* Sets the desired 'remote start' settings for the job.
*
* @param remoteStart - The 'remote start' settings. See {@link ModeCommand.RemoteStart} for the allowed modes.
*/ | Sets the desired 'remote start' settings for the job | withRemoteStart | {
"repo_name": "aogorek/openhab2-addons",
"path": "addons/binding/org.openhab.binding.robonect/src/main/java/org/openhab/binding/robonect/internal/RobonectClient.java",
"license": "epl-1.0",
"size": 12778
} | [
"org.openhab.binding.robonect.internal.model.cmd.ModeCommand"
] | import org.openhab.binding.robonect.internal.model.cmd.ModeCommand; | import org.openhab.binding.robonect.internal.model.cmd.*; | [
"org.openhab.binding"
] | org.openhab.binding; | 1,833,963 |
public static void close() {
if (reader != null) {
try {
reader.close();
} catch (IOException e) {
LOG.error("Not able to free Lucene index file.");
e.printStackTrace();
}
}
reader = null;
if (boboIndexReader != null) {
try {
boboIndexReader.close();
} catch (IOException e) {
LOG.error("Not able to close bobo Index Reader (Lucene).");
e.printStackTrace();
}
}
boboIndexReader = null;
indexingQueue = null;
index = null;
properties = null;
tempDirectory = null;
specialReferences = null;
ignoredClasses = null;
ignoredFields = null;
classBoost = null;
facets = null;
attributePrefixes = null;
} | static void function() { if (reader != null) { try { reader.close(); } catch (IOException e) { LOG.error(STR); e.printStackTrace(); } } reader = null; if (boboIndexReader != null) { try { boboIndexReader.close(); } catch (IOException e) { LOG.error(STR); e.printStackTrace(); } } boboIndexReader = null; indexingQueue = null; index = null; properties = null; tempDirectory = null; specialReferences = null; ignoredClasses = null; ignoredFields = null; classBoost = null; facets = null; attributePrefixes = null; } | /**
* set all the variables to NULL
*/ | set all the variables to NULL | close | {
"repo_name": "joshkh/intermine",
"path": "intermine/api/main/src/org/intermine/api/lucene/KeywordSearch.java",
"license": "lgpl-2.1",
"size": 52885
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,792,169 |
public String getLocalizedName(CmsMessages messages) {
String nameKey = "GUI_RELATION_TYPE_" + getName() + "_0";
return messages.key(nameKey);
} | String function(CmsMessages messages) { String nameKey = STR + getName() + "_0"; return messages.key(nameKey); } | /**
* Returns a localized name for the given relation type.<p>
*
* @param messages the message bundle to use to resolve the name
*
* @return a localized name
*/ | Returns a localized name for the given relation type | getLocalizedName | {
"repo_name": "it-tavis/opencms-core",
"path": "src/org/opencms/relations/CmsRelationType.java",
"license": "lgpl-2.1",
"size": 20963
} | [
"org.opencms.i18n.CmsMessages"
] | import org.opencms.i18n.CmsMessages; | import org.opencms.i18n.*; | [
"org.opencms.i18n"
] | org.opencms.i18n; | 378,479 |
public GHCommitStatus getLastStatus() throws IOException {
return owner.getLastCommitStatus(sha);
} | GHCommitStatus function() throws IOException { return owner.getLastCommitStatus(sha); } | /**
* Gets the last status of this commit, which is what gets shown in the UI.
*/ | Gets the last status of this commit, which is what gets shown in the UI | getLastStatus | {
"repo_name": "appbank2020/GitRobot",
"path": "src/org/kohsuke/github/GHCommit.java",
"license": "apache-2.0",
"size": 7726
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 708,315 |
public Kit getKitFromDisplayStack(ItemStack stack)
{
for(int i = 0; i < kitInventory.size(); i++)
{
if(kitInventory.get(i).getStack().getDisplayStack() == stack)
{
return this.kitInventory.get(i);
}
}
return null;
} | Kit function(ItemStack stack) { for(int i = 0; i < kitInventory.size(); i++) { if(kitInventory.get(i).getStack().getDisplayStack() == stack) { return this.kitInventory.get(i); } } return null; } | /**
* Returns the Kit Class if the the ItemStack equals the
* Display Stack within the kitInventory List.
* @param stack displayStack
* @return Kit
*/ | Returns the Kit Class if the the ItemStack equals the Display Stack within the kitInventory List | getKitFromDisplayStack | {
"repo_name": "bfox1/GamemodePvP",
"path": "src/main/java/ml/gamemodepvp/Modules/classes/GmpvpInventory.java",
"license": "lgpl-3.0",
"size": 6673
} | [
"ml.gamemodepvp.Modules",
"org.bukkit.inventory.ItemStack"
] | import ml.gamemodepvp.Modules; import org.bukkit.inventory.ItemStack; | import ml.gamemodepvp.*; import org.bukkit.inventory.*; | [
"ml.gamemodepvp",
"org.bukkit.inventory"
] | ml.gamemodepvp; org.bukkit.inventory; | 273,104 |
boolean useBonemeal(BlockLocation crop);
| boolean useBonemeal(BlockLocation crop); | /**
* Attempts to use bonemeal on the crop. Only called when either
* canUseBonemealAtHarvest or canUseBonemealWhilePlanting returns true.
*
* @param crop
* The block to use bonemeal on
* @return True if a bonemeal was used up
*/ | Attempts to use bonemeal on the crop. Only called when either canUseBonemealAtHarvest or canUseBonemealWhilePlanting returns true | useBonemeal | {
"repo_name": "bulshavik/Toolworx",
"path": "MachinaPlanter/src/me/lyneira/MachinaPlanter/crop/CropHandler.java",
"license": "gpl-3.0",
"size": 3251
} | [
"me.lyneira.MachinaCore"
] | import me.lyneira.MachinaCore; | import me.lyneira.*; | [
"me.lyneira"
] | me.lyneira; | 1,955,971 |
private void pauseJob(String jobHashKey, Jedis jedis) throws JobPersistenceException {
if (!jedis.sismember(JOBS_SET, jobHashKey))
throw new JobPersistenceException("job: " + jobHashKey + " des not exist");
String jobTriggerSetkey = createJobTriggersSetKey(jobHashKey.split(":")[1], jobHashKey.split(":")[2]);
List<OperableTrigger> triggers = getTriggersForJob(jobTriggerSetkey, jedis);
for (OperableTrigger trigger : triggers)
pauseTrigger(trigger.getKey(), jedis);
} | void function(String jobHashKey, Jedis jedis) throws JobPersistenceException { if (!jedis.sismember(JOBS_SET, jobHashKey)) throw new JobPersistenceException(STR + jobHashKey + STR); String jobTriggerSetkey = createJobTriggersSetKey(jobHashKey.split(":")[1], jobHashKey.split(":")[2]); List<OperableTrigger> triggers = getTriggersForJob(jobTriggerSetkey, jedis); for (OperableTrigger trigger : triggers) pauseTrigger(trigger.getKey(), jedis); } | /**
* Pause job.
*
* @param jobKey the job key
* @param jedis thread-safe redis connection
* @throws JobPersistenceException
*/ | Pause job | pauseJob | {
"repo_name": "RedisLabs/redis-quartz",
"path": "src/main/java/com/redislabs/quartz/RedisJobStore.java",
"license": "mit",
"size": 83014
} | [
"java.util.List",
"org.quartz.JobPersistenceException",
"org.quartz.spi.OperableTrigger",
"redis.clients.jedis.Jedis"
] | import java.util.List; import org.quartz.JobPersistenceException; import org.quartz.spi.OperableTrigger; import redis.clients.jedis.Jedis; | import java.util.*; import org.quartz.*; import org.quartz.spi.*; import redis.clients.jedis.*; | [
"java.util",
"org.quartz",
"org.quartz.spi",
"redis.clients.jedis"
] | java.util; org.quartz; org.quartz.spi; redis.clients.jedis; | 1,401,906 |
private void setupActionBar() {
final ViewGroup actionBarCompat = getActionBarCompat();
if (actionBarCompat == null) {
return;
}
LinearLayout.LayoutParams springLayoutParams = new LinearLayout.LayoutParams(
0, ViewGroup.LayoutParams.MATCH_PARENT);
springLayoutParams.weight = 1;
// Add Home button
SimpleMenu tempMenu = new SimpleMenu(mActivity);
SimpleMenuItem homeItem = new SimpleMenuItem(
tempMenu, android.R.id.home, 0, mActivity.getString(R.string.app_name));
homeItem.setIcon(R.drawable.ic_home);
addActionItemCompatFromMenuItem(homeItem);
// Add title text
TextView titleText = new TextView(mActivity, null, R.attr.actionbarCompatTitleStyle);
titleText.setLayoutParams(springLayoutParams);
titleText.setText(mActivity.getTitle());
actionBarCompat.addView(titleText);
} | void function() { final ViewGroup actionBarCompat = getActionBarCompat(); if (actionBarCompat == null) { return; } LinearLayout.LayoutParams springLayoutParams = new LinearLayout.LayoutParams( 0, ViewGroup.LayoutParams.MATCH_PARENT); springLayoutParams.weight = 1; SimpleMenu tempMenu = new SimpleMenu(mActivity); SimpleMenuItem homeItem = new SimpleMenuItem( tempMenu, android.R.id.home, 0, mActivity.getString(R.string.app_name)); homeItem.setIcon(R.drawable.ic_home); addActionItemCompatFromMenuItem(homeItem); TextView titleText = new TextView(mActivity, null, R.attr.actionbarCompatTitleStyle); titleText.setLayoutParams(springLayoutParams); titleText.setText(mActivity.getTitle()); actionBarCompat.addView(titleText); } | /**
* Sets up the compatibility action bar with the given title.
*/ | Sets up the compatibility action bar with the given title | setupActionBar | {
"repo_name": "douglasdrumond/dependencies-demo",
"path": "src/com/example/android/actionbarcompat/ActionBarHelperBase.java",
"license": "apache-2.0",
"size": 11509
} | [
"android.view.ViewGroup",
"android.widget.LinearLayout",
"android.widget.TextView"
] | import android.view.ViewGroup; import android.widget.LinearLayout; import android.widget.TextView; | import android.view.*; import android.widget.*; | [
"android.view",
"android.widget"
] | android.view; android.widget; | 594,923 |
public void addContextVersion(String hostName, Object host, String path,
String version, Object context, String[] welcomeResources,
javax.naming.Context resources, Collection<WrapperMappingInfo> wrappers,
boolean mapperContextRootRedirectEnabled, boolean mapperDirectoryRedirectEnabled) {
Host mappedHost = exactFind(hosts, hostName);
if (mappedHost == null) {
addHost(hostName, new String[0], host);
mappedHost = exactFind(hosts, hostName);
if (mappedHost == null) {
log.error("No host found: " + hostName);
return;
}
}
if (mappedHost.isAlias()) {
log.error("No host found: " + hostName);
return;
}
int slashCount = slashCount(path);
synchronized (mappedHost) {
ContextVersion newContextVersion = new ContextVersion(version, context);
newContextVersion.path = path;
newContextVersion.slashCount = slashCount;
newContextVersion.welcomeResources = welcomeResources;
newContextVersion.resources = resources;
newContextVersion.mapperContextRootRedirectEnabled = mapperContextRootRedirectEnabled;
newContextVersion.mapperDirectoryRedirectEnabled = mapperDirectoryRedirectEnabled;
if (wrappers != null) {
addWrappers(newContextVersion, wrappers);
}
ContextList contextList = mappedHost.contextList;
Context mappedContext = exactFind(contextList.contexts, path);
if (mappedContext == null) {
mappedContext = new Context(path, newContextVersion);
ContextList newContextList = contextList.addContext(
mappedContext, slashCount);
if (newContextList != null) {
updateContextList(mappedHost, newContextList);
}
} else {
ContextVersion[] contextVersions = mappedContext.versions;
ContextVersion[] newContextVersions =
new ContextVersion[contextVersions.length + 1];
if (insertMap(contextVersions, newContextVersions, newContextVersion)) {
mappedContext.versions = newContextVersions;
} else {
// Re-registration after Context.reload()
// Replace ContextVersion with the new one
int pos = find(contextVersions, version);
if (pos >= 0 && contextVersions[pos].name.equals(version)) {
contextVersions[pos] = newContextVersion;
}
}
}
}
} | void function(String hostName, Object host, String path, String version, Object context, String[] welcomeResources, javax.naming.Context resources, Collection<WrapperMappingInfo> wrappers, boolean mapperContextRootRedirectEnabled, boolean mapperDirectoryRedirectEnabled) { Host mappedHost = exactFind(hosts, hostName); if (mappedHost == null) { addHost(hostName, new String[0], host); mappedHost = exactFind(hosts, hostName); if (mappedHost == null) { log.error(STR + hostName); return; } } if (mappedHost.isAlias()) { log.error(STR + hostName); return; } int slashCount = slashCount(path); synchronized (mappedHost) { ContextVersion newContextVersion = new ContextVersion(version, context); newContextVersion.path = path; newContextVersion.slashCount = slashCount; newContextVersion.welcomeResources = welcomeResources; newContextVersion.resources = resources; newContextVersion.mapperContextRootRedirectEnabled = mapperContextRootRedirectEnabled; newContextVersion.mapperDirectoryRedirectEnabled = mapperDirectoryRedirectEnabled; if (wrappers != null) { addWrappers(newContextVersion, wrappers); } ContextList contextList = mappedHost.contextList; Context mappedContext = exactFind(contextList.contexts, path); if (mappedContext == null) { mappedContext = new Context(path, newContextVersion); ContextList newContextList = contextList.addContext( mappedContext, slashCount); if (newContextList != null) { updateContextList(mappedHost, newContextList); } } else { ContextVersion[] contextVersions = mappedContext.versions; ContextVersion[] newContextVersions = new ContextVersion[contextVersions.length + 1]; if (insertMap(contextVersions, newContextVersions, newContextVersion)) { mappedContext.versions = newContextVersions; } else { int pos = find(contextVersions, version); if (pos >= 0 && contextVersions[pos].name.equals(version)) { contextVersions[pos] = newContextVersion; } } } } } | /**
* Add a new Context to an existing Host.
*
* @param hostName Virtual host name this context belongs to
* @param host Host object
* @param path Context path
* @param version Context version
* @param context Context object
* @param welcomeResources Welcome files defined for this context
* @param resources Static resources of the context
* @param wrappers Information on wrapper mappings
* @param mapperContextRootRedirectEnabled Mapper does context root redirects
* @param mapperDirectoryRedirectEnabled Mapper does directory redirects
*/ | Add a new Context to an existing Host | addContextVersion | {
"repo_name": "mayonghui2112/helloWorld",
"path": "sourceCode/apache-tomcat-7.0.82-src/java/org/apache/tomcat/util/http/mapper/Mapper.java",
"license": "apache-2.0",
"size": 61011
} | [
"java.util.Collection"
] | import java.util.Collection; | import java.util.*; | [
"java.util"
] | java.util; | 2,251,055 |
public void setPort(QName portName) {
Port port = _service.getPort(portName.getLocalPart());
if (port == null) {
throw new IllegalArgumentException("Port name: '" + portName + "' was not found in the WSDL file.");
}
_port = port;
_operationCache.clear();
} | void function(QName portName) { Port port = _service.getPort(portName.getLocalPart()); if (port == null) { throw new IllegalArgumentException(STR + portName + STR); } _port = port; _operationCache.clear(); } | /**
* Change the port of the service.
*
* @param portName The new port name.
* @throws IllegalArgumentException if port name is not defined in WSDL.
*/ | Change the port of the service | setPort | {
"repo_name": "yintaoxue/read-open-source-code",
"path": "kettle4.3/src/org/pentaho/di/trans/steps/webservices/wsdl/Wsdl.java",
"license": "apache-2.0",
"size": 13771
} | [
"javax.wsdl.Port",
"javax.xml.namespace.QName"
] | import javax.wsdl.Port; import javax.xml.namespace.QName; | import javax.wsdl.*; import javax.xml.namespace.*; | [
"javax.wsdl",
"javax.xml"
] | javax.wsdl; javax.xml; | 1,361,464 |
private void exportToRfs(CmsResource res) throws CmsException {
CmsFile vfsFile;
File fsFile;
String resourcename;
// to get the name of the file in the FS, we must look it up in the
// sync list. This is necessary, since the VFS could use a translated
// filename.
CmsSynchronizeList sync = m_syncList.get(translate(m_cms.getSitePath(res)));
// if no entry in the sync list was found, its a new resource and we
// can use the name of the VFS resource.
if (sync != null) {
resourcename = sync.getResName();
} else {
// otherwise use the original non-translated name
resourcename = m_cms.getSitePath(res);
// the parent folder could contain a translated names as well, so
// make a lookup in the sync list to get its original
// non-translated name
String parent = CmsResource.getParentFolder(resourcename);
CmsSynchronizeList parentSync = m_newSyncList.get(parent);
// use the non-translated pathname
if (parentSync != null) {
resourcename = parentSync.getResName() + res.getName();
}
}
if ((res.isFolder()) && (!resourcename.endsWith("/"))) {
resourcename += "/";
}
fsFile = getFileInRfs(resourcename);
try {
// if the resource is marked for deletion, do not export it!
if (!res.getState().isDeleted()) {
// if its a file, create export the file to the FS
m_report.print(
org.opencms.report.Messages.get().container(
org.opencms.report.Messages.RPT_SUCCESSION_1,
String.valueOf(m_count++)),
I_CmsReport.FORMAT_NOTE);
if (res.isFile()) {
m_report.print(Messages.get().container(Messages.RPT_EXPORT_FILE_0), I_CmsReport.FORMAT_NOTE);
m_report.print(org.opencms.report.Messages.get().container(
org.opencms.report.Messages.RPT_ARGUMENT_1,
m_cms.getSitePath(res)));
m_report.print(Messages.get().container(Messages.RPT_TO_FS_AS_0), I_CmsReport.FORMAT_NOTE);
m_report.print(org.opencms.report.Messages.get().container(
org.opencms.report.Messages.RPT_ARGUMENT_1,
fsFile.getAbsolutePath().replace('\\', '/')));
m_report.print(org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_DOTS_0));
// create the resource if nescessary
if (!fsFile.exists()) {
createNewLocalFile(fsFile);
}
// write the file content to the FS
vfsFile = m_cms.readFile(m_cms.getSitePath(res), CmsResourceFilter.IGNORE_EXPIRATION);
try {
writeFileByte(vfsFile.getContents(), fsFile);
} catch (IOException e) {
throw new CmsSynchronizeException(Messages.get().container(Messages.ERR_WRITE_FILE_0));
}
// now check if there is some external method to be called
// which should modify the exported resource in the FS
Iterator<I_CmsSynchronizeModification> i = m_synchronizeModifications.iterator();
while (i.hasNext()) {
try {
i.next().modifyFs(m_cms, vfsFile, fsFile);
} catch (CmsSynchronizeException e) {
if (LOG.isWarnEnabled()) {
LOG.warn(
Messages.get().getBundle().key(
Messages.LOG_SYNCHRONIZE_EXPORT_FAILED_1,
res.getRootPath()),
e);
}
break;
}
}
fsFile.setLastModified(res.getDateLastModified());
} else {
m_report.print(Messages.get().container(Messages.RPT_EXPORT_FOLDER_0), I_CmsReport.FORMAT_NOTE);
m_report.print(org.opencms.report.Messages.get().container(
org.opencms.report.Messages.RPT_ARGUMENT_1,
m_cms.getSitePath(res)));
m_report.print(Messages.get().container(Messages.RPT_TO_FS_AS_0), I_CmsReport.FORMAT_NOTE);
m_report.print(org.opencms.report.Messages.get().container(
org.opencms.report.Messages.RPT_ARGUMENT_1,
fsFile.getAbsolutePath().replace('\\', '/')));
m_report.print(org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_DOTS_0));
// its a folder, so create a folder in the FS
fsFile.mkdirs();
}
// add resource to synchronization list
CmsSynchronizeList syncList = new CmsSynchronizeList(
resourcename,
translate(resourcename),
res.getDateLastModified(),
fsFile.lastModified());
m_newSyncList.put(translate(resourcename), syncList);
// and remove it fomr the old one
m_syncList.remove(translate(resourcename));
m_report.println(
org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_OK_0),
I_CmsReport.FORMAT_OK);
}
// free mem
vfsFile = null;
} catch (CmsException e) {
throw new CmsSynchronizeException(e.getMessageContainer(), e);
}
} | void function(CmsResource res) throws CmsException { CmsFile vfsFile; File fsFile; String resourcename; CmsSynchronizeList sync = m_syncList.get(translate(m_cms.getSitePath(res))); if (sync != null) { resourcename = sync.getResName(); } else { resourcename = m_cms.getSitePath(res); String parent = CmsResource.getParentFolder(resourcename); CmsSynchronizeList parentSync = m_newSyncList.get(parent); if (parentSync != null) { resourcename = parentSync.getResName() + res.getName(); } } if ((res.isFolder()) && (!resourcename.endsWith("/"))) { resourcename += "/"; } fsFile = getFileInRfs(resourcename); try { if (!res.getState().isDeleted()) { m_report.print( org.opencms.report.Messages.get().container( org.opencms.report.Messages.RPT_SUCCESSION_1, String.valueOf(m_count++)), I_CmsReport.FORMAT_NOTE); if (res.isFile()) { m_report.print(Messages.get().container(Messages.RPT_EXPORT_FILE_0), I_CmsReport.FORMAT_NOTE); m_report.print(org.opencms.report.Messages.get().container( org.opencms.report.Messages.RPT_ARGUMENT_1, m_cms.getSitePath(res))); m_report.print(Messages.get().container(Messages.RPT_TO_FS_AS_0), I_CmsReport.FORMAT_NOTE); m_report.print(org.opencms.report.Messages.get().container( org.opencms.report.Messages.RPT_ARGUMENT_1, fsFile.getAbsolutePath().replace('\\', '/'))); m_report.print(org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_DOTS_0)); if (!fsFile.exists()) { createNewLocalFile(fsFile); } vfsFile = m_cms.readFile(m_cms.getSitePath(res), CmsResourceFilter.IGNORE_EXPIRATION); try { writeFileByte(vfsFile.getContents(), fsFile); } catch (IOException e) { throw new CmsSynchronizeException(Messages.get().container(Messages.ERR_WRITE_FILE_0)); } Iterator<I_CmsSynchronizeModification> i = m_synchronizeModifications.iterator(); while (i.hasNext()) { try { i.next().modifyFs(m_cms, vfsFile, fsFile); } catch (CmsSynchronizeException e) { if (LOG.isWarnEnabled()) { LOG.warn( Messages.get().getBundle().key( Messages.LOG_SYNCHRONIZE_EXPORT_FAILED_1, res.getRootPath()), e); } break; } } fsFile.setLastModified(res.getDateLastModified()); } else { m_report.print(Messages.get().container(Messages.RPT_EXPORT_FOLDER_0), I_CmsReport.FORMAT_NOTE); m_report.print(org.opencms.report.Messages.get().container( org.opencms.report.Messages.RPT_ARGUMENT_1, m_cms.getSitePath(res))); m_report.print(Messages.get().container(Messages.RPT_TO_FS_AS_0), I_CmsReport.FORMAT_NOTE); m_report.print(org.opencms.report.Messages.get().container( org.opencms.report.Messages.RPT_ARGUMENT_1, fsFile.getAbsolutePath().replace('\\', '/'))); m_report.print(org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_DOTS_0)); fsFile.mkdirs(); } CmsSynchronizeList syncList = new CmsSynchronizeList( resourcename, translate(resourcename), res.getDateLastModified(), fsFile.lastModified()); m_newSyncList.put(translate(resourcename), syncList); m_syncList.remove(translate(resourcename)); m_report.println( org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_OK_0), I_CmsReport.FORMAT_OK); } vfsFile = null; } catch (CmsException e) { throw new CmsSynchronizeException(e.getMessageContainer(), e); } } | /**
* Exports a resource from the VFS to the FS and updates the
* synchronization lists.<p>
*
* @param res the resource to be exported
*
* @throws CmsException if something goes wrong
*/ | Exports a resource from the VFS to the FS and updates the synchronization lists | exportToRfs | {
"repo_name": "it-tavis/opencms-core",
"path": "src/org/opencms/synchronize/CmsSynchronize.java",
"license": "lgpl-2.1",
"size": 45364
} | [
"java.io.File",
"java.io.IOException",
"java.util.Iterator",
"org.opencms.file.CmsFile",
"org.opencms.file.CmsResource",
"org.opencms.file.CmsResourceFilter",
"org.opencms.main.CmsException"
] | import java.io.File; import java.io.IOException; import java.util.Iterator; import org.opencms.file.CmsFile; import org.opencms.file.CmsResource; import org.opencms.file.CmsResourceFilter; import org.opencms.main.CmsException; | import java.io.*; import java.util.*; import org.opencms.file.*; import org.opencms.main.*; | [
"java.io",
"java.util",
"org.opencms.file",
"org.opencms.main"
] | java.io; java.util; org.opencms.file; org.opencms.main; | 1,671,787 |
@Override
public boolean deleteTenant(String name) throws TenantNotFoundException {
name = sanitizeTenantName(name);
validateNamespace(name);
return kubernetesClient.namespaces().withName(name).delete();
} | boolean function(String name) throws TenantNotFoundException { name = sanitizeTenantName(name); validateNamespace(name); return kubernetesClient.namespaces().withName(name).delete(); } | /**
* Delete a tenant by deleting the namespace.
*
* @param name Tenant name
* @return Status
*/ | Delete a tenant by deleting the namespace | deleteTenant | {
"repo_name": "imesh/carbon-multitenancy",
"path": "components/org.wso2.carbon.multitenancy.tenant.service/src/main/java/org/wso2/carbon/multitenancy/tenant/service/kubernetes/KubernetesTenancyProvider.java",
"license": "apache-2.0",
"size": 6902
} | [
"org.wso2.carbon.multitenancy.tenant.service.exceptions.TenantNotFoundException"
] | import org.wso2.carbon.multitenancy.tenant.service.exceptions.TenantNotFoundException; | import org.wso2.carbon.multitenancy.tenant.service.exceptions.*; | [
"org.wso2.carbon"
] | org.wso2.carbon; | 2,231,730 |
private void validateBagType() {
ClassDescriptor bagType = os.getModel().getClassDescriptorByName(bag.getType());
if (bagType == null) {
throw new IllegalArgumentException("This bag has a type not found in the current "
+ "model: " + bag.getType());
}
if ("InterMineObject".equals(typeDescriptor.getName())) {
return; // This widget accepts anything, however useless.
} else if (bagType.equals(typeDescriptor)) {
return; // Exact match.
} else if (bagType.getAllSuperDescriptors().contains(typeDescriptor)) {
return; // Sub-class.
}
throw new IllegalArgumentException(
String.format("The %s enrichment query only accepts lists of %s, but you provided a "
+ "list of %s ", config.getId(), config.getTypeClass(), bag.getType()));
} | void function() { ClassDescriptor bagType = os.getModel().getClassDescriptorByName(bag.getType()); if (bagType == null) { throw new IllegalArgumentException(STR + STR + bag.getType()); } if (STR.equals(typeDescriptor.getName())) { return; } else if (bagType.equals(typeDescriptor)) { return; } else if (bagType.getAllSuperDescriptors().contains(typeDescriptor)) { return; } throw new IllegalArgumentException( String.format(STR + STR, config.getId(), config.getTypeClass(), bag.getType())); } | /**
* Validate the bag type using the attribute typeClass set in the config file.
* Throws a ResourceNotFoundException if it's not valid
*/ | Validate the bag type using the attribute typeClass set in the config file. Throws a ResourceNotFoundException if it's not valid | validateBagType | {
"repo_name": "joshkh/intermine",
"path": "intermine/web/main/src/org/intermine/web/logic/widget/EnrichmentWidget.java",
"license": "lgpl-2.1",
"size": 14352
} | [
"org.intermine.metadata.ClassDescriptor"
] | import org.intermine.metadata.ClassDescriptor; | import org.intermine.metadata.*; | [
"org.intermine.metadata"
] | org.intermine.metadata; | 899,562 |
public void setChildren(List<CmsSitemapEntryBean> children) {
m_children = children;
}
| void function(List<CmsSitemapEntryBean> children) { m_children = children; } | /**
* Sets the children of this entry.<p>
*
* @param children the children
*/ | Sets the children of this entry | setChildren | {
"repo_name": "ggiudetti/opencms-core",
"path": "src/org/opencms/ade/galleries/shared/CmsSitemapEntryBean.java",
"license": "lgpl-2.1",
"size": 8203
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 533,869 |
protected final void drawArrowHead(Graphics2D g, int x, int y, int sgn) {
g.setStroke(Strokes.getStroke(StrokeType.SOLID, 1));
int size = diagram.arrowSize;
switch (headType) {
case CLOSED:
Polygon p = new Polygon(new int[] { x, x + sgn * size,
x + sgn * size, x },
new int[] { y, y - size, y + size, y }, 4);
g.fillPolygon(p);
break;
case OPEN:
g.drawLine(x, y, x + sgn * size, y - size);
g.drawLine(x, y, x + sgn * size, y + size);
break;
case ROUNDED:
int left = sgn == -1 ? x - 2 * size : x;
int top = y - size;
g.fillArc(left, top, size * 2, size * 2, 90, sgn * 180);
}
} | final void function(Graphics2D g, int x, int y, int sgn) { g.setStroke(Strokes.getStroke(StrokeType.SOLID, 1)); int size = diagram.arrowSize; switch (headType) { case CLOSED: Polygon p = new Polygon(new int[] { x, x + sgn * size, x + sgn * size, x }, new int[] { y, y - size, y + size, y }, 4); g.fillPolygon(p); break; case OPEN: g.drawLine(x, y, x + sgn * size, y - size); g.drawLine(x, y, x + sgn * size, y + size); break; case ROUNDED: int left = sgn == -1 ? x - 2 * size : x; int top = y - size; g.fillArc(left, top, size * 2, size * 2, 90, sgn * 180); } } | /**
* Draws the head of a message arrow onto the diagram display.
*
* @param g
* the graphics context of the diagram display
* @param closed
* flag denoting whether the arrow head is closed (filled) or not
* @param x
* the horizontal position where to start drawing the arrow
* @param y
* the vertical position of the middle point of the arrow
* @param sgn
* 1, if the arrow is directed from the right to the left, -1
* otherwise
*/ | Draws the head of a message arrow onto the diagram display | drawArrowHead | {
"repo_name": "janlindblom/sdedit",
"path": "src/net/sf/sdedit/drawable/Arrow.java",
"license": "bsd-2-clause",
"size": 10502
} | [
"java.awt.Graphics2D",
"java.awt.Polygon",
"net.sf.sdedit.drawable.Strokes"
] | import java.awt.Graphics2D; import java.awt.Polygon; import net.sf.sdedit.drawable.Strokes; | import java.awt.*; import net.sf.sdedit.drawable.*; | [
"java.awt",
"net.sf.sdedit"
] | java.awt; net.sf.sdedit; | 2,623,473 |
@Override
public String getBaseTypeName() throws SQLException {
try {
debugCodeCall("getBaseTypeName");
checkClosed();
return "NULL";
} catch (Exception e) {
throw logAndConvert(e);
}
} | String function() throws SQLException { try { debugCodeCall(STR); checkClosed(); return "NULL"; } catch (Exception e) { throw logAndConvert(e); } } | /**
* Returns the base type name of the array. This database does support mixed
* type arrays and therefore there is no base type.
*
* @return "NULL"
*/ | Returns the base type name of the array. This database does support mixed type arrays and therefore there is no base type | getBaseTypeName | {
"repo_name": "vdr007/ThriftyPaxos",
"path": "src/applications/h2/src/main/org/h2/jdbc/JdbcArray.java",
"license": "apache-2.0",
"size": 8810
} | [
"java.sql.SQLException"
] | import java.sql.SQLException; | import java.sql.*; | [
"java.sql"
] | java.sql; | 1,833,903 |
public LocalDate asDate() {
if (DATE != this.getValueType()) {
throw logger.logExceptionAsError((new UnsupportedOperationException(String.format("Cannot get field as "
+ "%s from field value of type %s", DATE, this.getValueType()))));
}
return this.formFieldDate;
} | LocalDate function() { if (DATE != this.getValueType()) { throw logger.logExceptionAsError((new UnsupportedOperationException(String.format(STR + STR, DATE, this.getValueType())))); } return this.formFieldDate; } | /**
* Gets the value of the field as a {@link LocalDate}.
*
* @return the value of the field as a {@link LocalDate}.
* @throws UnsupportedOperationException if {@link FieldValue#getValueType()} is not {@link FieldValueType#DATE}.
*/ | Gets the value of the field as a <code>LocalDate</code> | asDate | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer/models/FieldValue.java",
"license": "mit",
"size": 7654
} | [
"java.time.LocalDate"
] | import java.time.LocalDate; | import java.time.*; | [
"java.time"
] | java.time; | 2,063,597 |
public RandomAccessStream openMemoryMappedFile(long fileSize)
throws IOException
{
return null;
} | RandomAccessStream function(long fileSize) throws IOException { return null; } | /**
* Opens a random-access stream.
*/ | Opens a random-access stream | openMemoryMappedFile | {
"repo_name": "dlitz/resin",
"path": "modules/kernel/src/com/caucho/vfs/Path.java",
"license": "gpl-2.0",
"size": 35830
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,277,919 |
void setTaskBar(TaskBar tb) { this.tb = tb; } | void setTaskBar(TaskBar tb) { this.tb = tb; } | /**
* Stores a reference to the {@link AdminService}.
*
* @param ms The {@link AdminService}.
*/ | Stores a reference to the <code>AdminService</code> | setAdminService | {
"repo_name": "rleigh-dundee/openmicroscopy",
"path": "components/insight/SRC/org/openmicroscopy/shoola/env/config/RegistryImpl.java",
"license": "gpl-2.0",
"size": 7915
} | [
"org.openmicroscopy.shoola.env.ui.TaskBar"
] | import org.openmicroscopy.shoola.env.ui.TaskBar; | import org.openmicroscopy.shoola.env.ui.*; | [
"org.openmicroscopy.shoola"
] | org.openmicroscopy.shoola; | 2,295,600 |
public static void splitStr(List<String> lst, byte[] ba, int pos, byte split) {
while (pos < ba.length && ba[pos] != 0) {
int len;
for (len = 0; pos + len < ba.length; ++len) {
if (ba[pos + len] == 0 || ba[pos + len] == split)
break;
}
if (len > 0)
lst.add(new String(ba, pos, len));
pos += len;
if (ba[pos] == split)
++pos;
}
} | static void function(List<String> lst, byte[] ba, int pos, byte split) { while (pos < ba.length && ba[pos] != 0) { int len; for (len = 0; pos + len < ba.length; ++len) { if (ba[pos + len] == 0 ba[pos + len] == split) break; } if (len > 0) lst.add(new String(ba, pos, len)); pos += len; if (ba[pos] == split) ++pos; } } | /**
* Read bytes from 'ba' starting at 'pos', dividing them into strings
* along the character in 'split' and writing them into 'lst'
*/ | Read bytes from 'ba' starting at 'pos', dividing them into strings along the character in 'split' and writing them into 'lst' | splitStr | {
"repo_name": "sakazz/exchange",
"path": "jtorctl/src/main/java/net/freehaven/tor/control/Bytes.java",
"license": "agpl-3.0",
"size": 3853
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,263,722 |
public static void sendUsingXmpp(net.violet.platform.message.Message inMessage, int mode) {
MessageServices.sendUsingXmpp(inMessage, mode, null);
} | static void function(net.violet.platform.message.Message inMessage, int mode) { MessageServices.sendUsingXmpp(inMessage, mode, null); } | /**
* Envoie le message en utilisant Jabber.
*
* @param inMessage
* @param expirationDate
* @param mode
*/ | Envoie le message en utilisant Jabber | sendUsingXmpp | {
"repo_name": "sebastienhouzet/nabaztag-source-code",
"path": "server/OS/net/violet/platform/message/MessageServices.java",
"license": "mit",
"size": 22615
} | [
"net.violet.platform.datamodel.Message"
] | import net.violet.platform.datamodel.Message; | import net.violet.platform.datamodel.*; | [
"net.violet.platform"
] | net.violet.platform; | 2,158,468 |
public static String getPageUrlForTool(HttpServletRequest req, Site site, ToolConfiguration pageTool)
{
if ( req == null ) req = getRequestFromThreadLocal();
SitePage thePage = getPageForTool(site, pageTool.getId());
if ( thePage == null ) return null;
return getPageUrl(req, site, thePage);
} | static String function(HttpServletRequest req, Site site, ToolConfiguration pageTool) { if ( req == null ) req = getRequestFromThreadLocal(); SitePage thePage = getPageForTool(site, pageTool.getId()); if ( thePage == null ) return null; return getPageUrl(req, site, thePage); } | /**
* Look through the pages in a site and get the page URL for a tool.
*
* @param <code>req</code>
* The request object. If you have no access to the request object,
* you can leave this null and we will try to pull the request
* from ThreadLocal - if we fail it is a RunTime exception.
* @param <code>site</code>
* The site
* @param <code>pageTool</code>
* The placement / tool configuration
* @return The page if found otherwise null.
*/ | Look through the pages in a site and get the page URL for a tool | getPageUrlForTool | {
"repo_name": "ouit0408/sakai",
"path": "portal/portal-util/util/src/java/org/sakaiproject/portal/util/ToolUtils.java",
"license": "apache-2.0",
"size": 13483
} | [
"javax.servlet.http.HttpServletRequest",
"org.sakaiproject.site.api.Site",
"org.sakaiproject.site.api.SitePage",
"org.sakaiproject.site.api.ToolConfiguration"
] | import javax.servlet.http.HttpServletRequest; import org.sakaiproject.site.api.Site; import org.sakaiproject.site.api.SitePage; import org.sakaiproject.site.api.ToolConfiguration; | import javax.servlet.http.*; import org.sakaiproject.site.api.*; | [
"javax.servlet",
"org.sakaiproject.site"
] | javax.servlet; org.sakaiproject.site; | 525,701 |
public void trace(ParserRuleContext ctx, String message) {
exec.trace(ctx, message);
} | void function(ParserRuleContext ctx, String message) { exec.trace(ctx, message); } | /**
* Trace information
*/ | Trace information | trace | {
"repo_name": "sankarh/hive",
"path": "hplsql/src/main/java/org/apache/hive/hplsql/Expression.java",
"license": "apache-2.0",
"size": 24501
} | [
"org.antlr.v4.runtime.ParserRuleContext"
] | import org.antlr.v4.runtime.ParserRuleContext; | import org.antlr.v4.runtime.*; | [
"org.antlr.v4"
] | org.antlr.v4; | 1,879,941 |
protected SnapshotEventStore getEventStore() {
return eventStore;
} | SnapshotEventStore function() { return eventStore; } | /**
* Returns the event store this snapshotter uses to load domain events and store snapshot events.
*
* @return the event store this snapshotter uses to load domain events and store snapshot events.
*/ | Returns the event store this snapshotter uses to load domain events and store snapshot events | getEventStore | {
"repo_name": "christiaandejong/AxonFramework",
"path": "core/src/main/java/org/axonframework/eventsourcing/AbstractSnapshotter.java",
"license": "apache-2.0",
"size": 8215
} | [
"org.axonframework.eventstore.SnapshotEventStore"
] | import org.axonframework.eventstore.SnapshotEventStore; | import org.axonframework.eventstore.*; | [
"org.axonframework.eventstore"
] | org.axonframework.eventstore; | 2,058,705 |
@Transient
public boolean isFileInVolume( File f ) throws IOException {
boolean isInVolume = false;
if ( f == null ) {
return false;
}
// First get the canonical forms of both f and volumeBaseDir
// After that check if f or some of its parents matches f
File basedir = getBaseDir();
if ( basedir == null ) {
return false;
}
File vbdCanon = basedir.getCanonicalFile();
File fCanon = f.getCanonicalFile();
File p = fCanon;
while ( p != null ) {
if ( p.equals( vbdCanon ) ){
isInVolume = true;
break;
}
p = p.getParentFile();
}
return isInVolume;
}
| boolean function( File f ) throws IOException { boolean isInVolume = false; if ( f == null ) { return false; } File basedir = getBaseDir(); if ( basedir == null ) { return false; } File vbdCanon = basedir.getCanonicalFile(); File fCanon = f.getCanonicalFile(); File p = fCanon; while ( p != null ) { if ( p.equals( vbdCanon ) ){ isInVolume = true; break; } p = p.getParentFile(); } return isInVolume; } | /**
* Checks whether a certain file is part of the volume (i.e. in the directory
* hierarchy under the base directory. Note that existence of the file is not
* ckecked, nor whether the file is really an instance of a PhotoInfo.
* @return true if the file belongs to the volume, false otherwise
* @param f File
* @throws IOException if is an error when creating canonical form of f
*/ | Checks whether a certain file is part of the volume (i.e. in the directory hierarchy under the base directory. Note that existence of the file is not ckecked, nor whether the file is really an instance of a PhotoInfo | isFileInVolume | {
"repo_name": "hkaimio/photovault",
"path": "src/main/java/org/photovault/imginfo/VolumeBase.java",
"license": "gpl-2.0",
"size": 12993
} | [
"java.io.File",
"java.io.IOException"
] | import java.io.File; import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 461,145 |
default void preCreateNamespace(final ObserverContext<MasterCoprocessorEnvironment> ctx,
NamespaceDescriptor ns) throws IOException {} | default void preCreateNamespace(final ObserverContext<MasterCoprocessorEnvironment> ctx, NamespaceDescriptor ns) throws IOException {} | /**
* Called before a new namespace is created by
* {@link org.apache.hadoop.hbase.master.HMaster}.
* @param ctx the environment to interact with the framework and master
* @param ns the NamespaceDescriptor for the table
*/ | Called before a new namespace is created by <code>org.apache.hadoop.hbase.master.HMaster</code> | preCreateNamespace | {
"repo_name": "apurtell/hbase",
"path": "hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/MasterObserver.java",
"license": "apache-2.0",
"size": 74501
} | [
"java.io.IOException",
"org.apache.hadoop.hbase.NamespaceDescriptor"
] | import java.io.IOException; import org.apache.hadoop.hbase.NamespaceDescriptor; | import java.io.*; import org.apache.hadoop.hbase.*; | [
"java.io",
"org.apache.hadoop"
] | java.io; org.apache.hadoop; | 923,090 |
public CmsPublishJobInfoBean getCachedPublishJobInHistory(String key) {
for (@SuppressWarnings("unchecked")
Iterator<CmsPublishJobInfoBean> i = m_publishHistory.iterator(); i.hasNext();) {
CmsPublishJobInfoBean publishJob = i.next();
if (publishJob.getPublishHistoryId().toString().equals(key)) {
return publishJob;
}
}
return null;
} | CmsPublishJobInfoBean function(String key) { for (@SuppressWarnings(STR) Iterator<CmsPublishJobInfoBean> i = m_publishHistory.iterator(); i.hasNext();) { CmsPublishJobInfoBean publishJob = i.next(); if (publishJob.getPublishHistoryId().toString().equals(key)) { return publishJob; } } return null; } | /**
* Returns the publish job from the history with the given cache key or <code>null</code> if not found.<p>
*
* @param key the cache key to look for
*
* @return the publish job with the given cache key
*/ | Returns the publish job from the history with the given cache key or <code>null</code> if not found | getCachedPublishJobInHistory | {
"repo_name": "it-tavis/opencms-core",
"path": "src/org/opencms/monitor/CmsMemoryMonitor.java",
"license": "lgpl-2.1",
"size": 86968
} | [
"java.util.Iterator",
"org.opencms.publish.CmsPublishJobInfoBean"
] | import java.util.Iterator; import org.opencms.publish.CmsPublishJobInfoBean; | import java.util.*; import org.opencms.publish.*; | [
"java.util",
"org.opencms.publish"
] | java.util; org.opencms.publish; | 139,607 |
public static void configureDefaultFactories() {
ObjectFactory.initializeFactory(AmCodeGenConsts.getFactoryId());
AmCodeGenConsts.getObjectFactory().register(ISystemProperties.class, new IObjectConstructor<ISystemProperties>() { | static void function() { ObjectFactory.initializeFactory(AmCodeGenConsts.getFactoryId()); AmCodeGenConsts.getObjectFactory().register(ISystemProperties.class, new IObjectConstructor<ISystemProperties>() { | /**
* Configure the default ObjectFactory instances to be used with the code generator
*/ | Configure the default ObjectFactory instances to be used with the code generator | configureDefaultFactories | {
"repo_name": "tectronics/am-code-generator",
"path": "src/org/alamoraes/codegen/CodeBuilder.java",
"license": "apache-2.0",
"size": 10850
} | [
"org.alamoraes.sfactory.IObjectConstructor",
"org.alamoraes.sfactory.ObjectFactory"
] | import org.alamoraes.sfactory.IObjectConstructor; import org.alamoraes.sfactory.ObjectFactory; | import org.alamoraes.sfactory.*; | [
"org.alamoraes.sfactory"
] | org.alamoraes.sfactory; | 1,818,000 |
public boolean setPid(final long handle, int pid) throws SerialComException {
int ret = mSerialComCP210xManufacturingJNIBridge.setPid(handle, pid);
if(ret < 0) {
throw new SerialComException("Could not set the USB PID. Please retry !");
}
return true;
} | boolean function(final long handle, int pid) throws SerialComException { int ret = mSerialComCP210xManufacturingJNIBridge.setPid(handle, pid); if(ret < 0) { throw new SerialComException(STR); } return true; } | /**
* <p>Executes CP210x_SetPid function of of CP210xManufacturing library.</p>
*
* <p>Sets the 2-byte Product ID field of the Device Descriptor of a CP210x device.</p>
*
* @param handle of the device.
* @param pid 16 bit Product ID.
* @return true on success.
* @throws SerialComException if an I/O error occurs.
*/ | Executes CP210x_SetPid function of of CP210xManufacturing library. Sets the 2-byte Product ID field of the Device Descriptor of a CP210x device | setPid | {
"repo_name": "Tecsisa/serial-communication-manager",
"path": "com.embeddedunveiled.serial/src/com/embeddedunveiled/serial/vendor/SerialComSLabsCP210xManufacturing.java",
"license": "lgpl-3.0",
"size": 65672
} | [
"com.embeddedunveiled.serial.SerialComException"
] | import com.embeddedunveiled.serial.SerialComException; | import com.embeddedunveiled.serial.*; | [
"com.embeddedunveiled.serial"
] | com.embeddedunveiled.serial; | 759,173 |
public synchronized Vector[] getXTicks() {
if (_xticks == null) {
return null;
}
Vector[] result = new Vector[2];
result[0] = _xticks;
result[1] = _xticklabels;
return result;
} | synchronized Vector[] function() { if (_xticks == null) { return null; } Vector[] result = new Vector[2]; result[0] = _xticks; result[1] = _xticklabels; return result; } | /** Get the X ticks that have been specified, or null if none.
* The return value is an array with two vectors, the first of
* which specifies the X tick locations (as instances of Double),
* and the second of which specifies the corresponding labels.
* @return The X ticks.
*/ | Get the X ticks that have been specified, or null if none. The return value is an array with two vectors, the first of which specifies the X tick locations (as instances of Double), and the second of which specifies the corresponding labels | getXTicks | {
"repo_name": "Thomashuet/Biocham",
"path": "gui/customComponents/PlotBox.java",
"license": "gpl-2.0",
"size": 136092
} | [
"java.util.Vector"
] | import java.util.Vector; | import java.util.*; | [
"java.util"
] | java.util; | 1,211,482 |
public static String makeFileName( Metadata metadata )
{
StringBuilder sb = new StringBuilder();
sb.append( metadata.getName() ).append( "-" ).append( metadata.getVersion() );
sb.append( ".snap" );
return sb.toString();
} | static String function( Metadata metadata ) { StringBuilder sb = new StringBuilder(); sb.append( metadata.getName() ).append( "-" ).append( metadata.getVersion() ); sb.append( ".snap" ); return sb.toString(); } | /**
* Makes a meaningful file name for supplied snap metadata. Usually it contains snap package name and version.
*
* @param metadata snap metadata to make name for
* @return file name for metadata
*/ | Makes a meaningful file name for supplied snap metadata. Usually it contains snap package name and version | makeFileName | {
"repo_name": "subutai-io/Kurjun",
"path": "utils/common/src/main/java/ai/subut/kurjun/common/utils/SnapUtils.java",
"license": "apache-2.0",
"size": 1414
} | [
"ai.subut.kurjun.model.metadata.Metadata"
] | import ai.subut.kurjun.model.metadata.Metadata; | import ai.subut.kurjun.model.metadata.*; | [
"ai.subut.kurjun"
] | ai.subut.kurjun; | 917,674 |
@XmlElement
@XmlJavaTypeAdapter(DateAdapter.class)
public Date getDateAdded() {
return (expandLevel > 0) ? entity.getDateAdded() : null;
} | @XmlJavaTypeAdapter(DateAdapter.class) Date function() { return (expandLevel > 0) ? entity.getDateAdded() : null; } | /**
* Getter for addedDate.
*
* @return value for addedDate
*/ | Getter for addedDate | getDateAdded | {
"repo_name": "OSEHRA/HealtheMe",
"path": "src/main/java/com/krminc/phr/api/vitals/converter/BloodSugarConverter.java",
"license": "apache-2.0",
"size": 9695
} | [
"com.krminc.phr.api.converter.DateAdapter",
"java.util.Date",
"javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter"
] | import com.krminc.phr.api.converter.DateAdapter; import java.util.Date; import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; | import com.krminc.phr.api.converter.*; import java.util.*; import javax.xml.bind.annotation.adapters.*; | [
"com.krminc.phr",
"java.util",
"javax.xml"
] | com.krminc.phr; java.util; javax.xml; | 2,178,739 |
protected void addToPath( Arc arc )
{
if ( versions == null )
{
versions = new BitSet();
versions.or( arc.versions );
if ( graph != null )
versions.and( graph.constraint );
}
else
versions.and( arc.versions );
} | void function( Arc arc ) { if ( versions == null ) { versions = new BitSet(); versions.or( arc.versions ); if ( graph != null ) versions.and( graph.constraint ); } else versions.and( arc.versions ); } | /**
* Only preserve shared versions on the path. That is,
* if a path consists of AB,BC,AB then the path belongs to
* version B, or the AND of all the sets of versions.
* @param arc the arc to add to the current path
*/ | Only preserve shared versions on the path. That is, if a path consists of AB,BC,AB then the path belongs to version B, or the AND of all the sets of versions | addToPath | {
"repo_name": "Ecdosis/NMergeNew",
"path": "src/edu/luc/nmerge/graph/MatchThreadDirect.java",
"license": "gpl-2.0",
"size": 9244
} | [
"java.util.BitSet"
] | import java.util.BitSet; | import java.util.*; | [
"java.util"
] | java.util; | 1,091,244 |
public void removeListener(INotifyChangedListener notifyChangedListener) {
changeNotifier.removeListener(notifyChangedListener);
} | void function(INotifyChangedListener notifyChangedListener) { changeNotifier.removeListener(notifyChangedListener); } | /**
* This removes a listener.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | This removes a listener. | removeListener | {
"repo_name": "rajeevanv89/developer-studio",
"path": "esb/org.wso2.developerstudio.eclipse.gmf.esb.edit/src/org/wso2/developerstudio/eclipse/gmf/esb/provider/EsbItemProviderAdapterFactory.java",
"license": "apache-2.0",
"size": 286852
} | [
"org.eclipse.emf.edit.provider.INotifyChangedListener"
] | import org.eclipse.emf.edit.provider.INotifyChangedListener; | import org.eclipse.emf.edit.provider.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 1,344,924 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.