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
|
---|---|---|---|---|---|---|---|---|---|---|---|
private static void printCycles(DataModel dataModel) {
Set<Table> independentTables;
Set<Table> tables = new HashSet<Table>(dataModel.getTables());
do {
independentTables = dataModel.getIndependentTables(tables);
tables.removeAll(independentTables);
} while (!independentTables.isEmpty());
if (tables.isEmpty()) {
System.out.println("no cyclic dependencies" + asString(tables));
} else {
System.out.println("tables in dependent-cycle: " + asString(tables));
}
} | static void function(DataModel dataModel) { Set<Table> independentTables; Set<Table> tables = new HashSet<Table>(dataModel.getTables()); do { independentTables = dataModel.getIndependentTables(tables); tables.removeAll(independentTables); } while (!independentTables.isEmpty()); if (tables.isEmpty()) { System.out.println(STR + asString(tables)); } else { System.out.println(STR + asString(tables)); } } | /**
* Searches cycles in a data-model and prints out all tables involved in a
* cycle.
*
* @param dataModel
* the data-model
*/ | Searches cycles in a data-model and prints out all tables involved in a cycle | printCycles | {
"repo_name": "domdorn/Jailer",
"path": "src/main/net/sf/jailer/Jailer.java",
"license": "apache-2.0",
"size": 57438
} | [
"java.util.HashSet",
"java.util.Set",
"net.sf.jailer.datamodel.DataModel",
"net.sf.jailer.datamodel.Table"
] | import java.util.HashSet; import java.util.Set; import net.sf.jailer.datamodel.DataModel; import net.sf.jailer.datamodel.Table; | import java.util.*; import net.sf.jailer.datamodel.*; | [
"java.util",
"net.sf.jailer"
] | java.util; net.sf.jailer; | 1,536,519 |
private void testConfiguratorMethods() {
if (exception == null) {
// TestReload that the login method does not throw an Exception
@SuppressWarnings("unused")
boolean isOk = false;
try {
isOk = commonsConfigurator.login("dummy",
"dummy".toCharArray());
} catch (Exception e) {
initErrrorMesage = ServerUserThrowable.getErrorMessage(commonsConfigurator, "login");
exception = e;
}
}
if (exception == null) {
try {
File serverRootFile = fileConfigurator.getServerRoot();
HttpConfigurationUtil.testServerRootValidity(serverRootFile);
} catch (Exception e) {
initErrrorMesage = ServerUserThrowable.getErrorMessage(
commonsConfigurator, "getServerRoot");
exception = e;
}
}
if (exception == null) {
try {
@SuppressWarnings("unused")
// String tokenRecomputed = commonsConfigurator
// .computeAuthToken("dummy");
String tokenRecomputed = CommonsConfiguratorCall.computeAuthToken(commonsConfigurator, "dummy");
} catch (Exception e) {
initErrrorMesage = ServerUserThrowable.getErrorMessage(
commonsConfigurator, "getServerRoot");
exception = e;
}
}
if (exception == null) {
try {
@SuppressWarnings("unused")
//boolean forceHttps = commonsConfigurator.forceSecureHttp();
boolean forceHttps = CommonsConfiguratorCall.forceSecureHttp(commonsConfigurator);
} catch (Exception e) {
initErrrorMesage = ServerUserThrowable.getErrorMessage(
commonsConfigurator, "forceSecureHttp");
exception = e;
}
}
if (exception == null) {
try {
@SuppressWarnings("unused")
//Set<String> usernameSet = commonsConfigurator.getBannedUsernames();
Set<String> usernameSet = CommonsConfiguratorCall.getBannedUsernames(commonsConfigurator);
} catch (Exception e) {
initErrrorMesage = ServerUserThrowable.getErrorMessage(
commonsConfigurator, "getBannedUsernames");
exception = e;
}
}
if (exception == null) {
try {
@SuppressWarnings("unused")
List<String> ipsBlacklist = CommonsConfiguratorCall.getIPsBlacklist(commonsConfigurator);
} catch (Exception e) {
initErrrorMesage = ServerUserThrowable.getErrorMessage(
commonsConfigurator, "getIPsBlacklist");
exception = e;
}
}
if (exception == null) {
try {
@SuppressWarnings("unused")
List<String> ipsWhitelist = CommonsConfiguratorCall.getIPsWhitelist(commonsConfigurator);
} catch (Exception e) {
initErrrorMesage = ServerUserThrowable.getErrorMessage(
commonsConfigurator, "getIPsWhitelist");
exception = e;
}
}
if (exception == null) {
try {
@SuppressWarnings("unused")
boolean doUseOneRootPerUsername = fileConfigurator
.useOneRootPerUsername();
} catch (Exception e) {
initErrrorMesage = ServerUserThrowable.getErrorMessage(
commonsConfigurator, "useOneRootPerUsername");
exception = e;
}
}
}
| void function() { if (exception == null) { @SuppressWarnings(STR) boolean isOk = false; try { isOk = commonsConfigurator.login("dummy", "dummy".toCharArray()); } catch (Exception e) { initErrrorMesage = ServerUserThrowable.getErrorMessage(commonsConfigurator, "login"); exception = e; } } if (exception == null) { try { File serverRootFile = fileConfigurator.getServerRoot(); HttpConfigurationUtil.testServerRootValidity(serverRootFile); } catch (Exception e) { initErrrorMesage = ServerUserThrowable.getErrorMessage( commonsConfigurator, STR); exception = e; } } if (exception == null) { try { @SuppressWarnings(STR) String tokenRecomputed = CommonsConfiguratorCall.computeAuthToken(commonsConfigurator, "dummy"); } catch (Exception e) { initErrrorMesage = ServerUserThrowable.getErrorMessage( commonsConfigurator, STR); exception = e; } } if (exception == null) { try { @SuppressWarnings(STR) boolean forceHttps = CommonsConfiguratorCall.forceSecureHttp(commonsConfigurator); } catch (Exception e) { initErrrorMesage = ServerUserThrowable.getErrorMessage( commonsConfigurator, STR); exception = e; } } if (exception == null) { try { @SuppressWarnings(STR) Set<String> usernameSet = CommonsConfiguratorCall.getBannedUsernames(commonsConfigurator); } catch (Exception e) { initErrrorMesage = ServerUserThrowable.getErrorMessage( commonsConfigurator, STR); exception = e; } } if (exception == null) { try { @SuppressWarnings(STR) List<String> ipsBlacklist = CommonsConfiguratorCall.getIPsBlacklist(commonsConfigurator); } catch (Exception e) { initErrrorMesage = ServerUserThrowable.getErrorMessage( commonsConfigurator, STR); exception = e; } } if (exception == null) { try { @SuppressWarnings(STR) List<String> ipsWhitelist = CommonsConfiguratorCall.getIPsWhitelist(commonsConfigurator); } catch (Exception e) { initErrrorMesage = ServerUserThrowable.getErrorMessage( commonsConfigurator, STR); exception = e; } } if (exception == null) { try { @SuppressWarnings(STR) boolean doUseOneRootPerUsername = fileConfigurator .useOneRootPerUsername(); } catch (Exception e) { initErrrorMesage = ServerUserThrowable.getErrorMessage( commonsConfigurator, STR); exception = e; } } } | /**
* TestReload the configurators main methods to see if they throw Exceptions
*/ | TestReload the configurators main methods to see if they throw Exceptions | testConfiguratorMethods | {
"repo_name": "abecquereau/awake-file",
"path": "src-main/org/kawanfw/file/servlet/ServerFileManager.java",
"license": "lgpl-2.1",
"size": 17316
} | [
"java.io.File",
"java.util.List",
"java.util.Set",
"org.kawanfw.file.servlet.util.HttpConfigurationUtil"
] | import java.io.File; import java.util.List; import java.util.Set; import org.kawanfw.file.servlet.util.HttpConfigurationUtil; | import java.io.*; import java.util.*; import org.kawanfw.file.servlet.util.*; | [
"java.io",
"java.util",
"org.kawanfw.file"
] | java.io; java.util; org.kawanfw.file; | 1,591,499 |
private boolean propertiesExist(InputStream input) {
log.debug("--> propertiesExist");
Properties propl = new Properties();
boolean exists = false;
try {
propl.load(input);
exists = propl.getProperty("E-MAIL") != null
&& propl.getProperty("PASSWORD") != null;
if (exists) {
this.prop = propl;
}
} catch (IOException ex) {
log.error(ex.getMessage(), ex);
}
IOUtils.closeQuietly(input);
return exists;
} | boolean function(InputStream input) { log.debug(STR); Properties propl = new Properties(); boolean exists = false; try { propl.load(input); exists = propl.getProperty(STR) != null && propl.getProperty(STR) != null; if (exists) { this.prop = propl; } } catch (IOException ex) { log.error(ex.getMessage(), ex); } IOUtils.closeQuietly(input); return exists; } | /**
* Check for mail properties.
*
* @param propertiesFile
* @return
*/ | Check for mail properties | propertiesExist | {
"repo_name": "Sybit-Education/Coding-Camp-2017",
"path": "src/main/java/com/sybit/r750explorer/service/MailService.java",
"license": "mit",
"size": 4093
} | [
"java.io.IOException",
"java.io.InputStream",
"java.util.Properties",
"org.apache.commons.io.IOUtils"
] | import java.io.IOException; import java.io.InputStream; import java.util.Properties; import org.apache.commons.io.IOUtils; | import java.io.*; import java.util.*; import org.apache.commons.io.*; | [
"java.io",
"java.util",
"org.apache.commons"
] | java.io; java.util; org.apache.commons; | 1,863,951 |
EReference getDocumentRoot_Performer(); | EReference getDocumentRoot_Performer(); | /**
* Returns the meta object for the containment reference '{@link org.eclipse.bpmn2.DocumentRoot#getPerformer <em>Performer</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the containment reference '<em>Performer</em>'.
* @see org.eclipse.bpmn2.DocumentRoot#getPerformer()
* @see #getDocumentRoot()
* @generated
*/ | Returns the meta object for the containment reference '<code>org.eclipse.bpmn2.DocumentRoot#getPerformer Performer</code>'. | getDocumentRoot_Performer | {
"repo_name": "Rikkola/kie-wb-common",
"path": "kie-wb-common-stunner/kie-wb-common-stunner-sets/kie-wb-common-stunner-bpmn/kie-wb-common-stunner-bpmn-emf/src/main/java/org/eclipse/bpmn2/Bpmn2Package.java",
"license": "apache-2.0",
"size": 929298
} | [
"org.eclipse.emf.ecore.EReference"
] | import org.eclipse.emf.ecore.EReference; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 2,124,002 |
@Test
public void getMinistryNamesSuccessTest() {
final List<String> list = esvApi.getMinistryNames();
assertNotNull(list);
assertEquals(17, list.size());
} | void function() { final List<String> list = esvApi.getMinistryNames(); assertNotNull(list); assertEquals(17, list.size()); } | /**
* Gets the ministry names success test.
*
* @return the ministry names success test
*/ | Gets the ministry names success test | getMinistryNamesSuccessTest | {
"repo_name": "Hack23/cia",
"path": "service.external.esv/src/test/java/com/hack23/cia/service/external/esv/impl/EsvApiITest.java",
"license": "apache-2.0",
"size": 13308
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 866,539 |
@PUT
@Path("{id}")
public Response put(
@Context UriInfo uriInfo,
@Context HttpServletRequest request,
@PathParam("id") UUID uuid,
PermissionPojo pojo) {
return OpenInfraResponseBuilder.putResponse(
new PermissionRbac().createOrUpdate(
OpenInfraHttpMethod.valueOf(request.getMethod()),
uriInfo, uuid, pojo));
}
| @Path("{id}") Response function( @Context UriInfo uriInfo, @Context HttpServletRequest request, @PathParam("id") UUID uuid, PermissionPojo pojo) { return OpenInfraResponseBuilder.putResponse( new PermissionRbac().createOrUpdate( OpenInfraHttpMethod.valueOf(request.getMethod()), uriInfo, uuid, pojo)); } | /**
* This resource changes an existing permission.
*
* @param uriInfo
* @param request
* @param uuid the UUID of the permission which should be changed
* @param pojo the content to change
* @return the UUID of the changed object
*/ | This resource changes an existing permission | put | {
"repo_name": "OpenInfRA/core",
"path": "openinfra_core/src/main/java/de/btu/openinfra/backend/rest/rbac/PermissionResource.java",
"license": "gpl-3.0",
"size": 5006
} | [
"de.btu.openinfra.backend.db.pojos.rbac.PermissionPojo",
"de.btu.openinfra.backend.db.rbac.OpenInfraHttpMethod",
"de.btu.openinfra.backend.db.rbac.rbac.PermissionRbac",
"de.btu.openinfra.backend.rest.OpenInfraResponseBuilder",
"javax.servlet.http.HttpServletRequest",
"javax.ws.rs.Path",
"javax.ws.rs.PathParam",
"javax.ws.rs.core.Context",
"javax.ws.rs.core.Response",
"javax.ws.rs.core.UriInfo"
] | import de.btu.openinfra.backend.db.pojos.rbac.PermissionPojo; import de.btu.openinfra.backend.db.rbac.OpenInfraHttpMethod; import de.btu.openinfra.backend.db.rbac.rbac.PermissionRbac; import de.btu.openinfra.backend.rest.OpenInfraResponseBuilder; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.core.Context; import javax.ws.rs.core.Response; import javax.ws.rs.core.UriInfo; | import de.btu.openinfra.backend.db.pojos.rbac.*; import de.btu.openinfra.backend.db.rbac.*; import de.btu.openinfra.backend.db.rbac.rbac.*; import de.btu.openinfra.backend.rest.*; import javax.servlet.http.*; import javax.ws.rs.*; import javax.ws.rs.core.*; | [
"de.btu.openinfra",
"javax.servlet",
"javax.ws"
] | de.btu.openinfra; javax.servlet; javax.ws; | 1,104,457 |
public static byte[] getBytes(Path self) throws IOException {
return IOGroovyMethods.getBytes(Files.newInputStream(self));
} | static byte[] function(Path self) throws IOException { return IOGroovyMethods.getBytes(Files.newInputStream(self)); } | /**
* Read the content of the Path and returns it as a byte[].
*
* @param self the file whose content we want to read
* @return a String containing the content of the file
* @throws java.io.IOException if an IOException occurs.
* @since 2.3.0
*/ | Read the content of the Path and returns it as a byte[] | getBytes | {
"repo_name": "paulk-asert/groovy",
"path": "subprojects/groovy-nio/src/main/java/org/apache/groovy/nio/extensions/NioExtensions.java",
"license": "apache-2.0",
"size": 88073
} | [
"java.io.IOException",
"java.nio.file.Files",
"java.nio.file.Path",
"org.codehaus.groovy.runtime.IOGroovyMethods"
] | import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import org.codehaus.groovy.runtime.IOGroovyMethods; | import java.io.*; import java.nio.file.*; import org.codehaus.groovy.runtime.*; | [
"java.io",
"java.nio",
"org.codehaus.groovy"
] | java.io; java.nio; org.codehaus.groovy; | 2,350,848 |
public static boolean delete(String filePath) {
File file = new File(filePath);
return delete(file);
} | static boolean function(String filePath) { File file = new File(filePath); return delete(file); } | /**
* Delete file
*
* @param filePath filePath
* @return Delete redult [boolean]
*/ | Delete file | delete | {
"repo_name": "Jusenr/androidtools",
"path": "toolslibrary/src/main/java/com/jusenr/toolslibrary/utils/FileUtils.java",
"license": "apache-2.0",
"size": 21075
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 1,304,284 |
@SuppressWarnings("deprecation")
private static <T extends AutoCloseable> TimeCacheMap<String, T> makeBlobCacheMap(Map<String, Object> conf) {
return new TimeCacheMap<>(ObjectReader.getInt(conf.get(DaemonConfig.NIMBUS_BLOBSTORE_EXPIRATION_SECS), 600),
(id, stream) -> {
try {
if (stream instanceof AtomicOutputStream) {
((AtomicOutputStream) stream).cancel();
} else {
stream.close();
}
} catch (Exception e) {
throw new RuntimeException(e);
}
});
} | @SuppressWarnings(STR) static <T extends AutoCloseable> TimeCacheMap<String, T> function(Map<String, Object> conf) { return new TimeCacheMap<>(ObjectReader.getInt(conf.get(DaemonConfig.NIMBUS_BLOBSTORE_EXPIRATION_SECS), 600), (id, stream) -> { try { if (stream instanceof AtomicOutputStream) { ((AtomicOutputStream) stream).cancel(); } else { stream.close(); } } catch (Exception e) { throw new RuntimeException(e); } }); } | /**
* Constructs a TimeCacheMap instance with a blob store timeout whose
* expiration callback invokes cancel on the value held by an expired entry when
* that value is an AtomicOutputStream and calls close otherwise.
* @param conf the config to use
* @return the newly created map
*/ | Constructs a TimeCacheMap instance with a blob store timeout whose expiration callback invokes cancel on the value held by an expired entry when that value is an AtomicOutputStream and calls close otherwise | makeBlobCacheMap | {
"repo_name": "0x726d77/storm",
"path": "storm-server/src/main/java/org/apache/storm/daemon/nimbus/Nimbus.java",
"license": "apache-2.0",
"size": 205146
} | [
"java.util.Map",
"org.apache.storm.DaemonConfig",
"org.apache.storm.blobstore.AtomicOutputStream",
"org.apache.storm.utils.ObjectReader",
"org.apache.storm.utils.TimeCacheMap"
] | import java.util.Map; import org.apache.storm.DaemonConfig; import org.apache.storm.blobstore.AtomicOutputStream; import org.apache.storm.utils.ObjectReader; import org.apache.storm.utils.TimeCacheMap; | import java.util.*; import org.apache.storm.*; import org.apache.storm.blobstore.*; import org.apache.storm.utils.*; | [
"java.util",
"org.apache.storm"
] | java.util; org.apache.storm; | 429,550 |
private Map<String, ProcessedGradeItem> createCommentMap(final List<ProcessedGradeItem> items) {
final List<ProcessedGradeItem> gbItems = filterListByType(items, Type.GB_ITEM);
final List<ProcessedGradeItem> commentItems = filterListByType(items, Type.COMMENT);
final Map<String, ProcessedGradeItem> rval = new HashMap<>();
//match up the gradebook items with the comment columns. comment columns have the same title.
gbItems.forEach(gbItem -> {
final ProcessedGradeItem commentItem = commentItems.stream().filter(item -> StringUtils.equalsIgnoreCase(item.getItemTitle(), gbItem.getItemTitle())).findFirst().orElse(null);
rval.put(gbItem.getItemTitle(), commentItem);
});
return rval;
} | Map<String, ProcessedGradeItem> function(final List<ProcessedGradeItem> items) { final List<ProcessedGradeItem> gbItems = filterListByType(items, Type.GB_ITEM); final List<ProcessedGradeItem> commentItems = filterListByType(items, Type.COMMENT); final Map<String, ProcessedGradeItem> rval = new HashMap<>(); gbItems.forEach(gbItem -> { final ProcessedGradeItem commentItem = commentItems.stream().filter(item -> StringUtils.equalsIgnoreCase(item.getItemTitle(), gbItem.getItemTitle())).findFirst().orElse(null); rval.put(gbItem.getItemTitle(), commentItem); }); return rval; } | /**
* Map a gradebook item to its comment column, if any. All gb items will have an entry, the value may be null if there are no comments.
* Entries are keyed on the gradebook item title.
* @param items
* @return
*/ | Map a gradebook item to its comment column, if any. All gb items will have an entry, the value may be null if there are no comments. Entries are keyed on the gradebook item title | createCommentMap | {
"repo_name": "ouit0408/sakai",
"path": "gradebookng/tool/src/java/org/sakaiproject/gradebookng/tool/panels/importExport/GradeItemImportSelectionStep.java",
"license": "apache-2.0",
"size": 15470
} | [
"java.util.HashMap",
"java.util.List",
"java.util.Map",
"org.apache.commons.lang.StringUtils",
"org.sakaiproject.gradebookng.business.model.ProcessedGradeItem"
] | import java.util.HashMap; import java.util.List; import java.util.Map; import org.apache.commons.lang.StringUtils; import org.sakaiproject.gradebookng.business.model.ProcessedGradeItem; | import java.util.*; import org.apache.commons.lang.*; import org.sakaiproject.gradebookng.business.model.*; | [
"java.util",
"org.apache.commons",
"org.sakaiproject.gradebookng"
] | java.util; org.apache.commons; org.sakaiproject.gradebookng; | 2,558,287 |
public void testInsertEndNormal() {
CmsJspNavElement a = dummyNav("foo", 1);
CmsJspNavElement b = dummyNav("bar", 2);
CmsJspNavElement c = dummyNav("baz", 3);
CmsSitemapNavPosCalculator npc = new CmsSitemapNavPosCalculator(list(a, b, c), dummyRes("fasdf"), 3);
List<CmsJspNavElement> navs = npc.getResultList();
int pos = npc.getInsertPositionInResult();
checkIntegrity(navs, pos);
assertTrue(checkIncreasing(navs));
System.out.print("testInsertEndNormal=");
printNav(navs);
}
| void function() { CmsJspNavElement a = dummyNav("foo", 1); CmsJspNavElement b = dummyNav("bar", 2); CmsJspNavElement c = dummyNav("baz", 3); CmsSitemapNavPosCalculator npc = new CmsSitemapNavPosCalculator(list(a, b, c), dummyRes("fasdf"), 3); List<CmsJspNavElement> navs = npc.getResultList(); int pos = npc.getInsertPositionInResult(); checkIntegrity(navs, pos); assertTrue(checkIncreasing(navs)); System.out.print(STR); printNav(navs); } | /**
* Tests insertion at the end of the navigation.<p>
*/ | Tests insertion at the end of the navigation | testInsertEndNormal | {
"repo_name": "ggiudetti/opencms-core",
"path": "test/org/opencms/ade/sitemap/TestNavPosCalculator.java",
"license": "lgpl-2.1",
"size": 12618
} | [
"java.util.List",
"org.opencms.jsp.CmsJspNavElement"
] | import java.util.List; import org.opencms.jsp.CmsJspNavElement; | import java.util.*; import org.opencms.jsp.*; | [
"java.util",
"org.opencms.jsp"
] | java.util; org.opencms.jsp; | 354,514 |
public boolean containsCountry (@Nullable final Locale aCountry)
{
return aCountry != null && containsCountry (aCountry.getCountry ());
} | boolean function (@Nullable final Locale aCountry) { return aCountry != null && containsCountry (aCountry.getCountry ()); } | /**
* Check if the passed country is known.
*
* @param aCountry
* The country to check. May be <code>null</code>.
* @return <code>true</code> if the passed country is contained,
* <code>false</code> otherwise.
*/ | Check if the passed country is known | containsCountry | {
"repo_name": "phax/ph-commons",
"path": "ph-commons/src/main/java/com/helger/commons/locale/country/CountryCache.java",
"license": "apache-2.0",
"size": 9415
} | [
"java.util.Locale",
"javax.annotation.Nullable"
] | import java.util.Locale; import javax.annotation.Nullable; | import java.util.*; import javax.annotation.*; | [
"java.util",
"javax.annotation"
] | java.util; javax.annotation; | 22,007 |
@SuppressWarnings("deprecation") // test of deprecated function
@Test
public void testPAssertHashCodeIterableUnsupported() throws Exception {
thrown.expect(UnsupportedOperationException.class);
thrown.expectMessage(".hashCode() is not supported.");
PCollection<Integer> pcollection = pipeline.apply(Create.of(42));
PAssert.that(pcollection).hashCode();
} | @SuppressWarnings(STR) void function() throws Exception { thrown.expect(UnsupportedOperationException.class); thrown.expectMessage(STR); PCollection<Integer> pcollection = pipeline.apply(Create.of(42)); PAssert.that(pcollection).hashCode(); } | /**
* Test that {@code PAssert.thatIterable().hashCode()} is unsupported.
* See {@link #testPAssertEqualsIterableUnsupported}.
*/ | Test that PAssert.thatIterable().hashCode() is unsupported. See <code>#testPAssertEqualsIterableUnsupported</code> | testPAssertHashCodeIterableUnsupported | {
"repo_name": "tgroh/incubator-beam",
"path": "sdks/java/core/src/test/java/org/apache/beam/sdk/testing/PAssertTest.java",
"license": "apache-2.0",
"size": 21285
} | [
"org.apache.beam.sdk.transforms.Create",
"org.apache.beam.sdk.values.PCollection"
] | import org.apache.beam.sdk.transforms.Create; import org.apache.beam.sdk.values.PCollection; | import org.apache.beam.sdk.transforms.*; import org.apache.beam.sdk.values.*; | [
"org.apache.beam"
] | org.apache.beam; | 1,911,439 |
@Override public MeasureRawColumnChunk readRawMeasureChunk(FileReader fileReader, int columnIndex)
throws IOException {
DataChunk dataChunk = measureColumnChunks.get(columnIndex);
ByteBuffer buffer = fileReader
.readByteBuffer(filePath, dataChunk.getDataPageOffset(), dataChunk.getDataPageLength());
MeasureRawColumnChunk rawColumnChunk = new MeasureRawColumnChunk(columnIndex, buffer, 0,
dataChunk.getDataPageLength(), this);
rawColumnChunk.setFileReader(fileReader);
rawColumnChunk.setPagesCount(1);
rawColumnChunk.setRowCount(new int[] { numberOfRows });
return rawColumnChunk;
} | @Override MeasureRawColumnChunk function(FileReader fileReader, int columnIndex) throws IOException { DataChunk dataChunk = measureColumnChunks.get(columnIndex); ByteBuffer buffer = fileReader .readByteBuffer(filePath, dataChunk.getDataPageOffset(), dataChunk.getDataPageLength()); MeasureRawColumnChunk rawColumnChunk = new MeasureRawColumnChunk(columnIndex, buffer, 0, dataChunk.getDataPageLength(), this); rawColumnChunk.setFileReader(fileReader); rawColumnChunk.setPagesCount(1); rawColumnChunk.setRowCount(new int[] { numberOfRows }); return rawColumnChunk; } | /**
* Method to read the blocks data based on block index
*
* @param fileReader file reader to read the blocks
* @param columnIndex column to be read
* @return measure data chunk
*/ | Method to read the blocks data based on block index | readRawMeasureChunk | {
"repo_name": "sgururajshetty/carbondata",
"path": "core/src/main/java/org/apache/carbondata/core/datastore/chunk/reader/measure/v1/CompressedMeasureChunkFileBasedReaderV1.java",
"license": "apache-2.0",
"size": 4628
} | [
"java.io.IOException",
"java.nio.ByteBuffer",
"org.apache.carbondata.core.datastore.FileReader",
"org.apache.carbondata.core.datastore.chunk.impl.MeasureRawColumnChunk",
"org.apache.carbondata.core.metadata.blocklet.datachunk.DataChunk"
] | import java.io.IOException; import java.nio.ByteBuffer; import org.apache.carbondata.core.datastore.FileReader; import org.apache.carbondata.core.datastore.chunk.impl.MeasureRawColumnChunk; import org.apache.carbondata.core.metadata.blocklet.datachunk.DataChunk; | import java.io.*; import java.nio.*; import org.apache.carbondata.core.datastore.*; import org.apache.carbondata.core.datastore.chunk.impl.*; import org.apache.carbondata.core.metadata.blocklet.datachunk.*; | [
"java.io",
"java.nio",
"org.apache.carbondata"
] | java.io; java.nio; org.apache.carbondata; | 2,024,358 |
public List<Edge<S, L>> getIncoming() {
return incoming;
} | List<Edge<S, L>> function() { return incoming; } | /**
* Retrieves the list of incoming edges.
*
* @return the incoming edges.
*/ | Retrieves the list of incoming edges | getIncoming | {
"repo_name": "LearnLib/automatalib",
"path": "util/src/main/java/net/automatalib/util/minimizer/State.java",
"license": "apache-2.0",
"size": 6962
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,462,705 |
@Test
public void testSendDataDigiPoint6416() throws TimeoutException, XBeeException {
// Setup the protocol of the XBee device to be Point-to-Multipoint.
Mockito.when(xbeeDevice.getXBeeProtocol()).thenReturn(XBeeProtocol.DIGI_POINT);
// Do nothing when the sendDataAsync(XBee64BitAddress, XBee16BitAddress, byte[]) method is called.
Mockito.doNothing().when(xbeeDevice).sendDataAsync(Mockito.any(XBee64BitAddress.class), Mockito.any(XBee16BitAddress.class), Mockito.any(byte[].class));
xbeeDevice.sendDataAsync(mockedRemoteDevice, DATA.getBytes());
// Verify the sendDataAsync(XBee64BitAddress, XBee16BitAddress, byte[]) method was called.
Mockito.verify(xbeeDevice, Mockito.times(1)).sendDataAsync(Mockito.eq(XBEE_64BIT_ADDRESS), Mockito.eq(XBEE_16BIT_ADDRESS), Mockito.eq(DATA.getBytes()));
}
| void function() throws TimeoutException, XBeeException { Mockito.when(xbeeDevice.getXBeeProtocol()).thenReturn(XBeeProtocol.DIGI_POINT); Mockito.doNothing().when(xbeeDevice).sendDataAsync(Mockito.any(XBee64BitAddress.class), Mockito.any(XBee16BitAddress.class), Mockito.any(byte[].class)); xbeeDevice.sendDataAsync(mockedRemoteDevice, DATA.getBytes()); Mockito.verify(xbeeDevice, Mockito.times(1)).sendDataAsync(Mockito.eq(XBEE_64BIT_ADDRESS), Mockito.eq(XBEE_16BIT_ADDRESS), Mockito.eq(DATA.getBytes())); } | /**
* Test method for {@link com.digi.xbee.api.XBeeDevice#sendDataAsync(RemoteXBeeDevice, byte[])}.
*
* <p>Verify that async. data can be sent if the protocol of the XBee device is Point-to-Multipoint and
* the remote device has the 64-bit and 16-bit addresses correctly configured.</p>
*
* @throws XBeeException
* @throws TimeoutException
*/ | Test method for <code>com.digi.xbee.api.XBeeDevice#sendDataAsync(RemoteXBeeDevice, byte[])</code>. Verify that async. data can be sent if the protocol of the XBee device is Point-to-Multipoint and the remote device has the 64-bit and 16-bit addresses correctly configured | testSendDataDigiPoint6416 | {
"repo_name": "digidotcom/XBeeJavaLibrary",
"path": "library/src/test/java/com/digi/xbee/api/SendDataAsyncRemoteDeviceTest.java",
"license": "mpl-2.0",
"size": 10830
} | [
"com.digi.xbee.api.exceptions.TimeoutException",
"com.digi.xbee.api.exceptions.XBeeException",
"com.digi.xbee.api.models.XBee16BitAddress",
"com.digi.xbee.api.models.XBee64BitAddress",
"com.digi.xbee.api.models.XBeeProtocol",
"org.mockito.Mockito"
] | import com.digi.xbee.api.exceptions.TimeoutException; import com.digi.xbee.api.exceptions.XBeeException; import com.digi.xbee.api.models.XBee16BitAddress; import com.digi.xbee.api.models.XBee64BitAddress; import com.digi.xbee.api.models.XBeeProtocol; import org.mockito.Mockito; | import com.digi.xbee.api.exceptions.*; import com.digi.xbee.api.models.*; import org.mockito.*; | [
"com.digi.xbee",
"org.mockito"
] | com.digi.xbee; org.mockito; | 554,013 |
public static Polygon geoCircle(Point center, double range)
{
return (Polygon) geoRingOrPolygon(center, range, true);
}
| static Polygon function(Point center, double range) { return (Polygon) geoRingOrPolygon(center, range, true); } | /**
* creates a circle with center in specified point (lon, lat) and specified radius in meters (range)
* @param center
* @param range
* @param polygon
* @return
*/ | creates a circle with center in specified point (lon, lat) and specified radius in meters (range) | geoCircle | {
"repo_name": "theanuradha/debrief",
"path": "org.mwc.debrief.satc.core/src/com/planetmayo/debrief/satc/util/GeoSupport.java",
"license": "epl-1.0",
"size": 7354
} | [
"com.vividsolutions.jts.geom.Point",
"com.vividsolutions.jts.geom.Polygon"
] | import com.vividsolutions.jts.geom.Point; import com.vividsolutions.jts.geom.Polygon; | import com.vividsolutions.jts.geom.*; | [
"com.vividsolutions.jts"
] | com.vividsolutions.jts; | 126,052 |
private static void writeAffinityBackupFilter(BinaryRawWriter out, Object filter) {
if (filter instanceof ClusterNodeAttributeAffinityBackupFilter) {
ClusterNodeAttributeAffinityBackupFilter backupFilter = (ClusterNodeAttributeAffinityBackupFilter)filter;
String[] attrs = backupFilter.getAttributeNames();
out.writeInt(attrs.length);
for (String attr : attrs)
out.writeString(attr);
}
else
out.writeInt(-1);
} | static void function(BinaryRawWriter out, Object filter) { if (filter instanceof ClusterNodeAttributeAffinityBackupFilter) { ClusterNodeAttributeAffinityBackupFilter backupFilter = (ClusterNodeAttributeAffinityBackupFilter)filter; String[] attrs = backupFilter.getAttributeNames(); out.writeInt(attrs.length); for (String attr : attrs) out.writeString(attr); } else out.writeInt(-1); } | /**
* Writes affinity backup filter.
*
* @param out Stream.
* @param filter Filter.
*/ | Writes affinity backup filter | writeAffinityBackupFilter | {
"repo_name": "NSAmelchev/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java",
"license": "apache-2.0",
"size": 87032
} | [
"org.apache.ignite.binary.BinaryRawWriter",
"org.apache.ignite.cache.affinity.rendezvous.ClusterNodeAttributeAffinityBackupFilter"
] | import org.apache.ignite.binary.BinaryRawWriter; import org.apache.ignite.cache.affinity.rendezvous.ClusterNodeAttributeAffinityBackupFilter; | import org.apache.ignite.binary.*; import org.apache.ignite.cache.affinity.rendezvous.*; | [
"org.apache.ignite"
] | org.apache.ignite; | 1,923,258 |
private Array onBorderDash(DatasetContext context, BorderDashCallback<DatasetContext> callback) {
// gets value
List<Integer> result = ScriptableUtils.getOptionValue(context, callback);
// default result
return ArrayInteger.fromOrEmpty(result);
}
/**
* Returns a {@link CubicInterpolationMode} when the callback has been activated.
*
* @param context native object as context.
* @param callback cubic interpolation mode callback instance
* @param defaultValue default value of cubic interpolation mode
* @return a object property value, as {@link CubicInterpolationMode} | Array function(DatasetContext context, BorderDashCallback<DatasetContext> callback) { List<Integer> result = ScriptableUtils.getOptionValue(context, callback); return ArrayInteger.fromOrEmpty(result); } /** * Returns a {@link CubicInterpolationMode} when the callback has been activated. * * @param context native object as context. * @param callback cubic interpolation mode callback instance * @param defaultValue default value of cubic interpolation mode * @return a object property value, as {@link CubicInterpolationMode} | /**
* Returns an array of integer when the callback has been activated.
*
* @param context native object as context.
* @param callback border dash callback instance
* @return an array of integer
*/ | Returns an array of integer when the callback has been activated | onBorderDash | {
"repo_name": "pepstock-org/Charba",
"path": "src/org/pepstock/charba/client/configuration/Line.java",
"license": "apache-2.0",
"size": 27516
} | [
"java.util.List",
"org.pepstock.charba.client.callbacks.BorderDashCallback",
"org.pepstock.charba.client.callbacks.DatasetContext",
"org.pepstock.charba.client.callbacks.ScriptableUtils",
"org.pepstock.charba.client.commons.Array",
"org.pepstock.charba.client.commons.ArrayInteger",
"org.pepstock.charba.client.enums.CubicInterpolationMode"
] | import java.util.List; import org.pepstock.charba.client.callbacks.BorderDashCallback; import org.pepstock.charba.client.callbacks.DatasetContext; import org.pepstock.charba.client.callbacks.ScriptableUtils; import org.pepstock.charba.client.commons.Array; import org.pepstock.charba.client.commons.ArrayInteger; import org.pepstock.charba.client.enums.CubicInterpolationMode; | import java.util.*; import org.pepstock.charba.client.callbacks.*; import org.pepstock.charba.client.commons.*; import org.pepstock.charba.client.enums.*; | [
"java.util",
"org.pepstock.charba"
] | java.util; org.pepstock.charba; | 2,031,273 |
public void cacheResult(List<whp_criteria_lkp> whp_criteria_lkps) {
for (whp_criteria_lkp whp_criteria_lkp : whp_criteria_lkps) {
if (EntityCacheUtil.getResult(
whp_criteria_lkpModelImpl.ENTITY_CACHE_ENABLED,
whp_criteria_lkpImpl.class,
whp_criteria_lkp.getPrimaryKey()) == null) {
cacheResult(whp_criteria_lkp);
}
else {
whp_criteria_lkp.resetOriginalValues();
}
}
} | void function(List<whp_criteria_lkp> whp_criteria_lkps) { for (whp_criteria_lkp whp_criteria_lkp : whp_criteria_lkps) { if (EntityCacheUtil.getResult( whp_criteria_lkpModelImpl.ENTITY_CACHE_ENABLED, whp_criteria_lkpImpl.class, whp_criteria_lkp.getPrimaryKey()) == null) { cacheResult(whp_criteria_lkp); } else { whp_criteria_lkp.resetOriginalValues(); } } } | /**
* Caches the whp_criteria_lkps in the entity cache if it is enabled.
*
* @param whp_criteria_lkps the whp_criteria_lkps
*/ | Caches the whp_criteria_lkps in the entity cache if it is enabled | cacheResult | {
"repo_name": "iucn-whp/world-heritage-outlook",
"path": "portlets/iucn-dbservice-portlet/docroot/WEB-INF/src/com/iucn/whp/dbservice/service/persistence/whp_criteria_lkpPersistenceImpl.java",
"license": "gpl-2.0",
"size": 34872
} | [
"com.liferay.portal.kernel.dao.orm.EntityCacheUtil",
"java.util.List"
] | import com.liferay.portal.kernel.dao.orm.EntityCacheUtil; import java.util.List; | import com.liferay.portal.kernel.dao.orm.*; import java.util.*; | [
"com.liferay.portal",
"java.util"
] | com.liferay.portal; java.util; | 261,596 |
public void showSourceFeedback(Request request) {
if (REQ_MOVE_BENDPOINT.equals(request.getType()))
showMoveBendpointFeedback((BendpointRequest) request);
else if (REQ_CREATE_BENDPOINT.equals(request.getType()))
showCreateBendpointFeedback((BendpointRequest) request);
}
| void function(Request request) { if (REQ_MOVE_BENDPOINT.equals(request.getType())) showMoveBendpointFeedback((BendpointRequest) request); else if (REQ_CREATE_BENDPOINT.equals(request.getType())) showCreateBendpointFeedback((BendpointRequest) request); } | /**
* Shows feedback when appropriate. Calls a different method depending on
* the request type.
*
* @see #showCreateBendpointFeedback(BendpointRequest)
* @see #showMoveBendpointFeedback(BendpointRequest)
* @param request
* the Request
*/ | Shows feedback when appropriate. Calls a different method depending on the request type | showSourceFeedback | {
"repo_name": "opensagres/xdocreport.eclipse",
"path": "rap/org.eclipse.gef/src/org/eclipse/gef/editpolicies/BendpointEditPolicy.java",
"license": "lgpl-2.1",
"size": 13611
} | [
"org.eclipse.gef.Request",
"org.eclipse.gef.requests.BendpointRequest"
] | import org.eclipse.gef.Request; import org.eclipse.gef.requests.BendpointRequest; | import org.eclipse.gef.*; import org.eclipse.gef.requests.*; | [
"org.eclipse.gef"
] | org.eclipse.gef; | 2,308,802 |
public double[] SFVec3d(String value) throws InvalidFieldFormatException {
throw new InvalidFieldFormatException(DOUBLE_SPT_MSG);
} | double[] function(String value) throws InvalidFieldFormatException { throw new InvalidFieldFormatException(DOUBLE_SPT_MSG); } | /**
* Parse an SFVec3d value. If there is more than one float value in the string
* it will be ignored.
*
* @param value The raw value as a string to be parsed
* @return The three components of the vector
* @throws InvalidFieldFormatException The field does not match the
* required profile
*/ | Parse an SFVec3d value. If there is more than one float value in the string it will be ignored | SFVec3d | {
"repo_name": "Norkart/NK-VirtualGlobe",
"path": "Xj3D/src/java/org/web3d/parser/vrml97/VRML97FieldReader.java",
"license": "gpl-2.0",
"size": 61534
} | [
"org.web3d.vrml.lang.InvalidFieldFormatException"
] | import org.web3d.vrml.lang.InvalidFieldFormatException; | import org.web3d.vrml.lang.*; | [
"org.web3d.vrml"
] | org.web3d.vrml; | 2,840,441 |
public Factory setTransferListener(@Nullable TransferListener transferListener) {
this.transferListener = transferListener;
return this;
} | Factory function(@Nullable TransferListener transferListener) { this.transferListener = transferListener; return this; } | /**
* Sets the {@link TransferListener} that will be used.
*
* <p>The default is {@code null}.
*
* <p>See {@link DataSource#addTransferListener(TransferListener)}.
*
* @param transferListener The listener that will be used.
* @return This factory.
*/ | Sets the <code>TransferListener</code> that will be used. The default is null. See <code>DataSource#addTransferListener(TransferListener)</code> | setTransferListener | {
"repo_name": "androidx/media",
"path": "libraries/datasource/src/main/java/androidx/media3/datasource/DefaultHttpDataSource.java",
"license": "apache-2.0",
"size": 32396
} | [
"androidx.annotation.Nullable"
] | import androidx.annotation.Nullable; | import androidx.annotation.*; | [
"androidx.annotation"
] | androidx.annotation; | 1,588,957 |
public void putBufferedImageAsMonochrome(BufferedImage bi,
Rectangle sourceRegion, boolean writeAsMonochrome2) {
Rectangle rect;
Rectangle sourceRect;
rect = new Rectangle(bi.getWidth(), bi.getHeight());
if (sourceRegion == null) {
sourceRect = rect;
} else {
sourceRect = rect.intersection(sourceRegion);
}
//IllegalArgumentException thrown if sourceRect is empty
if (sourceRect.isEmpty()) { throw new IllegalArgumentException(
"Source region is empty." + this); }
int dataType = bi.getType();
int width = sourceRect.width;
int height = sourceRect.height;
boolean signed = false;
int bitsAllocated = (dataType == BufferedImage.TYPE_BYTE_GRAY) ? 8 : 16;
int bitsStored = bitsAllocated;
int highBit = bitsStored - 1;
// Image IE, Image Pixel Module, PS 3.3 - C.7.6.3, M
putUS(Tags.SamplesPerPixel, 1);// Type 1
//TODO need seperate cases for encoding monochrome1/2 ??
if (writeAsMonochrome2) {
putCS(Tags.PhotometricInterpretation, "MONOCHROME2");
} // Type 1
else {
putCS(Tags.PhotometricInterpretation, "MONOCHROME1");
}// Type 1
putUS(Tags.Rows, height);// Type 1
putUS(Tags.Columns, width);// Type 1
putUS(Tags.BitsAllocated, bitsAllocated);// Type 1
putUS(Tags.BitsStored, bitsStored);// Type 1
putUS(Tags.HighBit, highBit);// Type 1
putUS(Tags.PixelRepresentation, (signed) ? 1 : 0);// Type 1; 0x0=unsigned int, 0x1=2's complement
putIS(Tags.PixelAspectRatio, new int[] { 1, 1});// Type 1C, if vertical/horizontal != 1
int max;// Type 1C, if vertical/horizontal != 1
int min;// Type 1C, if vertical/horizontal != 1
int value;
int[] pixels = bi.getRaster().getPixels(sourceRect.x,
sourceRect.y,
width,
height,
(int[]) null);
//find min/max
min = max = pixels[0];
for (int i = 1; i < pixels.length; i++) {
value = pixels[i];
if (value > max) {
max = value;
} else if (value < min) {
min = value;
}
}
//write pixels to byte buffer
byte[] out;
ByteBuffer byteBuf;
// hacklaender, 2006.04.18: Block replaced
// if (bitsAllocated == 8) {
// out = new byte[pixels.length];
// for (int i = 1; i < pixels.length; i++) {
// out[i] = (byte) (pixels[(i % 2 == 0) ? i + 1 : i - 1] & 0xff);
// }
// } else {//bitsAllocated == 16
// out = new byte[pixels.length * 2];
// for (int i = 1; i < pixels.length;) {
// out[i++] = (byte) ((pixels[i] >> 8) & 0xff);
// out[i++] = (byte) (pixels[i] & 0xff);
// }
// }
// Set Pixel data
if (bitsAllocated <= 8) {
//bitsAllocated <= 8
out = new byte[pixels.length];
// Pixeldata must be OW if transfer syntax is Implicit VR/Little Endian
for (int pixelsIdx = 0; pixelsIdx < pixels.length; pixelsIdx++) {
out[pixelsIdx] = (byte) (pixels[(pixelsIdx % 2 == 0) ? pixelsIdx + 1 : pixelsIdx - 1] & 0xff);
}
byteBuf = ByteBuffer.wrap(out);
putOW(Tags.PixelData, byteBuf);
// Pixeldata may be OW or OB
// for (int pixelsIdx = 0; pixelsIdx < pixels.length; pixelsIdx++) {
// out[pixelsIdx] = (byte) (pixels[pixelsIdx] & 0xff);
// }
// byteBuf = ByteBuffer.wrap(out);
// putOB(Tags.PixelData, byteBuf);
} else {
//bitsAllocated > 8
out = new byte[pixels.length * 2];
int outIdx = 0;
for (int pixelsIdx = 0; pixelsIdx < pixels.length; pixelsIdx++) {
out[outIdx++] = (byte) ((pixels[pixelsIdx] >> 8) & 0xff);
out[outIdx++] = (byte) (pixels[pixelsIdx] & 0xff);
}
byteBuf = ByteBuffer.wrap(out);
putOW(Tags.PixelData, byteBuf);
}
// hacklaender, 2006.04.18
// byteBuf = ByteBuffer.wrap(out);
// set pixeldata
// putOW(Tags.PixelData, byteBuf);
//set min/max pixel values
putSS(Tags.SmallestImagePixelValue, min);// Type 3
putSS(Tags.LargestImagePixelValue, max);// Type 3
// Image IE, Modality LUT Module, PS 3.3 - C.11.1, U
// don't overwrite if the Dataset already contains a Rescale Intercept/Slope
// hacklaender, 2006.04.18
// float rs = getFloat(Tags.RescaleSlope, 1).floatValue();
// float ri = getFloat(Tags.RescaleIntercept, 0).floatValue();
float rs = getFloat(Tags.RescaleSlope, (float) 1.0);
float ri = getFloat(Tags.RescaleIntercept, (float) 0.0);
if (!contains(Tags.RescaleIntercept)) {
putDS(Tags.RescaleIntercept, ri);// Type 1C; ModalityLUTSequence is not present
putDS(Tags.RescaleSlope, rs);// Type 1C; ModalityLUTSequence is not present
putLO(Tags.RescaleType, "PIXELVALUE");// Type 1C; ModalityLUTSequence is not present; arbitrary text
}
// Image IE, VOI LUT Module, PS 3.3 - C.11.2, U
// don't overwrite if the Dataset already contains a Window Center/Width
if (!contains(Tags.WindowCenter)) {
String[] wc = { Float.toString((rs * (max + min)) / 2 + ri)};
putDS(Tags.WindowCenter, wc);// Type 3
String[] ww = { Float.toString((rs * (max - min)) / 2)};
putDS(Tags.WindowWidth, ww);// Type 1C; WindowCenter is present
}
} | void function(BufferedImage bi, Rectangle sourceRegion, boolean writeAsMonochrome2) { Rectangle rect; Rectangle sourceRect; rect = new Rectangle(bi.getWidth(), bi.getHeight()); if (sourceRegion == null) { sourceRect = rect; } else { sourceRect = rect.intersection(sourceRegion); } if (sourceRect.isEmpty()) { throw new IllegalArgumentException( STR + this); } int dataType = bi.getType(); int width = sourceRect.width; int height = sourceRect.height; boolean signed = false; int bitsAllocated = (dataType == BufferedImage.TYPE_BYTE_GRAY) ? 8 : 16; int bitsStored = bitsAllocated; int highBit = bitsStored - 1; putUS(Tags.SamplesPerPixel, 1); if (writeAsMonochrome2) { putCS(Tags.PhotometricInterpretation, STR); } else { putCS(Tags.PhotometricInterpretation, STR); } putUS(Tags.Rows, height); putUS(Tags.Columns, width); putUS(Tags.BitsAllocated, bitsAllocated); putUS(Tags.BitsStored, bitsStored); putUS(Tags.HighBit, highBit); putUS(Tags.PixelRepresentation, (signed) ? 1 : 0); putIS(Tags.PixelAspectRatio, new int[] { 1, 1}); int max; int min; int value; int[] pixels = bi.getRaster().getPixels(sourceRect.x, sourceRect.y, width, height, (int[]) null); min = max = pixels[0]; for (int i = 1; i < pixels.length; i++) { value = pixels[i]; if (value > max) { max = value; } else if (value < min) { min = value; } } byte[] out; ByteBuffer byteBuf; if (bitsAllocated <= 8) { out = new byte[pixels.length]; for (int pixelsIdx = 0; pixelsIdx < pixels.length; pixelsIdx++) { out[pixelsIdx] = (byte) (pixels[(pixelsIdx % 2 == 0) ? pixelsIdx + 1 : pixelsIdx - 1] & 0xff); } byteBuf = ByteBuffer.wrap(out); putOW(Tags.PixelData, byteBuf); } else { out = new byte[pixels.length * 2]; int outIdx = 0; for (int pixelsIdx = 0; pixelsIdx < pixels.length; pixelsIdx++) { out[outIdx++] = (byte) ((pixels[pixelsIdx] >> 8) & 0xff); out[outIdx++] = (byte) (pixels[pixelsIdx] & 0xff); } byteBuf = ByteBuffer.wrap(out); putOW(Tags.PixelData, byteBuf); } putSS(Tags.SmallestImagePixelValue, min); putSS(Tags.LargestImagePixelValue, max); float rs = getFloat(Tags.RescaleSlope, (float) 1.0); float ri = getFloat(Tags.RescaleIntercept, (float) 0.0); if (!contains(Tags.RescaleIntercept)) { putDS(Tags.RescaleIntercept, ri); putDS(Tags.RescaleSlope, rs); putLO(Tags.RescaleType, STR); } if (!contains(Tags.WindowCenter)) { String[] wc = { Float.toString((rs * (max + min)) / 2 + ri)}; putDS(Tags.WindowCenter, wc); String[] ww = { Float.toString((rs * (max - min)) / 2)}; putDS(Tags.WindowWidth, ww); } } | /**
* Description of the Method
*
* @param bi Description of the Parameter
* @param sourceRegion Description of the Parameter
* @param writeAsMonochrome2 Description of the Parameter
*/ | Description of the Method | putBufferedImageAsMonochrome | {
"repo_name": "medicayun/medicayundicom",
"path": "dcm4che14/tags/DCM4CHE_1_4_2/src/java/org/dcm4cheri/data/BaseDatasetImpl.java",
"license": "apache-2.0",
"size": 43071
} | [
"java.awt.Rectangle",
"java.awt.image.BufferedImage",
"java.nio.ByteBuffer",
"org.dcm4che.dict.Tags"
] | import java.awt.Rectangle; import java.awt.image.BufferedImage; import java.nio.ByteBuffer; import org.dcm4che.dict.Tags; | import java.awt.*; import java.awt.image.*; import java.nio.*; import org.dcm4che.dict.*; | [
"java.awt",
"java.nio",
"org.dcm4che.dict"
] | java.awt; java.nio; org.dcm4che.dict; | 134,751 |
public Map<String, Object> popSettings(final CidsBeanAggregationRenderer aggregationRenderer) {
final int hashCode = aggregationRenderer.getCidsBeans().hashCode();
final Map<String, Object> settings = configurationMap.remove(hashCode);
configurationStack.remove(hashCode);
if (settings != null) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("configuration settings '" + hashCode + "' removed");
}
} else {
LOGGER.warn("configuration settings '" + hashCode + "' not found!");
}
return settings;
} | Map<String, Object> function(final CidsBeanAggregationRenderer aggregationRenderer) { final int hashCode = aggregationRenderer.getCidsBeans().hashCode(); final Map<String, Object> settings = configurationMap.remove(hashCode); configurationStack.remove(hashCode); if (settings != null) { if (LOGGER.isDebugEnabled()) { LOGGER.debug(STR + hashCode + STR); } } else { LOGGER.warn(STR + hashCode + STR); } return settings; } | /**
* DOCUMENT ME!
*
* @param aggregationRenderer DOCUMENT ME!
*
* @return DOCUMENT ME!
*/ | DOCUMENT ME | popSettings | {
"repo_name": "cismet/cids-custom-udm2020-di",
"path": "src/main/java/de/cismet/cids/custom/udm2020di/tools/RendererConfigurationRegistry.java",
"license": "lgpl-3.0",
"size": 10642
} | [
"de.cismet.cids.tools.metaobjectrenderer.CidsBeanAggregationRenderer",
"java.util.Map"
] | import de.cismet.cids.tools.metaobjectrenderer.CidsBeanAggregationRenderer; import java.util.Map; | import de.cismet.cids.tools.metaobjectrenderer.*; import java.util.*; | [
"de.cismet.cids",
"java.util"
] | de.cismet.cids; java.util; | 2,470,930 |
public Axis getYAxis(String id) throws AxisNotFoundException {
if(!yAxis_.isEmpty()) {
Axis ax;
for(Enumeration it = yAxis_.elements(); it.hasMoreElements();) {
ax = (Axis)it.nextElement();
if(ax.getId() == id) return ax;
}
throw new AxisNotFoundException();
} else {
throw new AxisNotFoundException();
}
} | Axis function(String id) throws AxisNotFoundException { if(!yAxis_.isEmpty()) { Axis ax; for(Enumeration it = yAxis_.elements(); it.hasMoreElements();) { ax = (Axis)it.nextElement(); if(ax.getId() == id) return ax; } throw new AxisNotFoundException(); } else { throw new AxisNotFoundException(); } } | /**
* Get a reference to an Y axis.
*
* @param id axis identifier
* @return axis found
* @exception AxisNotFoundException An axis was not found with the correct identifier.
* @see Axis
* @see PlainAxis
*/ | Get a reference to an Y axis | getYAxis | {
"repo_name": "luttero/Maud",
"path": "src/gov/noaa/pmel/sgt/CartesianGraph.java",
"license": "bsd-3-clause",
"size": 28021
} | [
"java.util.Enumeration"
] | import java.util.Enumeration; | import java.util.*; | [
"java.util"
] | java.util; | 1,323,917 |
private void updateList(Element listElement, boolean notify) {
// Reset the list of items of this list
items = new ArrayList<PrivacyItem>();
List<Element> itemsElements = listElement.elements("item");
for (Element itemElement : itemsElements) {
PrivacyItem newItem = new PrivacyItem(itemElement);
items.add(newItem);
// If the user's roster is required to evaluation whether a packet must be blocked
// then ensure that the roster is available
if (newItem.isRosterRequired()) {
Roster roster = getRoster();
if (roster == null) {
Log.warn("Privacy item removed since roster of user was not found: " + userJID.getNode());
items.remove(newItem);
}
}
}
// Sort items collections
Collections.sort(items);
if (notify) {
// Trigger event that this list has been modified
PrivacyListManager.getInstance().dispatchModifiedEvent(this);
}
} | void function(Element listElement, boolean notify) { items = new ArrayList<PrivacyItem>(); List<Element> itemsElements = listElement.elements("item"); for (Element itemElement : itemsElements) { PrivacyItem newItem = new PrivacyItem(itemElement); items.add(newItem); if (newItem.isRosterRequired()) { Roster roster = getRoster(); if (roster == null) { Log.warn(STR + userJID.getNode()); items.remove(newItem); } } } Collections.sort(items); if (notify) { PrivacyListManager.getInstance().dispatchModifiedEvent(this); } } | /**
* Sets the new list items based on the specified Element. The Element must contain
* a list of item elements.
*
* @param listElement the element containing a list of items.
* @param notify true if a provicy list modified event will be triggered.
*/ | Sets the new list items based on the specified Element. The Element must contain a list of item elements | updateList | {
"repo_name": "niclashalvorsen/DHISOpenfire",
"path": "src/java/org/jivesoftware/openfire/privacy/PrivacyList.java",
"license": "apache-2.0",
"size": 11281
} | [
"java.util.ArrayList",
"java.util.Collections",
"java.util.List",
"org.dom4j.Element",
"org.jivesoftware.openfire.roster.Roster"
] | import java.util.ArrayList; import java.util.Collections; import java.util.List; import org.dom4j.Element; import org.jivesoftware.openfire.roster.Roster; | import java.util.*; import org.dom4j.*; import org.jivesoftware.openfire.roster.*; | [
"java.util",
"org.dom4j",
"org.jivesoftware.openfire"
] | java.util; org.dom4j; org.jivesoftware.openfire; | 1,665,136 |
private static void loadTextFile(String filePath) throws Exception
{
BufferedReader reader = null;
String fileString = "";
long timestamp = 0;
try
{
JOTLogger.log(JOTLogger.CAT_FLOW, JOTLogger.DEBUG_LEVEL, JOTViewParser.class, "Caching text file: " + filePath);
File f = new File(filePath);
timestamp = f.lastModified();
reader = new BufferedReader(new FileReader(filePath));
String s = null;
while ((s = reader.readLine()) != null)
{
fileString += s + "\n";
}
reader.close();
} catch (Exception e)
{
if (reader != null)
{
reader.close();
}
throw (e);
}
fileString = JOTViewParser.doRemoveTags(fileString);
JOTTextFileCacheItem item = new JOTTextFileCacheItem(timestamp, fileString);
files.put(filePath, item);
}
static class JOTTextFileCacheItem
{
private long timestamp;
private String template;
public JOTTextFileCacheItem(long timestamp, String template)
{
this.timestamp = timestamp;
this.template = template;
}
| static void function(String filePath) throws Exception { BufferedReader reader = null; String fileString = STRCaching text file: STR\n"; } reader.close(); } catch (Exception e) { if (reader != null) { reader.close(); } throw (e); } fileString = JOTViewParser.doRemoveTags(fileString); JOTTextFileCacheItem item = new JOTTextFileCacheItem(timestamp, fileString); files.put(filePath, item); } static class JOTTextFileCacheItem { private long timestamp; private String template; public JOTTextFileCacheItem(long timestamp, String template) { this.timestamp = timestamp; this.template = template; } | /**
* Load a user template from file
* @param templatePath
* @throws Exception
*/ | Load a user template from file | loadTextFile | {
"repo_name": "tcolar/javaontracks",
"path": "src/net/jot/utils/JOTTextFileCache.java",
"license": "artistic-2.0",
"size": 2788
} | [
"java.io.BufferedReader",
"net.jot.web.view.JOTViewParser"
] | import java.io.BufferedReader; import net.jot.web.view.JOTViewParser; | import java.io.*; import net.jot.web.view.*; | [
"java.io",
"net.jot.web"
] | java.io; net.jot.web; | 2,430,701 |
public String getTopics()
{
return Joiner.on(", ").join(topics);
} | String function() { return Joiner.on(STR).join(topics); } | /**
* The topics the operator consumes, separate by','
* Topic name can only contain ASCII alphanumerics, '.', '_' and '-'
*/ | The topics the operator consumes, separate by',' Topic name can only contain ASCII alphanumerics, '.', '_' and '-' | getTopics | {
"repo_name": "chandnisingh/apex-malhar",
"path": "kafka/src/main/java/org/apache/apex/malhar/kafka/AbstractKafkaInputOperator.java",
"license": "apache-2.0",
"size": 18240
} | [
"com.google.common.base.Joiner"
] | import com.google.common.base.Joiner; | import com.google.common.base.*; | [
"com.google.common"
] | com.google.common; | 58,049 |
public T include(String... patterns) {
if (includes == null) {
includes = new ArrayList<String>();
}
Collections.addAll(includes, patterns);
return (T) this;
} | T function(String... patterns) { if (includes == null) { includes = new ArrayList<String>(); } Collections.addAll(includes, patterns); return (T) this; } | /**
* Defines include patterns.
*/ | Defines include patterns | include | {
"repo_name": "007slm/jodd",
"path": "jodd-core/src/main/java/jodd/io/findfile/FindFile.java",
"license": "bsd-3-clause",
"size": 18122
} | [
"java.util.ArrayList",
"java.util.Collections"
] | import java.util.ArrayList; import java.util.Collections; | import java.util.*; | [
"java.util"
] | java.util; | 2,732,469 |
public File getFile()
{
return _file;
} | File function() { return _file; } | /**
* Returns an File representing the given resource or NULL if this
* is not possible.
*/ | Returns an File representing the given resource or NULL if this is not possible | getFile | {
"repo_name": "dineshkummarc/Gitak_r982",
"path": "server/selenium-remote-control-1.0.3/selenium-server/org/openqa/jetty/util/FileResource.java",
"license": "apache-2.0",
"size": 10753
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 392,716 |
protected String convertBinaryStringToString( byte[] binary ) throws KettleValueException {
//noinspection deprecation
return convertBinaryStringToString( binary, EMPTY_STRING_AND_NULL_ARE_DIFFERENT );
} | String function( byte[] binary ) throws KettleValueException { return convertBinaryStringToString( binary, EMPTY_STRING_AND_NULL_ARE_DIFFERENT ); } | /**
* Converts a byte[] stored in a binary string storage type into a String;
*
* @param binary
* the binary string
* @return the String in the correct encoding.
* @throws KettleValueException
*/ | Converts a byte[] stored in a binary string storage type into a String | convertBinaryStringToString | {
"repo_name": "stepanovdg/pentaho-kettle",
"path": "core/src/main/java/org/pentaho/di/core/row/value/ValueMetaBase.java",
"license": "apache-2.0",
"size": 179272
} | [
"org.pentaho.di.core.exception.KettleValueException"
] | import org.pentaho.di.core.exception.KettleValueException; | import org.pentaho.di.core.exception.*; | [
"org.pentaho.di"
] | org.pentaho.di; | 867,439 |
@Test
public void testClientRequestSharedExecutor() throws Exception
{
ClientExecutor executor = new ApacheHttpClient4Executor();
ClientRequest request1 = new ClientRequest(generateURL("/test"), executor);
ClientResponse<?> response1 = request1.post();
Assert.assertEquals(204, response1.getStatus());
ClientRequest request2 = new ClientRequest(generateURL("/test"), executor);
ClientResponse<?> response2 = request2.post();
Assert.assertEquals(204, response2.getStatus());
ClientExecutor executor1 = request1.getExecutor();
ClientExecutor executor2 = request2.getExecutor();
Assert.assertSame(executor, executor1);
Assert.assertSame(executor, executor2);
executor.close();
} | void function() throws Exception { ClientExecutor executor = new ApacheHttpClient4Executor(); ClientRequest request1 = new ClientRequest(generateURL("/test"), executor); ClientResponse<?> response1 = request1.post(); Assert.assertEquals(204, response1.getStatus()); ClientRequest request2 = new ClientRequest(generateURL("/test"), executor); ClientResponse<?> response2 = request2.post(); Assert.assertEquals(204, response2.getStatus()); ClientExecutor executor1 = request1.getExecutor(); ClientExecutor executor2 = request2.getExecutor(); Assert.assertSame(executor, executor1); Assert.assertSame(executor, executor2); executor.close(); } | /**
* Verify that ClientRequest uses the ClientExecutor
* supplied through a constructor.
*/ | Verify that ClientRequest uses the ClientExecutor supplied through a constructor | testClientRequestSharedExecutor | {
"repo_name": "raphaelning/resteasy-client-android",
"path": "jaxrs/resteasy-jaxrs/src/test/java/org/jboss/resteasy/test/client/ClientExecutorShutdownTest.java",
"license": "apache-2.0",
"size": 7298
} | [
"org.jboss.resteasy.client.ClientExecutor",
"org.jboss.resteasy.client.ClientRequest",
"org.jboss.resteasy.client.ClientResponse",
"org.jboss.resteasy.client.core.executors.ApacheHttpClient4Executor",
"org.junit.Assert"
] | import org.jboss.resteasy.client.ClientExecutor; import org.jboss.resteasy.client.ClientRequest; import org.jboss.resteasy.client.ClientResponse; import org.jboss.resteasy.client.core.executors.ApacheHttpClient4Executor; import org.junit.Assert; | import org.jboss.resteasy.client.*; import org.jboss.resteasy.client.core.executors.*; import org.junit.*; | [
"org.jboss.resteasy",
"org.junit"
] | org.jboss.resteasy; org.junit; | 756,277 |
@Generated
@Selector("ensureLayoutForRange:")
public native void ensureLayoutForRange(NSTextRange range); | @Selector(STR) native void function(NSTextRange range); | /**
* Performs the layout for textRange.
*/ | Performs the layout for textRange | ensureLayoutForRange | {
"repo_name": "multi-os-engine/moe-core",
"path": "moe.apple/moe.platform.ios/src/main/java/apple/uikit/NSTextLayoutManager.java",
"license": "apache-2.0",
"size": 24324
} | [
"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; | 718,548 |
@Test
public void test_getSinger() {
Song s1 = new Song("Roar","Katy Perry");
assertEquals("Katy Perry",s1.getSinger());
} | void function() { Song s1 = new Song("Roar",STR); assertEquals(STR,s1.getSinger()); } | /** Test case for getSinger method of Song
@see Song#getSinger
*/ | Test case for getSinger method of Song | test_getSinger | {
"repo_name": "UCSB-CS56-W14/W14-lab05",
"path": "src/edu/ucsb/cs56/w14/lab05/dwang68/SongTest.java",
"license": "mit",
"size": 2100
} | [
"org.junit.Assert"
] | import org.junit.Assert; | import org.junit.*; | [
"org.junit"
] | org.junit; | 395,186 |
public RSItem getItem(final int index) {
return new RSItem(methods, getInterface().getComponents()[index]);
} | RSItem function(final int index) { return new RSItem(methods, getInterface().getComponents()[index]); } | /**
* Gets the equipment item at a given index.
*
* @param index
* The item index.
* @return The equipped item.
*/ | Gets the equipment item at a given index | getItem | {
"repo_name": "Latency/UtopianBot",
"path": "src/org/rsbot/script/methods/Equipment.java",
"license": "lgpl-3.0",
"size": 4500
} | [
"org.rsbot.script.wrappers.RSItem"
] | import org.rsbot.script.wrappers.RSItem; | import org.rsbot.script.wrappers.*; | [
"org.rsbot.script"
] | org.rsbot.script; | 1,679,951 |
public void wait(List<AbstractRunnable> taskList) throws DCMAApplicationException {
boolean completed = false;
while (!completed) {
completed = true;
for (AbstractRunnable th : taskList) {
completed &= th.isCompleted();
if (th.isCompleted() && th.getDcmaApplicationException() != null) {
throw th.getDcmaApplicationException();
}
}
try {
if (!completed) {
Thread.sleep(waitThreadSleepTime);
}
} catch (InterruptedException e) {
LOG.error(Thread.currentThread()
+ " interrupted. Resuming execution. Some tasks of this batch instance may not have completed execution.");
}
}
} | void function(List<AbstractRunnable> taskList) throws DCMAApplicationException { boolean completed = false; while (!completed) { completed = true; for (AbstractRunnable th : taskList) { completed &= th.isCompleted(); if (th.isCompleted() && th.getDcmaApplicationException() != null) { throw th.getDcmaApplicationException(); } } try { if (!completed) { Thread.sleep(waitThreadSleepTime); } } catch (InterruptedException e) { LOG.error(Thread.currentThread() + STR); } } } | /**
* Waits for all the threads in the provided list to complete execution.
*
* @param threadClassList the list on which to wait.
* @throws DCMAApplicationException in case of error
*/ | Waits for all the threads in the provided list to complete execution | wait | {
"repo_name": "kuzavas/ephesoft",
"path": "dcma-core/src/main/java/com/ephesoft/dcma/core/threadpool/BatchInstanceThread.java",
"license": "agpl-3.0",
"size": 8958
} | [
"com.ephesoft.dcma.core.exception.DCMAApplicationException",
"java.util.List"
] | import com.ephesoft.dcma.core.exception.DCMAApplicationException; import java.util.List; | import com.ephesoft.dcma.core.exception.*; import java.util.*; | [
"com.ephesoft.dcma",
"java.util"
] | com.ephesoft.dcma; java.util; | 2,519,001 |
private static MarkerOptions createMarkerOptions(MarkerOptions originalMarkerOption,
boolean iconRandomColorMode, float markerColor) {
MarkerOptions newMarkerOption = new MarkerOptions();
newMarkerOption.rotation(originalMarkerOption.getRotation());
newMarkerOption.anchor(originalMarkerOption.getAnchorU(), originalMarkerOption.getAnchorV());
if (iconRandomColorMode) {
float hue = getHueValue(computeRandomColor((int) markerColor));
originalMarkerOption.icon(BitmapDescriptorFactory.defaultMarker(hue));
}
newMarkerOption.icon(originalMarkerOption.getIcon());
return newMarkerOption;
} | static MarkerOptions function(MarkerOptions originalMarkerOption, boolean iconRandomColorMode, float markerColor) { MarkerOptions newMarkerOption = new MarkerOptions(); newMarkerOption.rotation(originalMarkerOption.getRotation()); newMarkerOption.anchor(originalMarkerOption.getAnchorU(), originalMarkerOption.getAnchorV()); if (iconRandomColorMode) { float hue = getHueValue(computeRandomColor((int) markerColor)); originalMarkerOption.icon(BitmapDescriptorFactory.defaultMarker(hue)); } newMarkerOption.icon(originalMarkerOption.getIcon()); return newMarkerOption; } | /**
* Creates a new marker option from given properties of an existing marker option
*
* @param originalMarkerOption An existing MarkerOption instance
* @param iconRandomColorMode True if marker color mode is random, false otherwise
* @param markerColor Color of the marker
* @return A new MarkerOption
*/ | Creates a new marker option from given properties of an existing marker option | createMarkerOptions | {
"repo_name": "josegury/AndroidMarkerClusteringMaps",
"path": "MarkerClusteringMaps/app/src/main/java/joseangelpardo/markerclusteringmaps/libreryMaps/kml/KmlStyle.java",
"license": "apache-2.0",
"size": 14806
} | [
"com.google.android.gms.maps.model.BitmapDescriptorFactory",
"com.google.android.gms.maps.model.MarkerOptions"
] | import com.google.android.gms.maps.model.BitmapDescriptorFactory; import com.google.android.gms.maps.model.MarkerOptions; | import com.google.android.gms.maps.model.*; | [
"com.google.android"
] | com.google.android; | 1,182,151 |
Set<LedgerFragment> waitAndGetResult() throws InterruptedException {
latch.await();
return result;
}
} | Set<LedgerFragment> waitAndGetResult() throws InterruptedException { latch.await(); return result; } } | /**
* Wait until operation complete call back comes and return the ledger
* fragments set
*/ | Wait until operation complete call back comes and return the ledger fragments set | waitAndGetResult | {
"repo_name": "robindh/bookkeeper",
"path": "bookkeeper-server/src/main/java/org/apache/bookkeeper/replication/ReplicationWorker.java",
"license": "apache-2.0",
"size": 20799
} | [
"java.util.Set",
"org.apache.bookkeeper.client.LedgerFragment"
] | import java.util.Set; import org.apache.bookkeeper.client.LedgerFragment; | import java.util.*; import org.apache.bookkeeper.client.*; | [
"java.util",
"org.apache.bookkeeper"
] | java.util; org.apache.bookkeeper; | 585,704 |
public Table<T> removeAllUniqueConstraint()
{
childNode.removeChildren("unique-constraint");
return this;
}
// --------------------------------------------------------------------------------------------------------||
// ClassName: Table ElementName: xsd:string ElementType : name
// MaxOccurs: - isGeneric: true isAttribute: true isEnum: false isDataType: true
// --------------------------------------------------------------------------------------------------------|| | Table<T> function() { childNode.removeChildren(STR); return this; } | /**
* Removes all <code>unique-constraint</code> elements
* @return the current instance of <code>UniqueConstraint<Table<T>></code>
*/ | Removes all <code>unique-constraint</code> elements | removeAllUniqueConstraint | {
"repo_name": "forge/javaee-descriptors",
"path": "impl/src/main/java/org/jboss/shrinkwrap/descriptor/impl/orm10/TableImpl.java",
"license": "epl-1.0",
"size": 7031
} | [
"org.jboss.shrinkwrap.descriptor.api.orm10.Table"
] | import org.jboss.shrinkwrap.descriptor.api.orm10.Table; | import org.jboss.shrinkwrap.descriptor.api.orm10.*; | [
"org.jboss.shrinkwrap"
] | org.jboss.shrinkwrap; | 137,836 |
void setFavicon(@Nullable Favicon favicon);
interface Players extends StatusResponse.Players { | void setFavicon(@Nullable Favicon favicon); interface Players extends StatusResponse.Players { | /**
* Sets the {@link Favicon} to display on the client.
*
* @param favicon The favicon, or {@code null} for none
*/ | Sets the <code>Favicon</code> to display on the client | setFavicon | {
"repo_name": "jonk1993/SpongeAPI",
"path": "src/main/java/org/spongepowered/api/event/server/ClientPingServerEvent.java",
"license": "mit",
"size": 4517
} | [
"javax.annotation.Nullable",
"org.spongepowered.api.status.Favicon",
"org.spongepowered.api.status.StatusResponse"
] | import javax.annotation.Nullable; import org.spongepowered.api.status.Favicon; import org.spongepowered.api.status.StatusResponse; | import javax.annotation.*; import org.spongepowered.api.status.*; | [
"javax.annotation",
"org.spongepowered.api"
] | javax.annotation; org.spongepowered.api; | 1,805,678 |
Date getStartTime() {
return new Date(startTime.getTime());
} | Date getStartTime() { return new Date(startTime.getTime()); } | /**
* Gets the start date and time for the current ingest task.
*
* @return The start date and time.
*/ | Gets the start date and time for the current ingest task | getStartTime | {
"repo_name": "sleuthkit/autopsy",
"path": "Core/src/org/sleuthkit/autopsy/ingest/IngestManager.java",
"license": "apache-2.0",
"size": 63582
} | [
"java.util.Date"
] | import java.util.Date; | import java.util.*; | [
"java.util"
] | java.util; | 609,825 |
public boolean find(String keyString, boolean lock) throws xBaseJException, IOException {
if (jNDX == null)
throw new xBaseJException("Index not defined");
int r = jNDX.find_entry(keyString);
if (r < 1)
throw new xBaseJException("Record not found");
if (lock)
lockRecord(r);
gotoRecord(r);
return jNDX.compareKey(keyString);
}
| boolean function(String keyString, boolean lock) throws xBaseJException, IOException { if (jNDX == null) throw new xBaseJException(STR); int r = jNDX.find_entry(keyString); if (r < 1) throw new xBaseJException(STR); if (lock) lockRecord(r); gotoRecord(r); return jNDX.compareKey(keyString); } | /**
* used to find a record with an equal or greater string value. when done the record pointer and field contents will be changed.
*
* @param keyString a search string
* @param lock boolean lock record indicator
* @return boolean indicating if the record found contains the exact key
* @throws xBaseJException org.xBaseJ no Indexs opened with database
* @throws IOException Java error caused by called methods
*/ | used to find a record with an equal or greater string value. when done the record pointer and field contents will be changed | find | {
"repo_name": "ianturton/xbasej",
"path": "src/main/java/org/xbasej/DBF.java",
"license": "lgpl-3.0",
"size": 76131
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,176,057 |
public CodecType getCodecType()
{
return CodecType.valueOf(mProperties.getProperty(COMPRESSION, DEFAULT_NONE).toUpperCase());
}
| CodecType function() { return CodecType.valueOf(mProperties.getProperty(COMPRESSION, DEFAULT_NONE).toUpperCase()); } | /**
* Gets the codec type.
*
* @return the codec type
*/ | Gets the codec type | getCodecType | {
"repo_name": "VladRodionov/bigbase",
"path": "koda/src/main/java/com/koda/config/CacheConfiguration.java",
"license": "agpl-3.0",
"size": 24945
} | [
"com.koda.compression.CodecType"
] | import com.koda.compression.CodecType; | import com.koda.compression.*; | [
"com.koda.compression"
] | com.koda.compression; | 2,617,181 |
EReference getRestrictionType1_SimpleType(); | EReference getRestrictionType1_SimpleType(); | /**
* Returns the meta object for the containment reference '{@link org.w3._2001.schema.RestrictionType1#getSimpleType <em>Simple Type</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the containment reference '<em>Simple Type</em>'.
* @see org.w3._2001.schema.RestrictionType1#getSimpleType()
* @see #getRestrictionType1()
* @generated
*/ | Returns the meta object for the containment reference '<code>org.w3._2001.schema.RestrictionType1#getSimpleType Simple Type</code>'. | getRestrictionType1_SimpleType | {
"repo_name": "geotools/geotools",
"path": "modules/ogc/net.opengis.wps/src/org/w3/_2001/schema/SchemaPackage.java",
"license": "lgpl-2.1",
"size": 433240
} | [
"org.eclipse.emf.ecore.EReference"
] | import org.eclipse.emf.ecore.EReference; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 1,878,582 |
@ServiceMethod(returns = ReturnType.SINGLE)
public FileShareInner create(
String resourceGroupName, String accountName, String shareName, FileShareInner fileShare) {
return createAsync(resourceGroupName, accountName, shareName, fileShare).block();
} | @ServiceMethod(returns = ReturnType.SINGLE) FileShareInner function( String resourceGroupName, String accountName, String shareName, FileShareInner fileShare) { return createAsync(resourceGroupName, accountName, shareName, fileShare).block(); } | /**
* Creates a new share under the specified account as described by request body. The share resource includes
* metadata and properties for that share. It does not include a list of the files contained by the share.
*
* @param resourceGroupName The name of the resource group within the user's subscription. The name is case
* insensitive.
* @param accountName The name of the storage account within the specified resource group. Storage account names
* must be between 3 and 24 characters in length and use numbers and lower-case letters only.
* @param shareName The name of the file share within the specified storage account. File share names must be
* between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-)
* character must be immediately preceded and followed by a letter or number.
* @param fileShare Properties of the file share, including Id, resource name, resource type, Etag.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return properties of the file share, including Id, resource name, resource type, Etag.
*/ | Creates a new share under the specified account as described by request body. The share resource includes metadata and properties for that share. It does not include a list of the files contained by the share | create | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/resourcemanager/azure-resourcemanager-storage/src/main/java/com/azure/resourcemanager/storage/implementation/FileSharesClientImpl.java",
"license": "mit",
"size": 82676
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.resourcemanager.storage.fluent.models.FileShareInner"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.resourcemanager.storage.fluent.models.FileShareInner; | import com.azure.core.annotation.*; import com.azure.resourcemanager.storage.fluent.models.*; | [
"com.azure.core",
"com.azure.resourcemanager"
] | com.azure.core; com.azure.resourcemanager; | 1,619,928 |
public static Observable<View> observableFromButtonClick(Button button) {
final PublishSubject<View> subject = PublishSubject.create();
button.setOnClickListener((v) -> subject.onNext(v));
return subject;
}
/**
* Creates an {@link rx.Observable} from a Button's {@link android.view.MotionEvent#ACTION_DOWN} and {@link android.view.MotionEvent#ACTION_UP} | static Observable<View> function(Button button) { final PublishSubject<View> subject = PublishSubject.create(); button.setOnClickListener((v) -> subject.onNext(v)); return subject; } /** * Creates an {@link rx.Observable} from a Button's {@link android.view.MotionEvent#ACTION_DOWN} and {@link android.view.MotionEvent#ACTION_UP} | /**
* Creates an {@link rx.Observable} from a button click and returns the view to the subscriber
* @param button Button to subscribe to
* @return Observable data stream for click events from the button
*/ | Creates an <code>rx.Observable</code> from a button click and returns the view to the subscriber | observableFromButtonClick | {
"repo_name": "ripply/hacker-news-android",
"path": "rxeventslib/src/main/java/io/dwak/rx/events/RxEvents.java",
"license": "apache-2.0",
"size": 3547
} | [
"android.view.MotionEvent",
"android.view.View",
"android.widget.Button"
] | import android.view.MotionEvent; import android.view.View; import android.widget.Button; | import android.view.*; import android.widget.*; | [
"android.view",
"android.widget"
] | android.view; android.widget; | 858,104 |
public static Throwable handleMissingThrowable(@Nullable Throwable throwable) {
return throwable != null
? throwable
: new FlinkException(
"Unknown cause for Execution failure (this might be caused by FLINK-21376).");
}
public ErrorInfo(@Nonnull Throwable exception, long timestamp) {
Preconditions.checkNotNull(exception);
Preconditions.checkArgument(timestamp > 0);
this.exception =
exception instanceof SerializedThrowable
? (SerializedThrowable) exception
: new SerializedThrowable(exception);
this.timestamp = timestamp;
} | static Throwable function(@Nullable Throwable throwable) { return throwable != null ? throwable : new FlinkException( STR); } public ErrorInfo(@Nonnull Throwable exception, long timestamp) { Preconditions.checkNotNull(exception); Preconditions.checkArgument(timestamp > 0); this.exception = exception instanceof SerializedThrowable ? (SerializedThrowable) exception : new SerializedThrowable(exception); this.timestamp = timestamp; } | /**
* Utility method to cover FLINK-21376.
*
* @param throwable The actual exception.
* @return a {@link FlinkException} if no exception was passed.
*/ | Utility method to cover FLINK-21376 | handleMissingThrowable | {
"repo_name": "tillrohrmann/flink",
"path": "flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/ErrorInfo.java",
"license": "apache-2.0",
"size": 3589
} | [
"javax.annotation.Nonnull",
"javax.annotation.Nullable",
"org.apache.flink.util.FlinkException",
"org.apache.flink.util.Preconditions",
"org.apache.flink.util.SerializedThrowable"
] | import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.apache.flink.util.FlinkException; import org.apache.flink.util.Preconditions; import org.apache.flink.util.SerializedThrowable; | import javax.annotation.*; import org.apache.flink.util.*; | [
"javax.annotation",
"org.apache.flink"
] | javax.annotation; org.apache.flink; | 1,558,768 |
private JComponent buildLocationBar()
{
JPanel bar = new JPanel();
//bar.setBackground(UIUtilities.BACKGROUND);
bar.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
bar.add(reloadContainerButton);
bar.add(Box.createHorizontalStrut(5));
bar.add(locationButton);
bar.add(Box.createHorizontalStrut(5));
bar.add(locationLabel);
return bar;
}
| JComponent function() { JPanel bar = new JPanel(); bar.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); bar.add(reloadContainerButton); bar.add(Box.createHorizontalStrut(5)); bar.add(locationButton); bar.add(Box.createHorizontalStrut(5)); bar.add(locationLabel); return bar; } | /**
* Builds and lays out the controls for the location.
*
* @return See above.
*/ | Builds and lays out the controls for the location | buildLocationBar | {
"repo_name": "joshmoore/openmicroscopy",
"path": "components/insight/SRC/org/openmicroscopy/shoola/agents/fsimporter/chooser/ImportDialog.java",
"license": "gpl-2.0",
"size": 72220
} | [
"java.awt.FlowLayout",
"javax.swing.Box",
"javax.swing.JComponent",
"javax.swing.JPanel"
] | import java.awt.FlowLayout; import javax.swing.Box; import javax.swing.JComponent; import javax.swing.JPanel; | import java.awt.*; import javax.swing.*; | [
"java.awt",
"javax.swing"
] | java.awt; javax.swing; | 1,701,005 |
private void readInputFiles(StringTokenizer line){
String new_line = line.nextToken(); //We read the input data line
StringTokenizer data = new StringTokenizer(new_line, " = \" ");
data.nextToken(); //inputFile
trainingFile = data.nextToken();
validationFile = data.nextToken();
testFile = data.nextToken();
while(data.hasMoreTokens()){
inputFiles.add(data.nextToken());
}
}
| void function(StringTokenizer line){ String new_line = line.nextToken(); StringTokenizer data = new StringTokenizer(new_line, STR "); data.nextToken(); trainingFile = data.nextToken(); validationFile = data.nextToken(); testFile = data.nextToken(); while(data.hasMoreTokens()){ inputFiles.add(data.nextToken()); } } | /**
* We read the input data-set files and all the possible input files
* @param line StringTokenizer It is the line containing the input files.
*/ | We read the input data-set files and all the possible input files | readInputFiles | {
"repo_name": "SCI2SUGR/KEEL",
"path": "src/keel/Algorithms/ImbalancedClassification/ImbalancedAlgorithms/GP_COACH_H/parseParameters.java",
"license": "gpl-3.0",
"size": 9290
} | [
"java.util.StringTokenizer"
] | import java.util.StringTokenizer; | import java.util.*; | [
"java.util"
] | java.util; | 2,638,046 |
protected static Document getDocument(){
return DOMUtil.getDocument();
}
| static Document function(){ return DOMUtil.getDocument(); } | /**
* Returns documentBuilder instance - used to create documents and polystrings
* */ | Returns documentBuilder instance - used to create documents and polystrings | getDocument | {
"repo_name": "Pardus-Engerek/engerek",
"path": "testing/wstest/src/test/java/com/evolveum/midpoint/testing/wstest/AbstractWebserviceTest.java",
"license": "apache-2.0",
"size": 34670
} | [
"com.evolveum.midpoint.util.DOMUtil",
"org.w3c.dom.Document"
] | import com.evolveum.midpoint.util.DOMUtil; import org.w3c.dom.Document; | import com.evolveum.midpoint.util.*; import org.w3c.dom.*; | [
"com.evolveum.midpoint",
"org.w3c.dom"
] | com.evolveum.midpoint; org.w3c.dom; | 2,033,529 |
public static long deleteMsgByType(Context c, String type) {
DBProvider provider = DBProvider.getDBProvider(c);
int deleteCount = provider.delete(DBHelp.TABLE_STATISTICS, DBHelp.COLUMN_EVENT_TYPE+"= ?", new String[]{type});
//Ln.e("delete id == %s", deleteCount);
return deleteCount;
}
| static long function(Context c, String type) { DBProvider provider = DBProvider.getDBProvider(c); int deleteCount = provider.delete(DBHelp.TABLE_STATISTICS, DBHelp.COLUMN_EVENT_TYPE+STR, new String[]{type}); return deleteCount; } | /**
* delete msg by time
* @param c
* @param time
* @return
*/ | delete msg by time | deleteMsgByType | {
"repo_name": "BigAppOS/BigApp_Discuz_Android",
"path": "libs/AnalysisSDK/src/cn/sharesdk/db/MessageUtils.java",
"license": "apache-2.0",
"size": 7880
} | [
"android.content.Context"
] | import android.content.Context; | import android.content.*; | [
"android.content"
] | android.content; | 2,850,730 |
private void refresh() {
IJavaScriptElement input= getInput();
if (input == null) {
StringBuffer buffer= new StringBuffer(""); //$NON-NLS-1$
HTMLPrinter.insertPageProlog(buffer, 0, fBackgroundColorRGB, fgStyleSheet);
setInput(buffer.toString());
} else {
setInput(computeInput(input));
}
}
| void function() { IJavaScriptElement input= getInput(); if (input == null) { StringBuffer buffer= new StringBuffer(""); HTMLPrinter.insertPageProlog(buffer, 0, fBackgroundColorRGB, fgStyleSheet); setInput(buffer.toString()); } else { setInput(computeInput(input)); } } | /**
* Refreshes the view.
*
*
*/ | Refreshes the view | refresh | {
"repo_name": "boniatillo-com/PhaserEditor",
"path": "source/thirdparty/jsdt/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/infoviews/JavadocView.java",
"license": "epl-1.0",
"size": 23406
} | [
"org.eclipse.wst.jsdt.core.IJavaScriptElement",
"org.eclipse.wst.jsdt.internal.ui.text.html.HTMLPrinter"
] | import org.eclipse.wst.jsdt.core.IJavaScriptElement; import org.eclipse.wst.jsdt.internal.ui.text.html.HTMLPrinter; | import org.eclipse.wst.jsdt.core.*; import org.eclipse.wst.jsdt.internal.ui.text.html.*; | [
"org.eclipse.wst"
] | org.eclipse.wst; | 1,188,711 |
// Implementation of integer encoding used for crypto
public static BigInteger decodeInteger(byte[] pArray) {
return new BigInteger(1, decodeBase64(pArray));
} | static BigInteger function(byte[] pArray) { return new BigInteger(1, decodeBase64(pArray)); } | /**
* Decodes a byte64-encoded integer according to crypto standards such as W3C's XML-Signature
*
* @param pArray
* a byte array containing base64 character data
* @return A BigInteger
* @since 1.4
*/ | Decodes a byte64-encoded integer according to crypto standards such as W3C's XML-Signature | decodeInteger | {
"repo_name": "DanielRuf/Plain-of-JARs",
"path": "sources/websitebackup/org/apache/commons/net/util/Base64.java",
"license": "gpl-3.0",
"size": 39521
} | [
"java.math.BigInteger"
] | import java.math.BigInteger; | import java.math.*; | [
"java.math"
] | java.math; | 473,575 |
@Override
public void buildFromXMLElement(Element aElement, XMLParser aParser, ParsingOptions aOptions)
throws InvalidXMLException {
setAction(aElement.getAttribute("action"));
setValue(aElement.getAttribute("value"));
String waitTime = aElement.getAttribute("waitTimeBetweenRetries");
if (waitTime != null && waitTime.trim().length() > 0) {
try {
setWaitTimeBetweenRetries(Integer.parseInt(waitTime));
} catch (NumberFormatException e) {
// ignore
}
}
} | void function(Element aElement, XMLParser aParser, ParsingOptions aOptions) throws InvalidXMLException { setAction(aElement.getAttribute(STR)); setValue(aElement.getAttribute("value")); String waitTime = aElement.getAttribute(STR); if (waitTime != null && waitTime.trim().length() > 0) { try { setWaitTimeBetweenRetries(Integer.parseInt(waitTime)); } catch (NumberFormatException e) { } } } | /**
* Overridden to read "name" and "value" attributes.
*
* @param aElement
* the a element
* @param aParser
* the a parser
* @param aOptions
* the a options
* @throws InvalidXMLException
* the invalid XML exception
* @see org.apache.uima.resource.metadata.impl.MetaDataObject_impl#buildFromXMLElement(org.w3c.dom.Element,
* org.apache.uima.util.XMLParser, org.apache.uima.util.XMLParser.ParsingOptions)
*/ | Overridden to read "name" and "value" attributes | buildFromXMLElement | {
"repo_name": "apache/uima-uimaj",
"path": "uimaj-cpe/src/main/java/org/apache/uima/collection/impl/metadata/cpe/CasProcessorMaxRestartsImpl.java",
"license": "apache-2.0",
"size": 5528
} | [
"org.apache.uima.util.InvalidXMLException",
"org.apache.uima.util.XMLParser",
"org.w3c.dom.Element"
] | import org.apache.uima.util.InvalidXMLException; import org.apache.uima.util.XMLParser; import org.w3c.dom.Element; | import org.apache.uima.util.*; import org.w3c.dom.*; | [
"org.apache.uima",
"org.w3c.dom"
] | org.apache.uima; org.w3c.dom; | 2,789,250 |
boolean hasNamespacePermission(String user, String namespace, NamespacePermission permission)
throws NamespaceNotFoundException; | boolean hasNamespacePermission(String user, String namespace, NamespacePermission permission) throws NamespaceNotFoundException; | /**
* Used to get the namespace permission of a user for a namespace
*/ | Used to get the namespace permission of a user for a namespace | hasNamespacePermission | {
"repo_name": "apache/accumulo",
"path": "server/base/src/main/java/org/apache/accumulo/server/security/handler/PermissionHandler.java",
"license": "apache-2.0",
"size": 5292
} | [
"org.apache.accumulo.core.client.NamespaceNotFoundException",
"org.apache.accumulo.core.security.NamespacePermission"
] | import org.apache.accumulo.core.client.NamespaceNotFoundException; import org.apache.accumulo.core.security.NamespacePermission; | import org.apache.accumulo.core.client.*; import org.apache.accumulo.core.security.*; | [
"org.apache.accumulo"
] | org.apache.accumulo; | 1,681,464 |
public void cleanSession(HttpServletRequest request) {
request.getSession().removeAttribute("wikipediaURIs");
request.getSession().removeAttribute("suggestionList");
request.getSession().removeAttribute("selectionTarget");
}
| void function(HttpServletRequest request) { request.getSession().removeAttribute(STR); request.getSession().removeAttribute(STR); request.getSession().removeAttribute(STR); } | /**
* Cleans the session from some attributes.
* @param request
*/ | Cleans the session from some attributes | cleanSession | {
"repo_name": "christianherta/BBC-DaaS",
"path": "bbcdaas_disambiguationweb/bbcdaas_disambiguationweb/src/main/java/de/bbcdaas/disambiguationweb/business/DisambiguationBusiness.java",
"license": "apache-2.0",
"size": 10627
} | [
"javax.servlet.http.HttpServletRequest"
] | import javax.servlet.http.HttpServletRequest; | import javax.servlet.http.*; | [
"javax.servlet"
] | javax.servlet; | 2,621,555 |
public void setQueryCacheConfigs(List<QueryCacheConfig> queryCacheConfigs) {
this.queryCacheConfigs = queryCacheConfigs;
} | void function(List<QueryCacheConfig> queryCacheConfigs) { this.queryCacheConfigs = queryCacheConfigs; } | /**
* Sets {@link QueryCacheConfig} instances to this {@code MapConfig}.
*/ | Sets <code>QueryCacheConfig</code> instances to this MapConfig | setQueryCacheConfigs | {
"repo_name": "dsukhoroslov/hazelcast",
"path": "hazelcast/src/main/java/com/hazelcast/config/MapConfig.java",
"license": "apache-2.0",
"size": 42957
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,603,713 |
public void requestAllRecords(Searcher searcher) {
for (ProviderEntry entry : this.providers.values()) {
if (searcher.isCancelled())
break;
if (entry.provider == null)
continue;
List<? extends Pojo> pojos = entry.provider.getPojos();
if (pojos != null)
searcher.addResult(pojos.toArray(new Pojo[0]));
}
} | void function(Searcher searcher) { for (ProviderEntry entry : this.providers.values()) { if (searcher.isCancelled()) break; if (entry.provider == null) continue; List<? extends Pojo> pojos = entry.provider.getPojos(); if (pojos != null) searcher.addResult(pojos.toArray(new Pojo[0])); } } | /**
* Get records for this query.
*
* @param searcher the searcher currently running
*/ | Get records for this query | requestAllRecords | {
"repo_name": "hamburger1984/KISS",
"path": "app/src/main/java/fr/neamar/kiss/DataHandler.java",
"license": "gpl-3.0",
"size": 30952
} | [
"fr.neamar.kiss.pojo.Pojo",
"fr.neamar.kiss.searcher.Searcher",
"java.util.List"
] | import fr.neamar.kiss.pojo.Pojo; import fr.neamar.kiss.searcher.Searcher; import java.util.List; | import fr.neamar.kiss.pojo.*; import fr.neamar.kiss.searcher.*; import java.util.*; | [
"fr.neamar.kiss",
"java.util"
] | fr.neamar.kiss; java.util; | 1,599,686 |
byte getSunlight(BaseVector3i pos); | byte getSunlight(BaseVector3i pos); | /**
* Returns the current amount of sunlight at given position relative to the chunk.
*
* @param pos Position of the block relative to corner of the chunk
* @return Current sunlight
*/ | Returns the current amount of sunlight at given position relative to the chunk | getSunlight | {
"repo_name": "kartikey0303/Terasology",
"path": "engine/src/main/java/org/terasology/world/chunks/LitChunk.java",
"license": "apache-2.0",
"size": 5115
} | [
"org.terasology.math.geom.BaseVector3i"
] | import org.terasology.math.geom.BaseVector3i; | import org.terasology.math.geom.*; | [
"org.terasology.math"
] | org.terasology.math; | 236,069 |
public interface OnAccountHeaderSelectionViewClickListener {
public boolean onClick(View view, IProfile profile);
} | interface OnAccountHeaderSelectionViewClickListener { public boolean function(View view, IProfile profile); } | /**
* the event when the user clicks the selection list under the profile icons
*
* @param view
* @param profile
* @return if the event was consumed
*/ | the event when the user clicks the selection list under the profile icons | onClick | {
"repo_name": "maitho/MaterialDrawer",
"path": "library/src/main/java/com/mikepenz/materialdrawer/AccountHeader.java",
"license": "apache-2.0",
"size": 8775
} | [
"android.view.View",
"com.mikepenz.materialdrawer.model.interfaces.IProfile"
] | import android.view.View; import com.mikepenz.materialdrawer.model.interfaces.IProfile; | import android.view.*; import com.mikepenz.materialdrawer.model.interfaces.*; | [
"android.view",
"com.mikepenz.materialdrawer"
] | android.view; com.mikepenz.materialdrawer; | 2,864,158 |
public IndexAnalyzers build(IndexSettings indexSettings) throws IOException {
final Map<String, CharFilterFactory> charFilterFactories = buildCharFilterFactories(indexSettings);
final Map<String, TokenizerFactory> tokenizerFactories = buildTokenizerFactories(indexSettings);
final Map<String, TokenFilterFactory> tokenFilterFactories = buildTokenFilterFactories(indexSettings);
final Map<String, AnalyzerProvider<?>> analyzerFactories = buildAnalyzerFactories(indexSettings);
final Map<String, AnalyzerProvider<?>> normalizerFactories = buildNormalizerFactories(indexSettings);
return build(indexSettings, analyzerFactories, normalizerFactories, tokenizerFactories, charFilterFactories, tokenFilterFactories);
} | IndexAnalyzers function(IndexSettings indexSettings) throws IOException { final Map<String, CharFilterFactory> charFilterFactories = buildCharFilterFactories(indexSettings); final Map<String, TokenizerFactory> tokenizerFactories = buildTokenizerFactories(indexSettings); final Map<String, TokenFilterFactory> tokenFilterFactories = buildTokenFilterFactories(indexSettings); final Map<String, AnalyzerProvider<?>> analyzerFactories = buildAnalyzerFactories(indexSettings); final Map<String, AnalyzerProvider<?>> normalizerFactories = buildNormalizerFactories(indexSettings); return build(indexSettings, analyzerFactories, normalizerFactories, tokenizerFactories, charFilterFactories, tokenFilterFactories); } | /**
* Creates an index-level {@link IndexAnalyzers} from this registry using the given index settings
*/ | Creates an index-level <code>IndexAnalyzers</code> from this registry using the given index settings | build | {
"repo_name": "coding0011/elasticsearch",
"path": "server/src/main/java/org/elasticsearch/index/analysis/AnalysisRegistry.java",
"license": "apache-2.0",
"size": 33006
} | [
"java.io.IOException",
"java.util.Map",
"org.elasticsearch.index.IndexSettings"
] | import java.io.IOException; import java.util.Map; import org.elasticsearch.index.IndexSettings; | import java.io.*; import java.util.*; import org.elasticsearch.index.*; | [
"java.io",
"java.util",
"org.elasticsearch.index"
] | java.io; java.util; org.elasticsearch.index; | 1,464,239 |
private void timeoutConnections() {
synchronized (pool) {
// If we've exceeded the pruning interval, look for stale
// connections to logout.
if (System.currentTimeMillis() - pool.lastTimePruned >
pool.pruningInterval &&
pool.authenticatedConnections.size() > 1) {
if (pool.debug) {
out.println("DEBUG: checking for connections " +
"to prune: " +
(System.currentTimeMillis() - pool.lastTimePruned));
out.println("DEBUG: clientTimeoutInterval: " +
pool.clientTimeoutInterval);
}
IMAPProtocol p;
// Check the timestamp of the protocol objects in the pool and
// logout if the interval exceeds the client timeout value
// (leave the first connection).
for (int index = pool.authenticatedConnections.size() - 1;
index > 0; index--) {
p = (IMAPProtocol)pool.authenticatedConnections.
elementAt(index);
if (pool.debug) {
out.println("DEBUG: protocol last used: " +
(System.currentTimeMillis() - p.getTimestamp()));
}
if (System.currentTimeMillis() - p.getTimestamp() >
pool.clientTimeoutInterval) {
if (pool.debug) {
out.println("DEBUG: authenticated " +
"connection timed out");
out.println("DEBUG: logging out " +
"the connection");
}
p.removeResponseHandler(this);
pool.authenticatedConnections.removeElementAt(index);
try {
p.logout();
} catch (ProtocolException pex) {}
}
}
pool.lastTimePruned = System.currentTimeMillis();
}
}
} | void function() { synchronized (pool) { if (System.currentTimeMillis() - pool.lastTimePruned > pool.pruningInterval && pool.authenticatedConnections.size() > 1) { if (pool.debug) { out.println(STR + STR + (System.currentTimeMillis() - pool.lastTimePruned)); out.println(STR + pool.clientTimeoutInterval); } IMAPProtocol p; for (int index = pool.authenticatedConnections.size() - 1; index > 0; index--) { p = (IMAPProtocol)pool.authenticatedConnections. elementAt(index); if (pool.debug) { out.println(STR + (System.currentTimeMillis() - p.getTimestamp())); } if (System.currentTimeMillis() - p.getTimestamp() > pool.clientTimeoutInterval) { if (pool.debug) { out.println(STR + STR); out.println(STR + STR); } p.removeResponseHandler(this); pool.authenticatedConnections.removeElementAt(index); try { p.logout(); } catch (ProtocolException pex) {} } } pool.lastTimePruned = System.currentTimeMillis(); } } } | /**
* Check to see if it's time to shrink the connection pool.
*/ | Check to see if it's time to shrink the connection pool | timeoutConnections | {
"repo_name": "arthurzaczek/kolab-android",
"path": "javamail/com/sun/mail/imap/IMAPStore.java",
"license": "gpl-3.0",
"size": 60428
} | [
"com.sun.mail.iap.ProtocolException",
"com.sun.mail.imap.protocol.IMAPProtocol"
] | import com.sun.mail.iap.ProtocolException; import com.sun.mail.imap.protocol.IMAPProtocol; | import com.sun.mail.iap.*; import com.sun.mail.imap.protocol.*; | [
"com.sun.mail"
] | com.sun.mail; | 2,676,634 |
void setExtends(JvmParameterizedTypeReference value); | void setExtends(JvmParameterizedTypeReference value); | /**
* Sets the value of the '{@link io.sarl.lang.sarl.SarlSkill#getExtends <em>Extends</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Extends</em>' containment reference.
* @see #getExtends()
* @generated
*/ | Sets the value of the '<code>io.sarl.lang.sarl.SarlSkill#getExtends Extends</code>' containment reference. | setExtends | {
"repo_name": "jgfoster/sarl",
"path": "main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/sarl/SarlSkill.java",
"license": "apache-2.0",
"size": 2583
} | [
"org.eclipse.xtext.common.types.JvmParameterizedTypeReference"
] | import org.eclipse.xtext.common.types.JvmParameterizedTypeReference; | import org.eclipse.xtext.common.types.*; | [
"org.eclipse.xtext"
] | org.eclipse.xtext; | 2,055,844 |
public void testCase12() {
byte bBytes[] = {15, 48, -29, 7, 98, -1, 39, -128};
int bSign = -1;
byte rBytes[] = {0};
BigInteger aNumber = BigInteger.ZERO;
BigInteger bNumber = new BigInteger(bSign, bBytes);
BigInteger result = aNumber.divide(bNumber);
byte resBytes[] = new byte[rBytes.length];
resBytes = result.toByteArray();
for(int i = 0; i < resBytes.length; i++) {
assertTrue(resBytes[i] == rBytes[i]);
}
assertEquals("incorrect sign", 0, result.signum());
} | void function() { byte bBytes[] = {15, 48, -29, 7, 98, -1, 39, -128}; int bSign = -1; byte rBytes[] = {0}; BigInteger aNumber = BigInteger.ZERO; BigInteger bNumber = new BigInteger(bSign, bBytes); BigInteger result = aNumber.divide(bNumber); byte resBytes[] = new byte[rBytes.length]; resBytes = result.toByteArray(); for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } assertEquals(STR, 0, result.signum()); } | /**
* Divide ZERO by a negative number.
*/ | Divide ZERO by a negative number | testCase12 | {
"repo_name": "freeVM/freeVM",
"path": "enhanced/archive/classlib/java6/modules/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerDivideTest.java",
"license": "apache-2.0",
"size": 25307
} | [
"java.math.BigInteger"
] | import java.math.BigInteger; | import java.math.*; | [
"java.math"
] | java.math; | 545,197 |
public static int playAudio(String jrRefURI) {
if(!audioTurnedOn()){
return AUDIO_DISABLED;
}
synchronized(audioLock) {
String curAudioURI = jrRefURI;
int retcode = AUDIO_SUCCESS;
try {
Reference curAudRef = ReferenceManager._().DeriveReference(curAudioURI);
String format = getFileFormat(curAudioURI);
if(format == null) return AUDIO_NOT_RECOGNIZED;
//So there's an unfortunate issue where media which isn't associated (and won't play)
//can result in audio being stopped when alternate selections are made, but we won't
//worry about that for now
stopAudio();
audioPlayer = MediaUtils.getPlayerLoose(curAudRef);
//Sometimes there's just no audio player
if(audioPlayer == null) {
return AUDIO_DISABLED;
}
audioPlayer.realize();
crankAudio(audioPlayer);
audioPlayer.start();
} catch (InvalidReferenceException ire) {
retcode = AUDIO_ERROR;
System.err.println("Invalid Reference Exception when attempting to play audio at URI:"+ curAudioURI + "Exception msg:"+ire.getMessage());
} catch (IOException ioe) {
retcode = AUDIO_ERROR;
System.err.println("IO Exception (input cannot be read) when attempting to play audio stream with URI:"+ curAudioURI + "Exception msg:"+ioe.getMessage());
} catch (MediaException e) {
//TODO: We need to figure out how to deal with silent stuff correctly
//Logger.log("auderme", e.getMessage());
//J2MEDisplay.showError(null, "Phone is on silent!");
retcode = AUDIO_ERROR;
System.err.println("Media format not supported! Uri: "+ curAudioURI + "Exception msg:"+e.getMessage());
} catch(SecurityException e) {
//Logger.log("auderse", e.getMessage());
//J2MEDisplay.showError(null, "Phone is on silent!");
}
return retcode;
}
} | static int function(String jrRefURI) { if(!audioTurnedOn()){ return AUDIO_DISABLED; } synchronized(audioLock) { String curAudioURI = jrRefURI; int retcode = AUDIO_SUCCESS; try { Reference curAudRef = ReferenceManager._().DeriveReference(curAudioURI); String format = getFileFormat(curAudioURI); if(format == null) return AUDIO_NOT_RECOGNIZED; stopAudio(); audioPlayer = MediaUtils.getPlayerLoose(curAudRef); if(audioPlayer == null) { return AUDIO_DISABLED; } audioPlayer.realize(); crankAudio(audioPlayer); audioPlayer.start(); } catch (InvalidReferenceException ire) { retcode = AUDIO_ERROR; System.err.println(STR+ curAudioURI + STR+ire.getMessage()); } catch (IOException ioe) { retcode = AUDIO_ERROR; System.err.println(STR+ curAudioURI + STR+ioe.getMessage()); } catch (MediaException e) { retcode = AUDIO_ERROR; System.err.println(STR+ curAudioURI + STR+e.getMessage()); } catch(SecurityException e) { } return retcode; } } | /**
* Begin audio playback of the content at the uri.
*
* @param jrRefURI a JR reference to audio content
* @param tag an optional tag to associate with this playback to
* allow it to be paused/resumed.
* @return One of the AUDIO_ return codes
*/ | Begin audio playback of the content at the uri | playAudio | {
"repo_name": "dimagi/javarosa",
"path": "javarosa/j2me/form-entry/src/org/javarosa/utilities/media/MediaUtils.java",
"license": "apache-2.0",
"size": 13104
} | [
"java.io.IOException",
"javax.microedition.media.MediaException",
"org.javarosa.core.reference.InvalidReferenceException",
"org.javarosa.core.reference.Reference",
"org.javarosa.core.reference.ReferenceManager"
] | import java.io.IOException; import javax.microedition.media.MediaException; import org.javarosa.core.reference.InvalidReferenceException; import org.javarosa.core.reference.Reference; import org.javarosa.core.reference.ReferenceManager; | import java.io.*; import javax.microedition.media.*; import org.javarosa.core.reference.*; | [
"java.io",
"javax.microedition",
"org.javarosa.core"
] | java.io; javax.microedition; org.javarosa.core; | 225,992 |
public static OneResponse chmod(Client client, int id,
int owner_u, int owner_m, int owner_a,
int group_u, int group_m, int group_a,
int other_u, int other_m, int other_a)
{
return chmod(client, CHMOD, id,
owner_u, owner_m, owner_a,
group_u, group_m, group_a,
other_u, other_m, other_a);
} | static OneResponse function(Client client, int id, int owner_u, int owner_m, int owner_a, int group_u, int group_m, int group_a, int other_u, int other_m, int other_a) { return chmod(client, CHMOD, id, owner_u, owner_m, owner_a, group_u, group_m, group_a, other_u, other_m, other_a); } | /**
* Changes the datastore permissions
*
* @param client XML-RPC Client.
* @param id The id of the target datastore.
* @param owner_u 1 to allow, 0 deny, -1 do not change
* @param owner_m 1 to allow, 0 deny, -1 do not change
* @param owner_a 1 to allow, 0 deny, -1 do not change
* @param group_u 1 to allow, 0 deny, -1 do not change
* @param group_m 1 to allow, 0 deny, -1 do not change
* @param group_a 1 to allow, 0 deny, -1 do not change
* @param other_u 1 to allow, 0 deny, -1 do not change
* @param other_m 1 to allow, 0 deny, -1 do not change
* @param other_a 1 to allow, 0 deny, -1 do not change
* @return If an error occurs the error message contains the reason.
*/ | Changes the datastore permissions | chmod | {
"repo_name": "bcec/opennebula3.4.1",
"path": "src/oca/java/src/org/opennebula/client/datastore/Datastore.java",
"license": "apache-2.0",
"size": 11298
} | [
"org.opennebula.client.Client",
"org.opennebula.client.OneResponse"
] | import org.opennebula.client.Client; import org.opennebula.client.OneResponse; | import org.opennebula.client.*; | [
"org.opennebula.client"
] | org.opennebula.client; | 2,512,035 |
private void checkStopOnFailure(boolean stop_on_failure) throws ExecException{
if (jc.getFailedJobs().isEmpty())
return;
if (stop_on_failure){
int errCode = 6017;
StringBuilder msg = new StringBuilder();
for (int i=0; i<jc.getFailedJobs().size(); i++) {
Job j = jc.getFailedJobs().get(i);
msg.append(j.getMessage());
if (i!=jc.getFailedJobs().size()-1) {
msg.append("\n");
}
}
throw new ExecException(msg.toString(), errCode,
PigException.REMOTE_ENVIRONMENT);
}
} | void function(boolean stop_on_failure) throws ExecException{ if (jc.getFailedJobs().isEmpty()) return; if (stop_on_failure){ int errCode = 6017; StringBuilder msg = new StringBuilder(); for (int i=0; i<jc.getFailedJobs().size(); i++) { Job j = jc.getFailedJobs().get(i); msg.append(j.getMessage()); if (i!=jc.getFailedJobs().size()-1) { msg.append("\n"); } } throw new ExecException(msg.toString(), errCode, PigException.REMOTE_ENVIRONMENT); } } | /**
* If stop_on_failure is enabled and any job has failed, an ExecException is thrown.
* @param stop_on_failure whether it's enabled.
* @throws ExecException If stop_on_failure is enabled and any job is failed
*/ | If stop_on_failure is enabled and any job has failed, an ExecException is thrown | checkStopOnFailure | {
"repo_name": "bsmedberg/pig",
"path": "src/org/apache/pig/backend/hadoop/executionengine/mapReduceLayer/MapReduceLauncher.java",
"license": "apache-2.0",
"size": 30785
} | [
"org.apache.hadoop.mapred.jobcontrol.Job",
"org.apache.pig.PigException",
"org.apache.pig.backend.executionengine.ExecException"
] | import org.apache.hadoop.mapred.jobcontrol.Job; import org.apache.pig.PigException; import org.apache.pig.backend.executionengine.ExecException; | import org.apache.hadoop.mapred.jobcontrol.*; import org.apache.pig.*; import org.apache.pig.backend.executionengine.*; | [
"org.apache.hadoop",
"org.apache.pig"
] | org.apache.hadoop; org.apache.pig; | 1,012,040 |
protected void deleteDocuments() throws IOException {
SearchRequest request = new SearchRequest("*");
request.source().size(1000);
SearchResponse response = elasticClient.search(request);
BulkRequest bulkRequest = new BulkRequest()
.setRefreshPolicy(RefreshPolicy.IMMEDIATE);
for (SearchHit hit : response.getHits().getHits()) {
DeleteRequest deleteRequest = new DeleteRequest(hit.getIndex())
.id(hit.getId())
.type(hit.getType());
bulkRequest.add(deleteRequest);
}
elasticClient.bulk(bulkRequest);
} | void function() throws IOException { SearchRequest request = new SearchRequest("*"); request.source().size(1000); SearchResponse response = elasticClient.search(request); BulkRequest bulkRequest = new BulkRequest() .setRefreshPolicy(RefreshPolicy.IMMEDIATE); for (SearchHit hit : response.getHits().getHits()) { DeleteRequest deleteRequest = new DeleteRequest(hit.getIndex()) .id(hit.getId()) .type(hit.getType()); bulkRequest.add(deleteRequest); } elasticClient.bulk(bulkRequest); } | /**
* Deletes all documents in all indexes
*/ | Deletes all documents in all indexes | deleteDocuments | {
"repo_name": "gurbuzali/hazelcast-jet",
"path": "extensions/elasticsearch/elasticsearch-5/src/test/java/com/hazelcast/jet/elastic/BaseElasticTest.java",
"license": "apache-2.0",
"size": 10430
} | [
"java.io.IOException",
"org.elasticsearch.action.bulk.BulkRequest",
"org.elasticsearch.action.delete.DeleteRequest",
"org.elasticsearch.action.search.SearchRequest",
"org.elasticsearch.action.search.SearchResponse",
"org.elasticsearch.action.support.WriteRequest",
"org.elasticsearch.search.SearchHit"
] | import java.io.IOException; import org.elasticsearch.action.bulk.BulkRequest; import org.elasticsearch.action.delete.DeleteRequest; import org.elasticsearch.action.search.SearchRequest; import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.action.support.WriteRequest; import org.elasticsearch.search.SearchHit; | import java.io.*; import org.elasticsearch.action.bulk.*; import org.elasticsearch.action.delete.*; import org.elasticsearch.action.search.*; import org.elasticsearch.action.support.*; import org.elasticsearch.search.*; | [
"java.io",
"org.elasticsearch.action",
"org.elasticsearch.search"
] | java.io; org.elasticsearch.action; org.elasticsearch.search; | 1,568,170 |
public static String concat(List<String> strs, String between) {
String cat = "";
for (int i = 0; i < strs.size(); i++) {
if (i == 0) {
cat = strs.get(i);
continue;
}
cat += between + strs.get(i);
}
return cat;
}
//@@author | static String function(List<String> strs, String between) { String cat = ""; for (int i = 0; i < strs.size(); i++) { if (i == 0) { cat = strs.get(i); continue; } cat += between + strs.get(i); } return cat; } //@ | /**
* Concatenates Strings with the specified character
* @param Strings to concatenate
* @param String to repeat between strs
* @return Concatenated String
*/ | Concatenates Strings with the specified character | concat | {
"repo_name": "CS2103JAN2017-F11-B3/main",
"path": "src/main/java/seedu/task/commons/util/StringUtil.java",
"license": "mit",
"size": 3609
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,841,564 |
public final native JavaScriptObject getSource()
;
| final native JavaScriptObject function() ; | /**
* the source object that fired the event
*/ | the source object that fired the event | getSource | {
"repo_name": "urish/gwt-titanium",
"path": "src/main/java/org/urish/gwtit/client/event/AbstractTitaniumEvent.java",
"license": "apache-2.0",
"size": 560
} | [
"com.google.gwt.core.client.JavaScriptObject"
] | import com.google.gwt.core.client.JavaScriptObject; | import com.google.gwt.core.client.*; | [
"com.google.gwt"
] | com.google.gwt; | 2,605,346 |
@Deprecated
@NonNull
public static Calendar localDateTimeToCalendar(@NonNull LocalDateTime localDateTime) {
//noinspection deprecation
return localDateTimeToCalendar(localDateTime, ZoneId.systemDefault());
} | static Calendar function(@NonNull LocalDateTime localDateTime) { return localDateTimeToCalendar(localDateTime, ZoneId.systemDefault()); } | /**
* Convert an instance of the <code>LocalDateTime</code> Java 8 Time backport to a <code>Calendar</code> instance,
* using the rules given by <code>zoneId</code>.
*
* @param localDateTime the date to be converted.
* @return a new <code>Date</code> instance representing the same date as <code>localDateTime</code> using the
* <code>zoneId</code> rules.
* @deprecated Use it only for third party libraries.
*/ | Convert an instance of the <code>LocalDateTime</code> Java 8 Time backport to a <code>Calendar</code> instance, using the rules given by <code>zoneId</code> | localDateTimeToCalendar | {
"repo_name": "chacaa/DoApp",
"path": "app/src/main/java/com/xmartlabs/scasas/doapp/helper/DateHelper.java",
"license": "apache-2.0",
"size": 15541
} | [
"android.support.annotation.NonNull",
"java.util.Calendar",
"org.threeten.bp.LocalDateTime",
"org.threeten.bp.ZoneId"
] | import android.support.annotation.NonNull; import java.util.Calendar; import org.threeten.bp.LocalDateTime; import org.threeten.bp.ZoneId; | import android.support.annotation.*; import java.util.*; import org.threeten.bp.*; | [
"android.support",
"java.util",
"org.threeten.bp"
] | android.support; java.util; org.threeten.bp; | 1,080,410 |
public TransportProtocol protocol() {
return this.protocol;
} | TransportProtocol function() { return this.protocol; } | /**
* Get possible values include: 'Udp', 'Tcp', 'All'.
*
* @return the protocol value
*/ | Get possible values include: 'Udp', 'Tcp', 'All' | protocol | {
"repo_name": "navalev/azure-sdk-for-java",
"path": "sdk/network/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/LoadBalancingRuleInner.java",
"license": "mit",
"size": 14287
} | [
"com.microsoft.azure.management.network.v2018_07_01.TransportProtocol"
] | import com.microsoft.azure.management.network.v2018_07_01.TransportProtocol; | import com.microsoft.azure.management.network.v2018_07_01.*; | [
"com.microsoft.azure"
] | com.microsoft.azure; | 2,886,060 |
//-----------------------------------------------------------------------
public final MetaProperty<PagingRequest> pagingRequest() {
return _pagingRequest;
} | final MetaProperty<PagingRequest> function() { return _pagingRequest; } | /**
* The meta-property for the {@code pagingRequest} property.
* @return the meta-property, not null
*/ | The meta-property for the pagingRequest property | pagingRequest | {
"repo_name": "codeaudit/OG-Platform",
"path": "projects/OG-Master/src/main/java/com/opengamma/master/user/UserSearchRequest.java",
"license": "apache-2.0",
"size": 28098
} | [
"com.opengamma.util.paging.PagingRequest",
"org.joda.beans.MetaProperty"
] | import com.opengamma.util.paging.PagingRequest; import org.joda.beans.MetaProperty; | import com.opengamma.util.paging.*; import org.joda.beans.*; | [
"com.opengamma.util",
"org.joda.beans"
] | com.opengamma.util; org.joda.beans; | 1,955,445 |
public Date getDate()
{
try
{
if (time instanceof ASN1UTCTime)
{
return ((ASN1UTCTime)time).getAdjustedDate();
}
else
{
return ((ASN1GeneralizedTime)time).getDate();
}
}
catch (ParseException e)
{ // this should never happen
throw new IllegalStateException("invalid date string: " + e.getMessage());
}
} | Date function() { try { if (time instanceof ASN1UTCTime) { return ((ASN1UTCTime)time).getAdjustedDate(); } else { return ((ASN1GeneralizedTime)time).getDate(); } } catch (ParseException e) { throw new IllegalStateException(STR + e.getMessage()); } } | /**
* Get java.util.Date version of date+time.
*/ | Get java.util.Date version of date+time | getDate | {
"repo_name": "ripple/ripple-lib-java",
"path": "ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/asn1/cms/Time.java",
"license": "isc",
"size": 5810
} | [
"java.text.ParseException",
"java.util.Date",
"org.ripple.bouncycastle.asn1.ASN1GeneralizedTime",
"org.ripple.bouncycastle.asn1.ASN1UTCTime"
] | import java.text.ParseException; import java.util.Date; import org.ripple.bouncycastle.asn1.ASN1GeneralizedTime; import org.ripple.bouncycastle.asn1.ASN1UTCTime; | import java.text.*; import java.util.*; import org.ripple.bouncycastle.asn1.*; | [
"java.text",
"java.util",
"org.ripple.bouncycastle"
] | java.text; java.util; org.ripple.bouncycastle; | 2,004,894 |
public boolean isCaseSensitive(int column) throws java.sql.SQLException {
Field field = getField(column);
int sqlType = field.getSQLType();
switch (sqlType) {
case Types.BIT:
case Types.TINYINT:
case Types.SMALLINT:
case Types.INTEGER:
case Types.BIGINT:
case Types.FLOAT:
case Types.REAL:
case Types.DOUBLE:
case Types.DATE:
case Types.TIME:
case Types.TIMESTAMP:
return false;
case Types.CHAR:
case Types.VARCHAR:
case Types.LONGVARCHAR:
if (field.isBinary()) {
return true;
}
String collationName = field.getCollation();
return ((collationName != null) && !collationName.endsWith("_ci"));
default:
return true;
}
} | boolean function(int column) throws java.sql.SQLException { Field field = getField(column); int sqlType = field.getSQLType(); switch (sqlType) { case Types.BIT: case Types.TINYINT: case Types.SMALLINT: case Types.INTEGER: case Types.BIGINT: case Types.FLOAT: case Types.REAL: case Types.DOUBLE: case Types.DATE: case Types.TIME: case Types.TIMESTAMP: return false; case Types.CHAR: case Types.VARCHAR: case Types.LONGVARCHAR: if (field.isBinary()) { return true; } String collationName = field.getCollation(); return ((collationName != null) && !collationName.endsWith("_ci")); default: return true; } } | /**
* Does a column's case matter?
*
* @param column
* the first column is 1, the second is 2...
*
* @return true if so
*
* @throws java.sql.SQLException
* if a database access error occurs
*/ | Does a column's case matter | isCaseSensitive | {
"repo_name": "scopej/mysql-connector-j",
"path": "src/com/mysql/jdbc/ResultSetMetaData.java",
"license": "gpl-2.0",
"size": 24375
} | [
"java.sql.SQLException",
"java.sql.Types"
] | import java.sql.SQLException; import java.sql.Types; | import java.sql.*; | [
"java.sql"
] | java.sql; | 32,632 |
public void readFromNBT(NBTTagCompound nbt)
{
this.tickCounter = nbt.getInteger("Tick");
NBTTagList nbttaglist = nbt.getTagList("Villages", 10);
for (int i = 0; i < nbttaglist.tagCount(); ++i)
{
NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(i);
Village village = new Village();
village.readVillageDataFromNBT(nbttagcompound);
this.villageList.add(village);
}
} | void function(NBTTagCompound nbt) { this.tickCounter = nbt.getInteger("Tick"); NBTTagList nbttaglist = nbt.getTagList(STR, 10); for (int i = 0; i < nbttaglist.tagCount(); ++i) { NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(i); Village village = new Village(); village.readVillageDataFromNBT(nbttagcompound); this.villageList.add(village); } } | /**
* reads in data from the NBTTagCompound into this MapDataBase
*/ | reads in data from the NBTTagCompound into this MapDataBase | readFromNBT | {
"repo_name": "danielyc/test-1.9.4",
"path": "build/tmp/recompileMc/sources/net/minecraft/village/VillageCollection.java",
"license": "gpl-3.0",
"size": 8581
} | [
"net.minecraft.nbt.NBTTagCompound",
"net.minecraft.nbt.NBTTagList"
] | import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; | import net.minecraft.nbt.*; | [
"net.minecraft.nbt"
] | net.minecraft.nbt; | 2,265,988 |
private void writeVectorToCluster(Writer writer, WeightedVectorWritable point) throws IOException {
writer.append(new LongWritable(uniqueVectorId++), new VectorWritable(point.getVector()));
writer.sync();
} | void function(Writer writer, WeightedVectorWritable point) throws IOException { writer.append(new LongWritable(uniqueVectorId++), new VectorWritable(point.getVector())); writer.sync(); } | /**
* Writes vector to the cluster directory.
*/ | Writes vector to the cluster directory | writeVectorToCluster | {
"repo_name": "huran2014/huran.github.io",
"path": "program_learning/Java/MyEclipseProfessional2014/mr/src/main/java/org/apache/mahout/clustering/topdown/postprocessor/ClusterOutputPostProcessor.java",
"license": "gpl-2.0",
"size": 5828
} | [
"java.io.IOException",
"org.apache.hadoop.io.LongWritable",
"org.apache.hadoop.io.SequenceFile",
"org.apache.mahout.clustering.classify.WeightedVectorWritable",
"org.apache.mahout.math.VectorWritable"
] | import java.io.IOException; import org.apache.hadoop.io.LongWritable; import org.apache.hadoop.io.SequenceFile; import org.apache.mahout.clustering.classify.WeightedVectorWritable; import org.apache.mahout.math.VectorWritable; | import java.io.*; import org.apache.hadoop.io.*; import org.apache.mahout.clustering.classify.*; import org.apache.mahout.math.*; | [
"java.io",
"org.apache.hadoop",
"org.apache.mahout"
] | java.io; org.apache.hadoop; org.apache.mahout; | 2,237,199 |
public static byte[] toArray(ByteBuffer buffer) {
return toArray(buffer, 0, buffer.remaining());
} | static byte[] function(ByteBuffer buffer) { return toArray(buffer, 0, buffer.remaining()); } | /**
* Read the given byte buffer from its current position to its limit into a byte array.
* @param buffer The buffer to read from
*/ | Read the given byte buffer from its current position to its limit into a byte array | toArray | {
"repo_name": "ollie314/kafka",
"path": "clients/src/main/java/org/apache/kafka/common/utils/Utils.java",
"license": "apache-2.0",
"size": 36102
} | [
"java.nio.ByteBuffer"
] | import java.nio.ByteBuffer; | import java.nio.*; | [
"java.nio"
] | java.nio; | 1,010,164 |
public Permission getPermAPI() {
return permAPI;
} | Permission function() { return permAPI; } | /**
* Gets the Permission API.
*
* @return The Permission API.
*/ | Gets the Permission API | getPermAPI | {
"repo_name": "simplyianm/PermClasses",
"path": "src/main/java/net/crimsoncraft/permclasses/PermClasses.java",
"license": "agpl-3.0",
"size": 3512
} | [
"net.milkbowl.vault.permission.Permission"
] | import net.milkbowl.vault.permission.Permission; | import net.milkbowl.vault.permission.*; | [
"net.milkbowl.vault"
] | net.milkbowl.vault; | 1,042,373 |
public static final String NX_CRITICAL_ENERGY = "critical_energy";
public static final String NX_BENDING_RADIUS = "bending_radius";
public static final String NX_MAGNETIC_FIELD = "magnetic_field";
public static final String NX_ACCEPTED_PHOTON_BEAM_DIVERGENCE = "accepted_photon_beam_divergence";
public static final String NX_SOURCE_DISTANCE_X = "source_distance_x";
public static final String NX_SOURCE_DISTANCE_Y = "source_distance_y";
public static final String NX_DIVERGENCE_X_PLUS = "divergence_x_plus";
public static final String NX_DIVERGENCE_X_MINUS = "divergence_x_minus";
public static final String NX_DIVERGENCE_Y_PLUS = "divergence_y_plus";
public static final String NX_DIVERGENCE_Y_MINUS = "divergence_y_minus";
public IDataset getCritical_energy();
| static final String NX_CRITICAL_ENERGY = STR; public static final String NX_BENDING_RADIUS = STR; public static final String NX_MAGNETIC_FIELD = STR; public static final String NX_ACCEPTED_PHOTON_BEAM_DIVERGENCE = STR; public static final String NX_SOURCE_DISTANCE_X = STR; public static final String NX_SOURCE_DISTANCE_Y = STR; public static final String NX_DIVERGENCE_X_PLUS = STR; public static final String NX_DIVERGENCE_X_MINUS = STR; public static final String NX_DIVERGENCE_Y_PLUS = STR; public static final String NX_DIVERGENCE_Y_MINUS = STR; public IDataset function(); | /**
* <p>
* <b>Type:</b> NX_FLOAT
* <b>Units:</b> NX_ENERGY
* </p>
*
* @return the value.
*/ | Type: NX_FLOAT Units: NX_ENERGY | getCritical_energy | {
"repo_name": "jamesmudd/dawnsci",
"path": "org.eclipse.dawnsci.nexus/autogen/org/eclipse/dawnsci/nexus/NXbending_magnet.java",
"license": "epl-1.0",
"size": 14159
} | [
"org.eclipse.january.dataset.IDataset"
] | import org.eclipse.january.dataset.IDataset; | import org.eclipse.january.dataset.*; | [
"org.eclipse.january"
] | org.eclipse.january; | 1,980,457 |
public void testCase13() {
byte aBytes[] = {1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6, 7};
byte bBytes[] = {10, 20, 30, 40, 50, 60, 70, 10, 20, 30};
int aSign = -1;
int bSign = 1;
byte rBytes[] = {-2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23};
BigInteger aNumber = new BigInteger(aSign, aBytes);
BigInteger bNumber = new BigInteger(bSign, bBytes);
BigInteger result = aNumber.add(bNumber);
byte resBytes[] = new byte[rBytes.length];
resBytes = result.toByteArray();
for (int i = 0; i < resBytes.length; i++) {
assertTrue(resBytes[i] == rBytes[i]);
}
assertEquals("incorrect sign", -1, result.signum());
} | void function() { byte aBytes[] = {1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6, 7}; byte bBytes[] = {10, 20, 30, 40, 50, 60, 70, 10, 20, 30}; int aSign = -1; int bSign = 1; byte rBytes[] = {-2, -3, -4, -4, 5, 14, 23, 39, 48, 57, 66, 5, 14, 23}; BigInteger aNumber = new BigInteger(aSign, aBytes); BigInteger bNumber = new BigInteger(bSign, bBytes); BigInteger result = aNumber.add(bNumber); byte resBytes[] = new byte[rBytes.length]; resBytes = result.toByteArray(); for (int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } assertEquals(STR, -1, result.signum()); } | /**
* Add two numbers of different length and sign. The first is negative. The
* first is longer.
*/ | Add two numbers of different length and sign. The first is negative. The first is longer | testCase13 | {
"repo_name": "google/j2cl",
"path": "jre/javatests/com/google/gwt/emultest/java/math/BigIntegerAddTest.java",
"license": "apache-2.0",
"size": 17482
} | [
"java.math.BigInteger"
] | import java.math.BigInteger; | import java.math.*; | [
"java.math"
] | java.math; | 918,239 |
public IMODocHeader getDefaultIMODocHeader() throws MalformedURLException,
IOException {
IMODocument imoDocument = this.getDefaultIMODocument();
return this.getIMODocHeader(imoDocument);
}
/**
* Returns only the {@link IMODocBody} portion of the {@link IMODocument}.
*
* @param imoDocument
* {@link IMODocument} comprised of two parts:
* {@link IMODocHeader} and {@link IMODocBody}.
* @return {@link IMODocBody}
| IMODocHeader function() throws MalformedURLException, IOException { IMODocument imoDocument = this.getDefaultIMODocument(); return this.getIMODocHeader(imoDocument); } /** * Returns only the {@link IMODocBody} portion of the {@link IMODocument}. * * @param imoDocument * {@link IMODocument} comprised of two parts: * {@link IMODocHeader} and {@link IMODocBody}. * @return {@link IMODocBody} | /**
* This method uses {@link #defaultUrlString} to request the current
* (default) {@link IMODocHeader}.
*
* @return {@link IMODocHeader} for the current (default) report.
* @throws MalformedURLException
* @throws IOException
*/ | This method uses <code>#defaultUrlString</code> to request the current (default) <code>IMODocHeader</code> | getDefaultIMODocHeader | {
"repo_name": "r24mille/IesoPublicReportBindings",
"path": "src/main/java/name/reidmiller/iesoreports/client/IntertieScheduleAndFlowClient.java",
"license": "mit",
"size": 7163
} | [
"ca.ieso.reports.schema.intertiescheduleflow.IMODocBody",
"ca.ieso.reports.schema.intertiescheduleflow.IMODocHeader",
"ca.ieso.reports.schema.intertiescheduleflow.IMODocument",
"java.io.IOException",
"java.net.MalformedURLException"
] | import ca.ieso.reports.schema.intertiescheduleflow.IMODocBody; import ca.ieso.reports.schema.intertiescheduleflow.IMODocHeader; import ca.ieso.reports.schema.intertiescheduleflow.IMODocument; import java.io.IOException; import java.net.MalformedURLException; | import ca.ieso.reports.schema.intertiescheduleflow.*; import java.io.*; import java.net.*; | [
"ca.ieso.reports",
"java.io",
"java.net"
] | ca.ieso.reports; java.io; java.net; | 2,401,557 |
public void findContentlets(List<String> inodes,List<Contentlet> returnValue);
| void function(List<String> inodes,List<Contentlet> returnValue); | /**
* Gets a list of Contentlets from a passed in list of inodes.
* @param inodes
* @param returnValue - value returned by primary API Method
*/ | Gets a list of Contentlets from a passed in list of inodes | findContentlets | {
"repo_name": "guhb/core",
"path": "src/com/dotmarketing/portlets/contentlet/business/ContentletAPIPostHook.java",
"license": "gpl-3.0",
"size": 52012
} | [
"com.dotmarketing.portlets.contentlet.model.Contentlet",
"java.util.List"
] | import com.dotmarketing.portlets.contentlet.model.Contentlet; import java.util.List; | import com.dotmarketing.portlets.contentlet.model.*; import java.util.*; | [
"com.dotmarketing.portlets",
"java.util"
] | com.dotmarketing.portlets; java.util; | 644,596 |
default BSLabel createLabel(WicketBuildContext ctx) {
final AttributeModel<String> labelModel = new AttributeModel<>(ctx.getModel(), SPackageBasic.ATR_LABEL);
BSLabel label = new BSLabel("label", labelModel);
label.add(DisabledClassBehavior.getInstance());
label.setVisible(!ctx.getHint(NO_DECORATION));
label.setEscapeModelStrings(!ctx.getCurrentInstance().asAtr().isEnabledHTMLInLabel());
label.add($b.onConfigure(c -> {
if (ctx.getHint(HIDE_LABEL) || StringUtils.isEmpty(labelModel.getObject())) {
c.setVisible(false);
}
}));
return label;
} | default BSLabel createLabel(WicketBuildContext ctx) { final AttributeModel<String> labelModel = new AttributeModel<>(ctx.getModel(), SPackageBasic.ATR_LABEL); BSLabel label = new BSLabel("label", labelModel); label.add(DisabledClassBehavior.getInstance()); label.setVisible(!ctx.getHint(NO_DECORATION)); label.setEscapeModelStrings(!ctx.getCurrentInstance().asAtr().isEnabledHTMLInLabel()); label.add($b.onConfigure(c -> { if (ctx.getHint(HIDE_LABEL) StringUtils.isEmpty(labelModel.getObject())) { c.setVisible(false); } })); return label; } | /**
* Method responsible for create and configurate the label used by the default's inputs by Singular form.
*
* @param ctx The WicketBuildCOntext, to know if contains the <code>HIDE_LABEL</code> configuration.
* @return The Bootstrap label configured.
*/ | Method responsible for create and configurate the label used by the default's inputs by Singular form | createLabel | {
"repo_name": "opensingular/singular-core",
"path": "form/wicket/src/main/java/org/opensingular/form/wicket/IWicketComponentMapper.java",
"license": "apache-2.0",
"size": 5250
} | [
"org.apache.commons.lang3.StringUtils",
"org.opensingular.form.type.basic.SPackageBasic",
"org.opensingular.form.wicket.behavior.DisabledClassBehavior",
"org.opensingular.form.wicket.model.AttributeModel",
"org.opensingular.lib.wicket.util.bootstrap.layout.BSLabel"
] | import org.apache.commons.lang3.StringUtils; import org.opensingular.form.type.basic.SPackageBasic; import org.opensingular.form.wicket.behavior.DisabledClassBehavior; import org.opensingular.form.wicket.model.AttributeModel; import org.opensingular.lib.wicket.util.bootstrap.layout.BSLabel; | import org.apache.commons.lang3.*; import org.opensingular.form.type.basic.*; import org.opensingular.form.wicket.behavior.*; import org.opensingular.form.wicket.model.*; import org.opensingular.lib.wicket.util.bootstrap.layout.*; | [
"org.apache.commons",
"org.opensingular.form",
"org.opensingular.lib"
] | org.apache.commons; org.opensingular.form; org.opensingular.lib; | 1,708,927 |
@Test
public void testAdminFactory() throws IOException {
Connection con1 = ConnectionFactory.createConnection(TEST_UTIL.getConfiguration());
Admin admin = con1.getAdmin();
assertTrue(admin.getConnection() == con1);
assertTrue(admin.getConfiguration() == TEST_UTIL.getConfiguration());
con1.close();
} | void function() throws IOException { Connection con1 = ConnectionFactory.createConnection(TEST_UTIL.getConfiguration()); Admin admin = con1.getAdmin(); assertTrue(admin.getConnection() == con1); assertTrue(admin.getConfiguration() == TEST_UTIL.getConfiguration()); con1.close(); } | /**
* Naive test to check that HConnection#getAdmin returns a properly constructed HBaseAdmin object
* @throws IOException Unable to construct admin
*/ | Naive test to check that HConnection#getAdmin returns a properly constructed HBaseAdmin object | testAdminFactory | {
"repo_name": "toshimasa-nasu/hbase",
"path": "hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestHCM.java",
"license": "apache-2.0",
"size": 53549
} | [
"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; | 1,428,223 |
protected void addMember (SocialUser player) {
if (inClan(player.getHash())) {
return;
}
ClanMember newMember = new ClanMember(player.getHash());
AccountInfo info = Virtue.getInstance().getAccountIndex().lookupByHash(newMember.getUserHash());
if (info == null) {
newMember.setDisplayName(AccountInfo.generateNamePlaceholder(newMember.getUserHash()));
} else {
newMember.setDisplayName(info.getDisplayName());
}
synchronized (this) {
members.add(newMember);
findClanOwner();
getDelta().addMember(player.getHash(), newMember.getDisplayName(), newMember.getJoinDay());
}
if (linkedChannel != null) {
linkedChannel.updateUserRank(player.getHash(), getRank(player.getHash()).getID());
}
}
| void function (SocialUser player) { if (inClan(player.getHash())) { return; } ClanMember newMember = new ClanMember(player.getHash()); AccountInfo info = Virtue.getInstance().getAccountIndex().lookupByHash(newMember.getUserHash()); if (info == null) { newMember.setDisplayName(AccountInfo.generateNamePlaceholder(newMember.getUserHash())); } else { newMember.setDisplayName(info.getDisplayName()); } synchronized (this) { members.add(newMember); findClanOwner(); getDelta().addMember(player.getHash(), newMember.getDisplayName(), newMember.getJoinDay()); } if (linkedChannel != null) { linkedChannel.updateUserRank(player.getHash(), getRank(player.getHash()).getID()); } } | /**
* Adds the provided player to the clan.
* Note that setting the player's clan within the player data and sending the clan channel must be handled separately
* @param player The player to add to the clan
*/ | Adds the provided player to the clan. Note that setting the player's clan within the player data and sending the clan channel must be handled separately | addMember | {
"repo_name": "itsgreco/VirtueRS3",
"path": "src/org/virtue/game/content/clans/ClanSettings.java",
"license": "mit",
"size": 21080
} | [
"org.virtue.Virtue",
"org.virtue.game.content.chat.SocialUser",
"org.virtue.game.parser.AccountInfo"
] | import org.virtue.Virtue; import org.virtue.game.content.chat.SocialUser; import org.virtue.game.parser.AccountInfo; | import org.virtue.*; import org.virtue.game.content.chat.*; import org.virtue.game.parser.*; | [
"org.virtue",
"org.virtue.game"
] | org.virtue; org.virtue.game; | 2,691,129 |
@SimpleProperty(category = PropertyCategory.BEHAVIOR)
public double Altitude() {
return altitude;
} | @SimpleProperty(category = PropertyCategory.BEHAVIOR) double function() { return altitude; } | /**
* The most recently available altitude value, in meters. If no value is
* available, 0 will be returned.
*/ | The most recently available altitude value, in meters. If no value is available, 0 will be returned | Altitude | {
"repo_name": "tvomf/appinventor-mapps",
"path": "appinventor/components/src/com/google/appinventor/components/runtime/LocationSensor.java",
"license": "apache-2.0",
"size": 21026
} | [
"com.google.appinventor.components.annotations.PropertyCategory",
"com.google.appinventor.components.annotations.SimpleProperty"
] | import com.google.appinventor.components.annotations.PropertyCategory; import com.google.appinventor.components.annotations.SimpleProperty; | import com.google.appinventor.components.annotations.*; | [
"com.google.appinventor"
] | com.google.appinventor; | 1,936,939 |
public static List<String> asExecPaths(Iterable<Artifact> artifacts) {
return ImmutableList.copyOf(toExecPaths(artifacts));
} | static List<String> function(Iterable<Artifact> artifacts) { return ImmutableList.copyOf(toExecPaths(artifacts)); } | /**
* Converts a collection of artifacts into execution-time path strings, and
* returns those as an immutable list. Middleman artifacts are ignored by this method.
*/ | Converts a collection of artifacts into execution-time path strings, and returns those as an immutable list. Middleman artifacts are ignored by this method | asExecPaths | {
"repo_name": "rzagabe/bazel",
"path": "src/main/java/com/google/devtools/build/lib/actions/Artifact.java",
"license": "apache-2.0",
"size": 26120
} | [
"com.google.common.collect.ImmutableList",
"java.util.List"
] | import com.google.common.collect.ImmutableList; import java.util.List; | import com.google.common.collect.*; import java.util.*; | [
"com.google.common",
"java.util"
] | com.google.common; java.util; | 2,847,721 |
private void initGUI(){
this.setSize(700, 450);
this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
this.getContentPane().setLayout(new BorderLayout());
pnlAux = new JPanel();
pnlAux.setLayout(new BoxLayout(pnlAux,BoxLayout.Y_AXIS));
StatusMenssages();
playerInfo();
piecesColors();
playerModes();
autoMoves();
quitRestartButton();
pnlAux.add(pnlMsg);
pnlAux.add(playerInfo);
pnlAux.add(piecesColor);
pnlAux.add(playerModes);
pnlAux.add(autoMoves);
pnlAux.add(quitRestartButton);
initBoardGui();
this.setLayout(new BorderLayout());
this.add(pnlAux, BorderLayout.EAST);
this.setVisible(true);
}
| void function(){ this.setSize(700, 450); this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); this.getContentPane().setLayout(new BorderLayout()); pnlAux = new JPanel(); pnlAux.setLayout(new BoxLayout(pnlAux,BoxLayout.Y_AXIS)); StatusMenssages(); playerInfo(); piecesColors(); playerModes(); autoMoves(); quitRestartButton(); pnlAux.add(pnlMsg); pnlAux.add(playerInfo); pnlAux.add(piecesColor); pnlAux.add(playerModes); pnlAux.add(autoMoves); pnlAux.add(quitRestartButton); initBoardGui(); this.setLayout(new BorderLayout()); this.add(pnlAux, BorderLayout.EAST); this.setVisible(true); } | /**
* Inicializa la interfaz grafica
*/ | Inicializa la interfaz grafica | initGUI | {
"repo_name": "lbarja5/Pruebas",
"path": "src/es/ucm/fdi/tp/practica5/SwingView.java",
"license": "epl-1.0",
"size": 17611
} | [
"java.awt.BorderLayout",
"javax.swing.BoxLayout",
"javax.swing.JFrame",
"javax.swing.JPanel"
] | import java.awt.BorderLayout; import javax.swing.BoxLayout; import javax.swing.JFrame; import javax.swing.JPanel; | import java.awt.*; import javax.swing.*; | [
"java.awt",
"javax.swing"
] | java.awt; javax.swing; | 2,411,533 |
public static String pad(int len) {
char[] dash = new char[len];
Arrays.fill(dash, ' ');
return new String(dash);
} | static String function(int len) { char[] dash = new char[len]; Arrays.fill(dash, ' '); return new String(dash); } | /**
* Creates space filled string of given length.
*
* @param len Number of spaces.
* @return Space filled string of given length.
*/ | Creates space filled string of given length | pad | {
"repo_name": "pperalta/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java",
"license": "apache-2.0",
"size": 314980
} | [
"java.util.Arrays"
] | import java.util.Arrays; | import java.util.*; | [
"java.util"
] | java.util; | 1,151,749 |
public static long sig(String url) throws NoSuchMethodException, ScriptException {
return (long) ((double) callFunction("sig", url));
} | static long function(String url) throws NoSuchMethodException, ScriptException { return (long) ((double) callFunction("sig", url)); } | /**
* Calls the Javascript function that will hash the given url
*
* @param url
* @return
* @throws ScriptException
* @throws NoSuchMethodException
* @throws Exception
*/ | Calls the Javascript function that will hash the given url | sig | {
"repo_name": "hanz0r/ytmp3-controller",
"path": "src/main/java/org/hannes/musicbot/util/Bootstrap.java",
"license": "mit",
"size": 1927
} | [
"javax.script.ScriptException"
] | import javax.script.ScriptException; | import javax.script.*; | [
"javax.script"
] | javax.script; | 2,797,017 |
public Map<ExecutorDetails, WorkerSlot> getExecutorToSlot(); | Map<ExecutorDetails, WorkerSlot> function(); | /**
* get the executor -> slot map.
* @return
*/ | get the executor -> slot map | getExecutorToSlot | {
"repo_name": "mrknmc/storm-mc",
"path": "storm-multicore/src/jvm/backtype/storm/scheduler/SchedulerAssignment.java",
"license": "apache-2.0",
"size": 1673
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 1,762,100 |
private static byte getAndAccumulate(ByteBuffer buffer, int index, byte value, IntBinaryOperator op) {
final int byteIndex = index & ~0b11;
final int shift = 8 * (LE ? (index & 0b11) : (3 - (index & 0b11)));
final int mask = ~(0xff << shift);
checkIndexAndAccess(buffer, byteIndex, Integer.BYTES);
int current, newValue, result;
do {
current = (int) vhIntNative.getVolatile(buffer, byteIndex);
result = 0xff & op.applyAsInt((current >>> shift) & 0xff, value);
newValue = (current & mask) | (result << shift);
} while (!vhIntNative.weakCompareAndSet(buffer, byteIndex, current, newValue));
return (byte) (current >>> shift);
} | static byte function(ByteBuffer buffer, int index, byte value, IntBinaryOperator op) { final int byteIndex = index & ~0b11; final int shift = 8 * (LE ? (index & 0b11) : (3 - (index & 0b11))); final int mask = ~(0xff << shift); checkIndexAndAccess(buffer, byteIndex, Integer.BYTES); int current, newValue, result; do { current = (int) vhIntNative.getVolatile(buffer, byteIndex); result = 0xff & op.applyAsInt((current >>> shift) & 0xff, value); newValue = (current & mask) (result << shift); } while (!vhIntNative.weakCompareAndSet(buffer, byteIndex, current, newValue)); return (byte) (current >>> shift); } | /**
* Atomically performs the supplied update operation.
*
* @param buffer
* the byte buffer
* @param index
* the byte buffer index
* @param value
* the update value
* @param op
* the update operation
* @return the previous value
*/ | Atomically performs the supplied update operation | getAndAccumulate | {
"repo_name": "anba/es6draft",
"path": "src/main/java9/com/github/anba/es6draft/runtime/objects/atomics/Atomics.java",
"license": "mit",
"size": 26888
} | [
"java.nio.ByteBuffer",
"java.util.function.IntBinaryOperator"
] | import java.nio.ByteBuffer; import java.util.function.IntBinaryOperator; | import java.nio.*; import java.util.function.*; | [
"java.nio",
"java.util"
] | java.nio; java.util; | 1,793,891 |
public void gotRecords(List<BodyFile.Record> records);
} | void function(List<BodyFile.Record> records); } | /**
* Called with a chink of new records
* @param records
*/ | Called with a chink of new records | gotRecords | {
"repo_name": "uw-dims/tsk4j",
"path": "digests/src/main/java/edu/uw/apl/commons/tsk4j/digests/BodyFileBuilder.java",
"license": "bsd-3-clause",
"size": 11003
} | [
"edu.uw.apl.commons.tsk4j.digests.BodyFile",
"java.util.List"
] | import edu.uw.apl.commons.tsk4j.digests.BodyFile; import java.util.List; | import edu.uw.apl.commons.tsk4j.digests.*; import java.util.*; | [
"edu.uw.apl",
"java.util"
] | edu.uw.apl; java.util; | 1,260,415 |
public void setStayAliveRules(int... a) {
stayAlive = new Array<Integer>();
for (int i : a)
stayAlive.add(i);
} | void function(int... a) { stayAlive = new Array<Integer>(); for (int i : a) stayAlive.add(i); } | /**
* Sets the amount of neighbors that will keep the cells alive
*
* @param a
*/ | Sets the amount of neighbors that will keep the cells alive | setStayAliveRules | {
"repo_name": "BenMcH/Mineabound-LibGdx",
"path": "core/src/com/tycoon177/mineabound/utils/world/CellularAutomata.java",
"license": "gpl-2.0",
"size": 3559
} | [
"com.badlogic.gdx.utils.Array"
] | import com.badlogic.gdx.utils.Array; | import com.badlogic.gdx.utils.*; | [
"com.badlogic.gdx"
] | com.badlogic.gdx; | 2,696,699 |
protected void setupGUI() throws NoOpUserError {
System.setProperty(BookmarkIO.PROPERTY_BOOKMARKS_DIR, FileSystemService.getUserRapidMinerDir().getAbsolutePath());
System.setProperty(BookmarkIO.PROPERTY_BOOKMARKS_FILE, ".bookmarks");
System.setProperty(DatabaseConnectionService.PROPERTY_CONNECTIONS_FILE, "connections");
try {
UIManager.setLookAndFeel(new RapidLookAndFeel());
//OperatorService.reloadIcons();
} catch (Exception e) {
//LogService.getRoot().log(Level.WARNING, "Cannot setup modern look and feel, using default.", e);
LogService.getRoot().log(Level.WARNING,
I18N.getMessage(LogService.getRoot().getResourceBundle(),
"com.rapidminer.gui.RapidMinerGUI.setting_up_modern_look_and_feel_error"),
e);
}
} | void function() throws NoOpUserError { System.setProperty(BookmarkIO.PROPERTY_BOOKMARKS_DIR, FileSystemService.getUserRapidMinerDir().getAbsolutePath()); System.setProperty(BookmarkIO.PROPERTY_BOOKMARKS_FILE, STR); System.setProperty(DatabaseConnectionService.PROPERTY_CONNECTIONS_FILE, STR); try { UIManager.setLookAndFeel(new RapidLookAndFeel()); } catch (Exception e) { LogService.getRoot().log(Level.WARNING, I18N.getMessage(LogService.getRoot().getResourceBundle(), STR), e); } } | /** This default implementation only setup the tool tip durations. Subclasses might
* override this method. */ | This default implementation only setup the tool tip durations. Subclasses might | setupGUI | {
"repo_name": "rapidminer/rapidminer-5",
"path": "src/com/rapidminer/gui/RapidMinerGUI.java",
"license": "agpl-3.0",
"size": 25865
} | [
"com.rapidminer.NoOpUserError",
"com.rapidminer.gui.look.RapidLookAndFeel",
"com.rapidminer.gui.look.fc.BookmarkIO",
"com.rapidminer.tools.FileSystemService",
"com.rapidminer.tools.LogService",
"com.rapidminer.tools.jdbc.connection.DatabaseConnectionService",
"java.util.logging.Level",
"javax.swing.UIManager"
] | import com.rapidminer.NoOpUserError; import com.rapidminer.gui.look.RapidLookAndFeel; import com.rapidminer.gui.look.fc.BookmarkIO; import com.rapidminer.tools.FileSystemService; import com.rapidminer.tools.LogService; import com.rapidminer.tools.jdbc.connection.DatabaseConnectionService; import java.util.logging.Level; import javax.swing.UIManager; | import com.rapidminer.*; import com.rapidminer.gui.look.*; import com.rapidminer.gui.look.fc.*; import com.rapidminer.tools.*; import com.rapidminer.tools.jdbc.connection.*; import java.util.logging.*; import javax.swing.*; | [
"com.rapidminer",
"com.rapidminer.gui",
"com.rapidminer.tools",
"java.util",
"javax.swing"
] | com.rapidminer; com.rapidminer.gui; com.rapidminer.tools; java.util; javax.swing; | 1,248,472 |
public void setResteasyProviderFactory(
ResteasyProviderFactory resteasyProviderFactory)
{
this.resteasyProviderFactory = resteasyProviderFactory;
} | void function( ResteasyProviderFactory resteasyProviderFactory) { this.resteasyProviderFactory = resteasyProviderFactory; } | /**
* Optional property for advanced usage. For the most cases this property is
* not needed to be set.
*
* @param resteasyProviderFactory the instance to be used by proxy generation.
*/ | Optional property for advanced usage. For the most cases this property is not needed to be set | setResteasyProviderFactory | {
"repo_name": "awhitford/Resteasy",
"path": "resteasy-spring/src/main/java/org/jboss/resteasy/client/spring/RestClientProxyFactoryBean.java",
"license": "apache-2.0",
"size": 5584
} | [
"org.jboss.resteasy.spi.ResteasyProviderFactory"
] | import org.jboss.resteasy.spi.ResteasyProviderFactory; | import org.jboss.resteasy.spi.*; | [
"org.jboss.resteasy"
] | org.jboss.resteasy; | 1,124,455 |
@Test
@Ignore("Tries to connect to p4java://eng-p4java-vm.perforce.com:40132 that does not exist")
public void testGetDiffFilesUnchangedFiles() {
// This file is type <unicode+C>
// ~ 13mb file size
String depotFile = "//depot/132Bugs/job071340/Other/Localization/QA/UserGuide_JA-JP/omegat/project_save.tmx";
// This file is type <unicode>
// ~ 1kb
String depotFile2 = "//depot/132Bugs/job071340/Other/Localization/TestProject/omegat/project_save.tmx";
IChangelist changelist = null;
List<IFileSpec> files = null;
try {
// Create a changelist
changelist = getNewChangelist(server, client, "Dev141_GetDiffFilesUnchangedTest get diff files");
assertNotNull(changelist);
changelist = client.createChangelist(changelist);
// Sync files
files = client.sync(FileSpecBuilder.makeFileSpecList(new String[] {depotFile, depotFile2}), new SyncOptions().setForceUpdate(true));
assertNotNull(files);
//Map<String, Object>[] results = server.execMapCmd("sync", new String[] { "-f", depotFile }, null);
//assertNotNull(results);
// Get diff files (diff -se) - unopened file
files = client.getDiffFiles(FileSpecBuilder.makeFileSpecList(new String[] {depotFile, depotFile2}), new GetDiffFilesOptions().setUnopenedDifferent(true));
assertNotNull(files);
assertTrue(files.isEmpty());
// Open a file for edit
files = client.editFiles(FileSpecBuilder.makeFileSpecList(new String[] {depotFile, depotFile2}), new EditFilesOptions().setChangelistId(changelist.getId()));
assertNotNull(files);
assertFalse(files.isEmpty());
// Get diff files (diff -sa) - opened file
files = client.getDiffFiles(FileSpecBuilder.makeFileSpecList(new String[] {depotFile, depotFile2}), new GetDiffFilesOptions().setOpenedDifferentMissing(true));
assertNotNull(files);
assertTrue(files.isEmpty());
} catch (P4JavaException e) {
fail("Unexpected exception: " + e.getLocalizedMessage());
} finally {
if (client != null) {
if (changelist != null) {
if (changelist.getStatus() == ChangelistStatus.PENDING) {
try {
// Revert files in pending changelist
client.revertFiles(
changelist.getFiles(true),
new RevertFilesOptions()
.setChangelistId(changelist.getId()));
} catch (P4JavaException e) {
// Can't do much here...
}
}
}
}
}
} | @Ignore(STR String depotFile2 = STRDev141_GetDiffFilesUnchangedTest get diff filesSTRUnexpected exception: " + e.getLocalizedMessage()); } finally { if (client != null) { if (changelist != null) { if (changelist.getStatus() == ChangelistStatus.PENDING) { try { client.revertFiles( changelist.getFiles(true), new RevertFilesOptions() .setChangelistId(changelist.getId())); } catch (P4JavaException e) { } } } } } } | /**
* Test IClient.getDiffFiles() with unchanged files under the Windows platform.
*
* Diff local file against depot file to see if there is change.
*
* diff -sa (opened file - but no change)
* diff -se (unopened file - no change)
*/ | Test IClient.getDiffFiles() with unchanged files under the Windows platform. Diff local file against depot file to see if there is change. diff -sa (opened file - but no change) diff -se (unopened file - no change) | testGetDiffFilesUnchangedFiles | {
"repo_name": "groboclown/p4ic4idea",
"path": "p4java/r18-1/src/test/java/com/perforce/p4java/tests/dev/unit/bug/r141/GetDiffFilesUnchangedTest.java",
"license": "apache-2.0",
"size": 5416
} | [
"com.perforce.p4java.core.ChangelistStatus",
"com.perforce.p4java.exception.P4JavaException",
"com.perforce.p4java.option.client.RevertFilesOptions",
"org.junit.Ignore"
] | import com.perforce.p4java.core.ChangelistStatus; import com.perforce.p4java.exception.P4JavaException; import com.perforce.p4java.option.client.RevertFilesOptions; import org.junit.Ignore; | import com.perforce.p4java.core.*; import com.perforce.p4java.exception.*; import com.perforce.p4java.option.client.*; import org.junit.*; | [
"com.perforce.p4java",
"org.junit"
] | com.perforce.p4java; org.junit; | 1,512,856 |
public static boolean isPointInRect(Rectangle2D rect, double x, double y) {
return (x >= rect.getMinX() && x <= rect.getMaxX()
&& y >= rect.getMinY() && y <= rect.getMaxY());
} | static boolean function(Rectangle2D rect, double x, double y) { return (x >= rect.getMinX() && x <= rect.getMaxX() && y >= rect.getMinY() && y <= rect.getMaxY()); } | /**
* Returns {@code true} if the specified point (x, y) falls within or
* on the boundary of the specified rectangle.
*
* @param rect the rectangle ({@code null} not permitted).
* @param x the x-coordinate.
* @param y the y-coordinate.
*
* @return A boolean.
*/ | Returns true if the specified point (x, y) falls within or on the boundary of the specified rectangle | isPointInRect | {
"repo_name": "jfree/jfreechart",
"path": "src/main/java/org/jfree/chart/internal/ShapeUtils.java",
"license": "lgpl-2.1",
"size": 17489
} | [
"java.awt.geom.Rectangle2D"
] | import java.awt.geom.Rectangle2D; | import java.awt.geom.*; | [
"java.awt"
] | java.awt; | 60,028 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.